Article Title: using a busybox-1.13.3 to create a Linux root file system (2 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
8. Create an empty mdev. conf file, which will be used when mounting the root file system.
[~ Etc] # touch mdev. conf
9. Copy the passwd, shadow, and group files from the local machine.
[~ Etc] # cp/etc/passwd.
[~ Etc] # cp/etc/shadow.
[~ Etc] # cp/etc/group.
Modify the passwd file and change bash in the first and last lines to ash.
10. Copy all the files in the default installation directory of busybox to the rootfs.
The RC-> bin/busybox file is added, which is the mounting file system.
[~ Etc] # cd ..
[~ Rootfs] # cp-Rfv/opt/develop/lyj/common/porting/rootfs/busybox-1.12.2/_ install /*./
OK. You have created a basic file system using busybox.
PS:
If you select the dynamic library mode for compiling the busybox, you need to check which dynamic libraries are used by the generated busybox and copy them to the rootfs/lib directory.
[~ Lib] # arm-linux-readelf-d ../bin/busybox
Dynamic section at offset 0xc1014 contains 21 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libm. so.6]
0x00000001 (NEEDED) Shared library: [libc. so.6]
0x0000000c (INIT) 0xc2ec
0x0000000d (FINI) 0xa96b8
0x00000004 (HASH) 0x80e8
0x00000005 (STRTAB) 0xa4c4
0x00000006 (SYMTAB) 0x8b64
0x0000000a (STRSZ) 3505 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000015 (DEBUG) 0x0
Zero x 00000003 (PLTGOT) 0xd10e4
0x00000002 (PLTRELSZ) 3112 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0xb6c4
0x00000011 (REL) 0xb674
0x00000012 (RELSZ) 80 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0xb5a4
0x6fffffff (VERNEEDNUM) 2
0x6ffffff0 (VERSYM) 0xb276
0x00000000 (NULL) 0x0
We can see that the libm. so.6 and libc. so.6 libraries are used. I found that only copying these two libraries is not enough, but also need ld-linux.so.2 and libgcc_s.so.1, that is, I compiled this busybox needs 4 dynamic library files.
# Cp/opt/crosstools/gcc-3.4.6-glibc-2.3.6/lib/libm. so.6.
# Cp/opt/crosstools/gcc-3.4.6-glibc-2.3.6/lib/libc. so.6.
# Cp/opt/crosstools/gcc-3.4.6-glibc-2.3.6/lib/ld-linux.so.2.
# Cp/opt/crosstools/gcc-3.4.6-glibc-2.3.6/lib/libgcc_s.so.1.
In this way, using the dynamic library can save about half of the space, but the efficiency is reduced.
Prepare the Link Library
# Cd $ {OBJ_LIB}/lib ($ {OBJ_LIB} is the directory of the Cross-compiling environment)
# For file in libc libcrypt libdl libm \
> Libpthread libresolv libutil
> Do
> Cp $ file-*. so/home/fortis/rootfs/lib
> Cp-d $ file. so. [* 0-9]/home/fortis/rootfs/lib
> Done
# Cp-d ld *. so */home/fortis/rootfs/lib
11. Test
1) modify the/etc/export file on the local machine and restart the NFS service:
[Root @ vm-dev root] # vi/etc/exports
/Opt/lyj 192.168.1. * (rw, insecure, sync, no_root_squash)
/Opt/develop/lyj/common/porting/rootfs/root_stand/reset/rootfs 192.168.1. * (rw, insecure, sync, no_root_squash)
[Root @ vm-dev root] # service nfs restart
2) In Bootloader, pass the following parameters to the Kernel:
Root =/dev/nfs rw nfsroot = 192.168.1.152:/opt/develop/lyj/common/porting/rootfs/root_stand/reset/rootfs ip = 192.168.1.155: 192.168.1.152: 192.168.1.254: 255.255.255.0: jacky: eth0: off console = ttySAC0, 115200 init =/linuxrc noinitrd
[1] [2] [3] Next page