Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

16
Building Embedded Linux System 2005/09/21 Reporter: sih-h an wang
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    219
  • download

    0

Transcript of Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Page 1: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Building Embedded Linux System

2005/09/21 Reporter: sih-han wang

Page 2: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

StrongARMStrongARM

32-bit StrongARM RISC processor 執行速度 :max 206 MHz

Page 3: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

連結式規劃

Cross-platformDevelopmentEnvironment

Host•Bootloader•Kernel•Root Filesystem

Target

Page 4: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.
Page 5: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

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

Extract and decompress the Kernel Image and RAMDISK

Launch kernel

Initialize Memory and Hardware

Mount Root Filesystem (RAMDISK)

Run /sbin/init

User Programs

Bootloader

Kernel

Page 6: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Make Kernel 使用 Linux kernel

需要 Linux kernel source + some patches if needed

cross-compiler

Page 7: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Kernel Configuration make config

這種模式需要逐行輸入所需要設定的項目,無法往前修改設定,所以目前很少使用這種方式來設定 Kernel 的項目了

make xconfig 這種模式則是使用 X-Window 為主要環境的設定模式!

除非你有 X-Window 在執行,否則沒有辦法使用這種模式;

make menuconfig----Makefile 這種模式有點像是文字界面的選單模式,較為簡便,

而且可以在純文字界面下面執行編輯動作!

Page 8: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Kernel Compiling

make cleanmake menuconfig

( gzip –dc /home/ patch-2.4.18-rmk7.gz | patch –p1 –d arm-linux

gzip –dc /home/ diff-2.4.18-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-

Page 9: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Make Root Filesystem

Filesystem:

Busybox

Device node

Configuration

Page 10: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

BusyBox Combine tiny versions of many common UNIX into a

single small executable. Provide a fairly complete environment for any smal

l or embedded system. BusyBox has been written with size-optimization a

nd 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

Page 11: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Make Busybox make menuconfig ln –s /home/arm-linux/include/linux/version.h vers

ion.h (/usr/local/arm/2.95.3/arm-linux/include/linux) make

make PREFIX=../busybox_arm install

Page 12: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Device Files 檔名 類型 主編號 次編號 權限 mknod console c 5 1 600

mknod tty0 c 5 0 600

mknod mem c 1 1 600

mknod null c 1 3 666

mknod random c 1 8 644

Page 13: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

initrd initrd provides the capability to load a RAM disk by th

e boot loader. This RAM disk can then be mounted as the root file sys

tem and programs can be run from it. Afterwards, a new root file system can be mounted fro

m 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.

Page 14: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

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.img > initrd.bin

8MB fileis null

~/root-fs

mount

Write DATA

8MB filewith data

unmount

Page 15: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Write Shell Script /etc/inittab

::sysinit:/etc/rc.S ::askfirst:/bin/sh

/etc/rc.S #!/bin/sh mount -t proc proc /proc

Page 16: Building Embedded Linux System 2005/09/21 Reporter: sih-han wang.

Cross-Compiler X86 Architecture code

ARM(Advanced RISC Machine) execution

-----------------------------

Cross-Compiler

在 /etc/bashrc 中加入PATH=$PATH:/usr/local/arm/2.95.3/bin

Next