Building Embedded Linux System 2005/09/21 Reporter: sih-han wang
StrongARM 32-bit StrongARM RISC processor 執行速度 : max 206 MHz
連結式規劃 Cross-platform Development Environment Host Bootloader Kernel Root Filesystem Target
There are four main steps to creating a target Linux system Determine system components Configure and build the kernel Build root filesystem Set up boot software and configuration
Make Kernel 使用 Linux kernel 需要 Linux kernel source + some patches if needed cross-compiler
Kernel Configuration make config 這種模式需要逐行輸入所需要設定的項目,無法往前 修改設定,所以目前很少使用這種方式來設定 Kernel 的項目了 make xconfig 這種模式則是使用 X-Window 為主要環境的設定模 式!除非你有 X-Window 在執行,否則沒有辦法使 用這種模式; make menuconfig---- Makefile 這種模式有點像是文字界面的選單模式,較為簡便, 而且可以在純文字界面下面執行編輯動作!
Kernel Compiling make clean make menuconfig ( gzip – dc /home/ patch rmk7.gz | patch – p1 – d arm-linux gzip – dc /home/ diff rmk7-pxa3.gz | patch – p1 – d arm-linux) make assabet_config make oldconfig make dep make zImage Additional Options: ARCH=arm CROSS_COMPILE=arm-linux-
Make Root Filesystem Filesystem: Busybox Device node Configuration
BusyBox Combine tiny versions of many common UNIX into a single small executable. Provide a fairly complete environment for any small or embedded system. BusyBox has been written with size- optimization and limited resources in mind. It is also extremely modular so you can easily include or exclude commands (or features) at compile time. This makes it easy to customize your embedded systems Ex: ls dd cp cat tar chmod mknod find ps
Make Busybox make menuconfig ln –s /home/arm- linux/include/linux/version.h version.h (/usr/local/arm/2.95.3/arm- linux/include/linux) make make PREFIX=../busybox_arm install
Device Files 檔名 類型 主編號 次編號 權限 mknod console c mknod tty0 c mknod mem c mknod null c mknod random c
initrd initrd provides the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root file system and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted. initrd is mainly designed to allow system startup to occur in two phases, where the kernel comes up with a minimum set of compiled-in drivers, and where additional modules are loaded from initrd.
Make INITRD image dd if=/dev/zero of=/home/initrd.img bs=1k count=8192 su root mke2fs -F -v -m0 /home/initrd.img mkdir tmp mount -o loop initrd.img tmp/ cp ~/root-fs/* /home/tmp/ -dpRrf umount tmp/ gzip -9 initrd.bin 8MB file is null ~/root-fs mount Write DATA 8MB file with data unmount
Write Shell Script / etc/inittab ::sysinit:/etc/rc.S ::askfirst:/bin/sh /etc/rc.S #!/bin/sh mount -t proc proc /proc
Cross-Compiler X86 Architecture code ARM(Advanced RISC Machine) execution Cross-Compiler 在 /etc/bashrc 中加入 PATH=$PATH:/usr/local/arm/2.95.3/bin Next