Embedded development makes the smallest Linux file system

Source: Internet
Author: User

Requirement: The compiler version is 4.4.6

To view the current cross compiler version:arm-linux-gcc-v

If it is not a 4.4.6 compiler, you need to modify two files:

Vim/home/tarena/.bashrc

Delete the last line:

Export PATH =/opt/arm-2009q3 ...

sudo vim/etc/environment add support for 4.4.6

Minimum root file system!!!

1. make your own minimal root file system

1.0

Remove the contents of the previous extract completely

RM busybox-1.19.4-fr

1.1 Decompression busybox Source code

Cd/home/tarena/workdir/tools

TAR-JXVF busy ...

1.2 configuration busybox

CD busybox-1.19.4

Make Menuconfig

Linux Module Utilities--->

[*] Simplified Modutils (NEW)// remove this option

[*] Insmod

[*] Rmmod

[*] Lsmod

[*] Pretty output

[*] Modprobe

[*] Blacklist support

[*] Depmod

Save exit

1.3 Modify Makefile before compiling

ARCH = arm// no space behind ( line)

Cross_compile = arm-linux-// no spaces behind (164 Line)

1.4 Make compilation

1.5 make Install// Install the compiled busybox

1.6 default installation to the current directory _install directory

1.7 CD _install// Enter the installation directory

1.8 Checking The properties of the BusyBox executable program

File Bin/busybox// must be the following information for the ARM architecture, otherwise it is not

Bin/busybox:ELF 32-bit LSB executable,ARM,version 1( SYSV),dynamically linked(uses shared libs), Stripped

If it's not an ARM architecture, it's Intel, you need to check if Makefile has been modified!

1.9 Creating the necessary directories

mkdir Dev lib etc proc Sys

1.10 Creating additional catalogs

mkdir home mnt var tmp root

1.10.1 Add etc/inittab file,

The information is as follows:

:: Sysinit:/etc/init.d/rcs

:: respawn:-/bin/sh

:: Ctrlaltdel:/sbin/reboot

:: Shutdown:/bin/umount-a-R

1.11

Add system basic Configuration file (fstab,profile,rcS)

Vim Etc/fstab: Add the following information

PROC/PROC proc Defaults 0 0

Tmpfs/tmp TMPFS Defaults 0 0

Sysfs/sys Sysfs Defaults 0 0

Tmpfs/dev TMPFS Defaults 0 0

Tmpfs is also a virtual file system, where file system-related information exists in memory

Vim Etc/profile: No information is added, this is used to configure the system's Global environment variables

mkdir etc/init.d/

Vim Etc/init.d/rcs: Add the following information:

/bin/mount-a

Mkdir/dev/pts

Mount-t devpts devpts/dev/pts

Echo/sbin/mdev >/proc/sys/kernel/hotplug

Mdev-s

Modify file permissions:chmod 777 RcS

1.12

Add a basic library file for your system

The principle of adding libraries: which libraries are required for the application, which libraries are copied to the Lib , and the dynamic libraries are in the cross-compiler.

1. View The dynamic libraries required by the BusyBox executable

Arm-linux-readelf-a Bin/busybox | grep "Shared"

0x00000001 (NEEDED) Shared library:[libm.so.6]

0x00000001 (NEEDED) Shared library:[libx.so.6]

The dynamic libraries needed to get BusyBox are:libm,libc

2. Remember to copy the loader (dynamic link library) to Lib(ld-*)

3. so busybox ultimately requires three libraries

cp/home/tarena/workdir/toolchains/opt/s5pv210-crosstools/4.4.6/arm-concenwit-linux-gnueabi/lib/ld-* lib/-FRD// first copy the dynamic link library, remember to add - D Options

cp/home/tarena/workdir/toolchains/opt/s5pv210-crosstools/4.4.6/arm-concenwit-linux-gnueabi/lib/libc* lib/-FRD

and then the C Library other than the dynamic library, static library all deleted, keep a three C Library:libc-2.10.1.so libc.so.6 Libc.so

cp/home/tarena/workdir/toolchains/opt/s5pv210-crosstools/4.4.6/arm-concenwit-linux-gnueabi/lib/libm* lib/-FRD// put m other dynamic libraries outside the library, the static library is all deleted,

Keep three m libraries:libm-2.10.1.so libm.so.6 libm.so

Dynamic Library naming:lib+ library name +.so

1.13 to the minimum root file creation OK(3.2M)

1.14 Test

Mv/opt/rootfs/opt/rootfs_bak// pre-backup root file system

CP/HOME/TARENA/WORKDIR/TOOLS/BUSYBOX-1.19.4/_INSTALL/OPT/ROOTFS-FRD//Remember that the-D option is not missing (missing -D 4. x M )

1.15 Restart The Development Board and use the NFS process to test

1.16 modifying inittab files

Vim/opt/rootfs/etc/inittab Changes the askfirst to respawn,

No need to press ENTER in the future, directly into the shell terminal

Perform basic qt required libraries (libraries from ARM-LINUX-GCC ) After the lack of any bitter basic from here to take

Summary: Different kernels, in different operating systems (virtual machines or physical machines compiled above) even if the use of the cross-compiler, or can not insert the driver module, because the compile time will be compiled with gcc , different operating systems used on the GCC not the same, there is the use of QT What dynamic libraries are required to compile and which are compiled, some from Arm-linux come in, some from their own QT The source code in the self-compilation after the QT libraries, different libraries are placed after the environment variables are configured, in short: in different environments, even if they are Ubunt , it is necessary to new compilation of the corresponding source code.

Ds18b20_drv:version Magic ' 2.6.35.7-embedsky preempt mod_unload ARMv7 ' should be ' 2.6.35.7-concenwit preempt mod_unload ARMv7 '

Led_drv:version Magic ' 2.6.35.7-embedsky preempt mod_unload ARMv7 ' should be ' 2.6.35.7-concenwit preempt mod_unload ARMv 7 '

At24c02_drv:version Magic ' 2.6.35.7-embedsky preempt mod_unload ARMv7 ' should be ' 2.6.35.7-concenwit preempt mod_unload ARMv7 '

Beep_drv:version Magic ' 2.6.35.7-embedsky preempt mod_unload ARMv7 ' should be ' 2.6.35.7-concenwit preempt mod_unload ARM V7 '

Beep_dev:version Magic ' 2.6.35.7-embedsky preempt mod_unload ARMv7 ' should be ' 2.6.35.7-concenwit preempt mod_unload ARM V7 '

Insmod:can ' t insert '/home/drivers/ds18b20_drv.ko ': Invalid module format

Insmod:can ' t insert '/home/drivers/led_drv.ko ': Invalid module format

Insmod:can ' t insert '/home/drivers/at24c02_drv.ko ': Invalid module format

Insmod:can ' t insert '/home/drivers/beep_drv.ko ': Invalid module format

Insmod:can ' t insert '/home/drivers/beep_dev.ko ': Invalid module format

Use a different kernel, causing the load driver to be incompatible with the kernel version.

Embedded development makes the smallest Linux file system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.