10009. Cut Linux with busybox

xiaoxiao2021-03-06  63

BusyBox makes tiny linux, I save the process of making the boot disk, this online can be a lot of money! More ... I get Linux partitions on the hard drive: / dev / hda1 / boot / dev / hda2 / / / / / hda3 swap, now started with busybox. . . The actual operation process is quite simple: download the source file of busybox, everyone is best to go to BusyBox's official website, so you can see a lot of documents :) I downloaded the busybox-1.00-RC3 version, it is also its latest version TAR ZXVF BusyBox-1.00-rc3.tar.gz CD Busybox-1.00-RC3 Make MenuConfig (This process is similar to compiling Linux kernels, if you don't compile the kernel, then look at another document in my blog first. After doing your own option, Make Dep Make Make Install By default, busybox generates a _install directory in the current directory. After compiling the files in this directory, we must use this directory. Let's make our tiny linux let's take a look at the structure in this directory: / usr / etc / .... because I wrote this document after compiling, so the directory column is not all, anyway, this It is not important. Everyone is trying to observe themselves, then it is a replacement. About busybox works, you can refer to busybox information, a big brief arrest! ! The main operations directory has ETC USR BIN SBIN to replace these directorys with the directory just compiled, then put the passwd passwd- shadow shadow in the original ETC directory to the busybox directory (you have to log in, Haha, you have to use these documents.) In fact, this time the size of the system is less than 200m. Here is a further clipping work, this work is mainly concentrated in the lib directory structure: The root directory is some Common SO Library Modules is a folder directory ending in the module module catalog, if you are a multi-CPU, there is a directory ending, if you have compiled the kernel, there is an Elcustom ending directory Decide that you use the kernel, if you use SMP, then delete the other two, if you use your own compiled kernel, then delete the other two, the same reason, other SO files in the lib directory Everyone will decide, but there is such a question. If you have a "login increct: user 'unknown' Failed on 'TTY2'" prompt, it is likely that you have erroised it, make it back. . .

The clipping process, in addition to deleting the file, I think there is still a problem, it is to improve the function, implement Linux common functions: such as the network, the file system RW attribute, etc. This is also the problem I encountered during the cutting process, 1, restore the network Function network features require such a few necessary conditions: 1) kernel support INET4 2) There is a network card driver, suppose, we started to set the network to this Tinylinux: My network card is 8139, so I need it NIC driver in /lib/modules/2.4.21-9.elcustom/kernel/drivers/net/8139too.so Of course, the PCI's network card also needs this stuff: /lib/modules/kernel. /Drivers/net/mi.o (why I don't know this, anyway, it must be, FreeBSD is when compiling the kernel, it must be added with MII, and the friends who compile the BSD kernel must have an impression. OK, there is another SO to be added, that is /Lib/Modules/2.4.21-9.elcustom/kernel/lib/crc32.o, this stuff, what is the role, the master comment, I It is not clear, or everyone goes to Google Search. Summary steps to join the network: / sbin / insmod /lib/modules/wi - ket / inlib/crc32.o / sbin / insmod / lib / Modules / 2.4.21-9.elcustom / kernel / drivers / net / mii.o / sbin / insmod /lib/modules/2.4.21-9.elcustom/kernel/drivers/net/8139too.so saw anything? ? Your network card has already got up. . . But don't increase this sentence in /etc/modules.conf file: Alias ​​Eth0 8139too (Why don't you understand, ask you, please ask, you should enter: ifconfig eth0 INET 192.168.0.2 Netmask 255.255.255.0 Results? It should be that everyone is expected. . You can also add routing: / sbin / route add default GW 192.168.0.1 No matter what else, first ping the gateway and say: #ping 192.168.0.1 .................. ....... Landing to 192.168.0.1: 192.168.0.1 # ping 192.168.0.2. . . . . . . . . . . . . The network function is basically no problem, I tried ping 202.102.88. * This external network IP. 2. The read and write function of the file system. BusyBox startup process is different from Linux. It is started after the kernel is started, and the script is running /etc/init.d/rcs, and only this startup script, so if there is any program that is running or initialized during startup I can only write in this script. In my observation, the operation related to the file system (I refer to Mount or Umount) in the Linux startup: The first step is RO (read-only, Only the form of only Mount / this is in GRUB.

转载请注明原文地址:https://www.9cbs.com/read-105974.html

New Post(0)