210 likes | 579 Views
Embedded Linux porting. Speaker: Yi-Ji Jheng Date: 2007.12.05. Outline. Embedded Linux porting. Embedded Linux porting. Step. Toolchain*. zImage. Kernel. File System. ramdisk.gz. busybox. Toolchain*. buildroot. Source Environment. porting/ |-filesystem |-busybox-1.1.3.tar.gz
E N D
Embedded Linux porting Speaker: Yi-Ji Jheng Date: 2007.12.05
Outline • Embedded Linux porting
Step Toolchain* zImage Kernel File System ramdisk.gz busybox Toolchain* buildroot
Source Environment • porting/ |-filesystem |-busybox-1.1.3.tar.gz |-busybox.config |-rootfs.tar.gz |-kernel |-linux-2.4.17_mvl21.tar.gz |-opt.tar.gz |-toolchain |-buildroot-0.9.27.tar.gz |-buildroot.config |-dl
Make Toolchain • #tar zxvf buildroot-0.9.27.tar.gz • #cd ./buildroot • #cp ../buildroot.config ./.config • #make menuconfig • #cp -af ../dl ./. • #make • #PATH=$PATH:/usr/local/toolchain/bin
Make busybox with Toolchain • #tar zxvf busybox-1.1.3.tar.gz • #cd ./busybox-1.1.3 • #cp ../busybox.config ./.config • #make menuconfig • #make • #make install • #ll ./_install/
Make File System (1/2) • #cd .. • #dd if=/dev/zero of=ramdisk count=1024 bs=8192 • #mke2fs ramdisk • #mkdir /mnt/tmp • #mount -o loop ramdisk /mnt/tmp • #cp -af ./busybox-1.1.3/_install/* /mnt/tmp/.
Make File System (2/2) • #tar zxvf rootfs.tar.gz • #cp -af ./rootfs/* /mnt/tmp/. • #mkdir /mnt/tmp/var • #mkdir /mnt/tmp/tmp • #mkdir /mnt/tmp/proc • #umount ramdisk • #gzip -9 ramdisk
Make zImage (1/2) • #tar zxvf opt.tar.gz • #PATH=$PATH:/usr/src/porting/kernel/opt/hardhat/devkit/mips/lexra_fp_be/bin • #PATH=$PATH:/usr/src/porting/kernel/opt/tools • #tar zxvf linux-2.4.17_mvl21.tar.gz • #cd ./linux-2.4.17_mvl21
Make zImage (2/2) • #cp sd.config ./.config • #make menuconfig • #make dep • #cp -af ../../filesystem/ramdisk.gz ./arch/mips/ramdisk/. • #make zImage • Download on Target Board
Work • Compile a program on Target Board
Menuconfig • Target Architecture (mips) ---> • Build options ---> (/usr/local/toolchain) Toolchain and header file location? • Toolchain Options ---> --- Kernel Header Options Kernel Headers (Linux 2.4.27 kernel headers) ---> --- uClibc Options [ ] Use the daily snapshot of uClibc? --- Binutils Options Binutils Version (binutils 2.15.94.0.2) ---> --- Gcc Options GCC compiler Version (gcc 3.4.3) ---> [] Build/install c++ compiler and libstdc++? --- Ccache Options [ ] Enable ccache support? --- Common Toolchain Options [] Enable multilib support? [] Enable large file (files > 2 GB) support? • Package Selection for the target ---> [ ] busybox • Target Options ---> [*] ext2 root filesystem for the target device
Get Method • 1. get from Internet • Must to modify website • #vi ./toolchain/gcc/gcc-uclibc-3.x.mk • GCC_SITE:=http://mirrors.usc.edu/pub/gnu/gcc/gcc-$(GCC_VERSION) • 2. perpare in advance
Uclibc Question • Target Processor Architecture > 1. Generic (MIPS I) (CONFIG_MIPS_ISA_1) (NEW) 2. MIPS II (CONFIG_MIPS_ISA_2) (NEW) 3. MIPS III (CONFIG_MIPS_ISA_3) (NEW) 4. MIPS IV (CONFIG_MIPS_ISA_4) (NEW) 5. MIPS32 (CONFIG_MIPS_ISA_MIPS32) (NEW) 6. MIPS64 (CONFIG_MIPS_ISA_MIPS64) (NEW) choice[1-6?]:<Enter> • Target Processor Endianness > 1. Little Endian (ARCH_LITTLE_ENDIAN) (NEW) 2. Big Endian (ARCH_BIG_ENDIAN) (NEW) choice[1-2?]:<Enter> • Target CPU has a memory management unit (MMU) (ARCH_HAS_MMU) [Y/n/?] (NEW) <Enter>
Menuconfig • Busybox Settings ---> Build Options ---> [*] Do you want to build BusyBox with a Cross Compiler? (mips-linux-) Cross Compiler prefix