linux-2.6.24.4核心移植到s3c2440—-使用busybox-1.9.2製作根檔案系統

來源:互聯網
上載者:User

 

2.6.24.4 核心移植到s3c2440---- 之使用busybox-1.9.2 製作根檔案系統   --------------------------------------------------------------------------------------------------- 移植環境:主機:CentOS 5.1交叉編譯器:arm-linux-gcc-3.4.1開發板平台:S3C2440(YL-2440/YLP-2440開發板) 開始移植 1.       下載最新的busybox1.9.2,並解壓縮。下載busybox原始碼:http://busybox.net/downloads/busybox-1.9.2.tar.bz2交叉編譯工具:同核心解壓源碼:tar -jxvf busybox-1.9.2.tar.bz2  2.       修改Makefile中的174行的 arch和編譯工具鏈頭。ARCH                 ?= armCROSS_COMPILE       ?= /usr/local/arm/3.4.1/bin/arm-linux- 3.       make menuconfig. 修改編譯配置選項。 Busybox Setting----->       build option-->    [ ] Build BusyBox as a static binary (no shared libs)                          [*] Build shared libbusybox                                                    [*]   Produce a binary for each applet, linked against libbusybox              [*]   Produce additional busybox binary linked against libbusybox               [ ] Build with Large File Support (for accessing files > 2 GB)          installation option-->    [*] Don't use /usr                                                             Applets links (as soft-links) --->                                         (./_install) BusyBox installation prefix   Busybox Library Tuning --->                                MD5: Trade Bytes for Speed                                       [*] Faster /proc scanning code (+100 bytes)                             [*] Support for /etc/networks                                      [*] Support for /etc/networks[*]   Additional editing keys [*]   vi-style line editing commands [*]   History saving [*]   Tab completion [*]   Username completion [*]   Fancy shell prompts  Linux Module Utilities ---> [*] Support version 2.6.x Linux kernels      [*] insmod       [*]   Enable load map (-m) option       [*]     Symbols in load map     [*] rmmod       [*] lsmod     [*]   lsmod pretty output for 2.6.x Linux kernels       [*] modprobe     [ ]   Multiple options parsing     [ ]   Fancy alias parsing     ---   Options common to multiple modutils    [ ] Support tainted module checking with new kernels    [ ] Support version 2.2.x to 2.4.x Linux kernels     [*] Support version 2.6.x Linux kernels  其他的用預設值 4.編譯busybox[kevin@localhost busybox-1.9.2]# make install在busybox/_install 目錄下會產生我們需要的檔案。5.       修改_install/bin/busybox的屬性。為4755       chmod 4755 ./_install/bin/busybox       必須要要修改屬性,否則在busybox中很多命令會受限制,比如:$ susu: must be suid to work properly 6.建立root fs的檔案系統所需的目錄和檔案。       Mkdir /nfsroot       Mkdir /nfsroot/s3c2440       在root檔案夾中建立基本的目錄[root@centos s3c2440]# lsbin   dev home linuxrc proc sbin tmp varboot etc lib   mnt      root sys   usr  6.       以root身份建立節點檔案/dev/console, /dev/null mknod -m 600 dev/console c 5 1 mknod -m 666 dev/null c 1 3 7. 建立設定檔如下:  [root@centos etc]# more profile #!/bin/sh#/etc/profile:system-wide .profile file for the Bourne shells echoecho -n "Processing /etc/profile......" # Set search library pathexport LD_LIBRARY_PATH=/lib:/usr/lib # set user pathexport PATH=/bin:/sbin:/usr/bin:/usr/sbin #Set PS1USER = "`id -un`"LOGNAME=$USERPS1='[/u@/h/W]/$'PATH=$PATH echo "Done!" [root@centos etc]# more init.d/rcS #!/bin/sh # set hostname, needed host file in /etc directory#./etc/hosthostname `cat /etc/host` # mount all filesystem defined in "fstab"echo "#mount all......."/bin/mount -a #+yangdk/bin/chmod 0666 /dev/null echo "# starting mdev...."/bin/echo /sbin/mdev > /proc/sys/kernel/hotplugmdev -s /usr/etc/init echo "******************************************"echo " yangdk linux-2.6.24.4 boot              "echo " 2008-5-9               "echo "                         "echo "******************************************" [root@centos etc]# more fstab     host       inittab    passwd     shadow     group      init.d/    mdev.conf profile    [root@centos etc]# more fstab proc    /proc   proc defaults 0 0none    /tmp    ramfs   defaults 0 0none    /var    ramfs   defaults 0 0mdev    /dev    ramfs   defaults 0 0sysfs   /sys    sysfs   defaults 0 0 [root@centos etc]# more inittab ::sysinit:/etc/init.d/rcS::respawn:-/bin/sh tty2::askfirst:-/bin/sh ::ctrlaltdel:/bin/umount -a -r ::shutdown:/bin umount -a -r::shutdown:/sbin/swapoff -a  [root@centos etc]# more ../usr/etc/init #!/bin/shifconfig eth0 192.168.1.111 upifconfig lo 127.0.0.1  8.建立檔案/etc/mdev.conf,內容為空白[root@centos etc]# vi mdev.conf 9.複製主機/etc/下面的檔案passwd, group, shadow檔案到/etc[root@centos etc]# cp /etc/group .[root@centos etc]# cp /etc/passwd .[root@centos etc]# cp /etc/shadow .ok,所需要的檔案都已經建立ok了[root@centos etc]# lsfstab group host init.d inittab mdev.conf passwd profile shadow 10.複製剛剛編譯的busybox到/root目錄下[root@centos _install]# sudo cp -Rfv * /nfsroot/s3c2440 11.因為是編譯的時候使用的是動態連結。所以先看看/busybox/_install/bin/busybox使用了哪些lib,然後從glibc複製相應的lib到/nfsroot/s3c2440/lib中。[root@centos bin]# /usr/local/arm/3.4.1/arm-linux-gnu-readelf -d busybox  Dynamic section at offset 0xb8014 contains 22 entries: Tag        Type                         Name/Value 0x00000001 (NEEDED)                     Shared library:[libcrypt.so.1] 0x00000001 (NEEDED)                     Shared library: [libm.so.6] 0x00000001 (NEEDED)                     Shared library: [libc.so.6] 0x0000000c (INIT)                       0xc04c 0x0000000d (FINI)                       0xa26f0 0x00000004 (HASH)                       0x80e8 0x00000005 (STRTAB)                     0xa384 0x00000006 (SYMTAB)                     0x8b24………………複製lib 檔案到lib目錄下:[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/ld* .[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libc-2.3.2.so .[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libc.so.6 .[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libm * .[root@centos lib]cp /usr/local/arm/3.4.1/arm-linux/lib/libcrypt* .  12.使用工具mkcramfs將整個s3c2440檔案夾製作成檔案系統[root@centos nfsroot]# mkcramfs s3c2440 fs_2.6.24.4_busybox.cramfs -e 2.6.24.4下載並燒錄到nandflash中。啟動…  Read chip id = ec76Nand flash status = c0Set boot params = root=/dev/mtdblock2 init=/linuxrc load_ramdisk=0 console=ttySAC1,115200 mem=65536K devfs=mount Load Kernel...Linux version 2.6.24.4 (root@centos) (gcc version 3.4.1) #49 Wed May 7 18:57:08 CST 2008CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177Machine: SMDK2410ATAG_INITRD is deprecated; please update your bootloader.Memory policy: ECC disabled, Data cache writebackCPU S3C2440A (id 0x32440001)S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHzS3C24XX Clocks, (c) 2004 Simtec ElectronicsCLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL onCPU0: D VIVT write-back cacheCPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsCPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsBuilt 1 zonelists in Zone order, mobility grouping on. Total pages: 16256Kernel command line: root=/dev/mtdblock2 init=/linuxrc load_ramdisk=0 console=ttySAC1,115200 mem=65536K devfs=mount irq: clearing pending ext status 0005f600irq: clearing subpending status 0000009airq: clearing subpending status 00000092PID hash table entries: 256 (order: 8, 1024 bytes)timer tcon=00590000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8Console: colour dummy device 80x30console [ttySAC1] enabledDentry cache hash table entries: 8192 (order: 3, 32768 bytes)Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)Memory: 64MB = 64MB totalMemory: 61628KB available (2824K code, 299K data, 120K init)Mount-cache hash table entries: 512CPU: Testing write buffer coherency: oknet_namespace: 64 bytesNET: Registered protocol family 16S3C2410 Power Management, (c) 2004 Simtec ElectronicsS3C2440: Initialising architectureS3C2440: IRQ SupportS3C2440: Clock Support, DVS offS3C24XX DMA Driver, (c) 2003-2004,2006 Simtec ElectronicsDMA channel 0 at c4800000, irq 33DMA channel 1 at c4800040, irq 34DMA channel 2 at c4800080, irq 35DMA channel 3 at c48000c0, irq 36usbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: registered new device driver usbNET: Registered protocol family 2IP route cache hash table entries: 1024 (order: 0, 4096 bytes)TCP established hash table entries: 2048 (order: 2, 16384 bytes)TCP bind hash table entries: 2048 (order: 1, 8192 bytes)TCP: Hash tables configured (established 2048 bind 2048)TCP reno registeredNetWinder Floating Point Emulator V0.97 (double precision)JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.io scheduler noop registeredio scheduler anticipatory registered (default)io scheduler deadline registeredio scheduler cfq registereds3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attachs3c2410-lcd: probe of s3c2410-lcd failed with error -22lp: driver loaded but no devices foundppdev: user-space parallel port driverSerial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enableds3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksizeloop: module loadedCirrus Logic CS8900A driver for Linux (Modified for SMDK2410)+yangdk-->debug:PP_IntNum: 21844+yangdk-->debug2:PP_IntNum: 21840eth0: CS8900A rev E at 0xe0000300 irq=53, addr: 00: 0:3E:26:0A: 0Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xxS3C24XX NAND Driver, (c) 2004 Simtec Electronicss3c2440-nand s3c2440-nand: Tacls=1, 10ns Twrph0=4 40ns, Twrph1=1 10nsNAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)NAND_ECC_NONE selected by board driver. This is not recommended !!Scanning device for bad blocksCreating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":0x00000000-0x00030000 : "Bootloader"0x00030000-0x00200000 : "Linux kernel"0x00200000-0x02000000 : "Linux rootfs"0x02000000-0x04000000 : "User"usbmon: debugfs is not availables3c2410-ohci s3c2410-ohci: S3C24XX OHCIs3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000usb usb1: configuration #1 chosen from 1 choicehub 1-0:1.0: USB hub foundhub 1-0:1.0: 2 ports detectedmice: PS/2 mouse device common for all mices3c2440-i2c s3c2440-i2c: slave address 0x10s3c2440-i2c s3c2440-i2c: bus frequency set to 390 KHzs3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapterS3C2410 Watchdog Timer, (c) 2004 Simtec Electronicss3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabledTCP cubic registeredNET: Registered protocol family 1RPC: Registered udp transport module.RPC: Registered tcp transport module.VFS: Mounted root (cramfs filesystem) readonly.Freeing init memory: 120K init started: BusyBox v1.9.2 (2008-04-16 00:31:28 CST) starting pid 766, tty '': '/etc/init.d/rcS'#mount all.......chmod: /dev/null: No such file or directory# starting mdev....+yangdk--->debug:request_irq successful******************************************       yangdk linux-2.6.24.4 boot                  2008-5-9                                                                ****************************************** starting pid 776, tty '': '/bin/sh' Processing /etc/profile......-/bin/sh: USER: not foundDone![root@yangdk/]#

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.