【原创】linux 系统移植日志----linux系统定制

来源:互联网 发布:幼儿园手指算法 编辑:程序博客网 时间:2024/05/21 21:38

【原创】linux 系统移植日志—-linux系统定制

Author: chad
Mail: linczone@163.com

目标:
裁剪、配置一个自己的linux系统,暂时支持jffs2文件系统;熟悉linux裁剪、配置以及各个选项的意义。

DATE:2011-9-15

第一次定制linux系统出现一下问题:

U-Boot 2009.11-rc2 (May 28 2010 - 19:14:42)DRAM:  64 MBNAND:  128 MiBIn:    serialOut:   serialErr:   serialNet:   macb0macb0: Starting autonegotiation...macb0: Autonegotiation completemacb0: link up, 100Mbps full-duplex (lpa: 0x45e1)Hit any key to stop autoboot:  0NAND read: device 0 offset 0xa0000, size 0x2000002097152 bytes read: OK## Booting kernel from Legacy Image at 22000000 ...   Image Name:   Linux-2.6.30linchaomake   Image Type:   ARM Linux Kernel Image (uncompressed)   Data Size:    1641456 Bytes =  1.6 MB   Load Address: 20008000   Entry Point:  20008000   Verifying Checksum ... OK   Loading Kernel Image ... OKOKStarting kernel ...Uncompressing Linux........................................................................................................ done, booting the kernel.[    0.000000] Linux version 2.6.30linchaomake (root@ubuntu-laptop) (gcc version 4.0.0 (DENX ELDK 4.1 4.0.0)) #1 Wed Sep 14 18:26:12 CST 2011[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177[    0.000000] CPU: VIVT data cache, VIVT instruction cache[    0.000000] Machine: Atmel AT91SAM9260-EK[    0.000000] Memory policy: ECC disabled, Data cache writeback[    0.000000] Clocks: CPU 198 MHz, master 99 MHz, main 18.432 MHz[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256[    0.000000] Kernel command line: root=/dev/mtdblock0 rw rootfstype=jffs2[    0.000000] Experimental hierarchical RCU implementation.[    0.000000] Experimental hierarchical RCU init done.[    0.000000] NR_IRQS:192[    0.000000] AT91: 96 gpio irqs in 3 banks[    0.000000] PID hash table entries: 256 (order: 8, 1024 bytes)[    0.000000] Console: colour dummy device 80x30[    0.000000] console [tty0] enabled[    0.000000] console [ttyAT0] enabled[    0.170000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)[    0.190000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)[    0.210000] Memory: 64MB = 64MB total[    0.220000] Memory: 61316KB available (2928K code, 502K data, 120K init, 0K highmem)[    0.240000] SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1[    0.250000] Calibrating delay loop... 98.71 BogoMIPS (lpj=493568)[    0.460000] Mount-cache hash table entries: 512[    0.470000] CPU: Testing write buffer coherency: ok[    0.490000] net_namespace: 300 bytes[    0.500000] NET: Registered protocol family 16[    0.510000] AT91: Power Management[    0.520000] AT91: Starting after software reset[    0.540000] bio: create slab <bio-0> at 0[    0.550000] SCSI subsystem initialized[    0.560000] usbcore: registered new interface driver usbfs[    0.580000] usbcore: registered new interface driver hub[    0.590000] usbcore: registered new device driver usb[    0.600000] NET: Registered protocol family 2[    0.610000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)[    0.630000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)[    0.650000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)[    0.660000] TCP: Hash tables configured (established 2048 bind 2048)[    0.670000] TCP reno registered[    0.680000] NET: Registered protocol family 1[    0.750000] msgmni has been set to 119[    0.760000] alg: No test for stdrng (krng)[    0.760000] io scheduler noop registered[    0.770000] io scheduler anticipatory registered[    0.780000] io scheduler deadline registered[    0.790000] io scheduler cfq registered (default)[    0.840000] atmel_usart.0: ttyAT0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL[    0.850000] atmel_usart.2: ttyAT2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIAL[    0.870000] Driver 'sd' needs updating - please use bus_type methods[    0.880000] Driver 'sr' needs updating - please use bus_type methods[    0.910000] Fixed MDIO Bus: probed[    0.920000] PPP generic driver version 2.4.2[    0.920000] dm9000 Ethernet Driver, V1.31[    0.960000] MACB_mii_bus: probed[    0.970000] eth0: Atmel MACB at 0xfffc4000 irq 21 (08:00:3e:26:1a:5b)[    0.980000] eth0: attached PHY driver [Davicom DM9161A] (mii_bus:phy_addr=ffffffff:00, irq=-1)[    1.000000] mice: PS/2 mouse device common for all mice[    1.010000] i2c /dev entries driver[    1.020000] cpuidle: using governor ladder[    1.030000] cpuidle: using governor menu[    1.040000] TCP cubic registered[    1.050000] NET: Registered protocol family 17[    1.060000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)[    1.070000] VFS: Cannot open root device "mtdblock0" or unknown-block(0,0)[    1.090000] Please append a correct "root=" boot option; here are the available partitions:[    1.110000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)[    1.120000] Backtrace:[    1.130000] [<c002a88c>] (dump_backtrace+0x0/0x138) from [<c002aa00>] (dump_stack+0x1c/0x20)[    1.140000]  r6:c380a000 r5:c032f304 r4:c380a000[    1.150000] [<c002a9e4>] (dump_stack+0x0/0x20) from [<c00373fc>] (panic+0x50/0x134)[    1.170000] [<c00373ac>] (panic+0x0/0x134) from [<c0008d68>] (mount_block_root+0x104/0x2c8)[    1.190000]  r3:00000000 r2:00000000 r1:c381df5c r0:c02b9c08[    1.200000]  r6:c380a000 r5:c0021890 r4:c380a000[    1.210000] [<c0008c64>] (mount_block_root+0x0/0x2c8) from [<c0008f88>] (mount_root+0x5c/0x6c)[    1.220000] [<c0008f2c>] (mount_root+0x0/0x6c) from [<c00090d8>] (prepare_namespace+0x140/0x198)[    1.240000]  r5:c00218d8 r4:c032f084[    1.250000] [<c0008f98>] (prepare_namespace+0x0/0x198) from [<c0008adc>] (kernel_init+0xc0/0xec)[    1.270000]  r5:c001fc74 r4:c032f078[    1.270000] [<c0008a1c>] (kernel_init+0x0/0xec) from [<c0039964>] (do_exit+0x0/0x68c)[    1.290000]  r6:00000000 r5:00000000 r4:00000000

首先,我不确定是不是linux内核文件有问题,所以,我先使用威步的配置文件编译了内核,并将编译好的内核烧写开发板,然后使用我自己配置的文件系统,最终系统正常运行,这说明linux内核文件是不缺东西的,那么,出错就在我的配置文件了。
然后,我对比微步的配置文件,感觉最有可能是因为没有配置jffs2文件系统所致,然后,重新执行:

make menuconfig

但是在 -> Filesystems -> Miscellaneous filesystems 下始终没有找到有Journalling Flash File System v2 (JFFS2) support (JFFS2_FS ) 的踪影,查看fs/Kconfig 文件,jffs2 选择也是正确在里面的 source “fs/jffs2/Kconfig”,并且文件也是正确的,jffs2文件夹也有,里面的内容也正确, 在menuconfig里面使用命令’/’进行搜索,查到的结果如下:

-> File systems     -> Miscellaneous filesystems            -> Advanced compression options for JFFS2 (JFFS2_COMPRESSION_OPTIO         -> JFFS2 default compression mode (<choice> [=y])

明明JFFS2存在,为什么配置项里没有呢?!修改fs目录下的Kconfig还是毫无作用,后来,突然想到jffs2目录下的Kconfig文件,以前只是粗略看了看jffs2文件下的kconfig文件没有错误,却没有认真研究kconfig文件的内容,会不会是这个文件里面有什么秘密呢?说干就干,打开

fs/jffs2/Kconfig

突然,一行信息映入我的眼帘,神啊,原来如此!!!!!

原来,我一直没有在意“depends on MTD”,然后我迅速切换到:

-> Device Drivers           -> Memory Technology Device (MTD) support

原来我根据配置指南,将MTD选项去掉了,现在看来jffs2 文件系统必须要MTD 的支持!我马上又参考配置指南对MTD进行了配置,然后再切换到
Filesystems -> Miscellaneous filesystems 亲切的Journalling Flash File System v2 (JFFS2) support终于出现了,对该项进行配置,编译内核,下载内核,下载文件系统,重启。启动信息出来了,对了,对了,出现:

rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clockVFS: Mounted root (jffs2 filesystem) on device 31:0.Freeing init memory: 124K

系统停止了,但是已经成功了99%,慢慢等待。。。。。终于,久违的shell出现了,成功了!!!

U-Boot 2009.11-rc2 (May 28 2010 - 19:14:42)DRAM:  64 MBNAND:  128 MiBIn:    serialOut:   serialErr:   serialNet:   macb0macb0: Starting autonegotiation...macb0: Autonegotiation completemacb0: link up, 100Mbps full-duplex (lpa: 0x45e1)Hit any key to stop autoboot:  0NAND read: device 0 offset 0xa0000, size 0x2000002097152 bytes read: OK## Booting kernel from Legacy Image at 22000000 ...   Image Name:   Linux-2.6.30   Image Type:   ARM Linux Kernel Image (uncompressed)   Data Size:    1492648 Bytes =  1.4 MB   Load Address: 20008000   Entry Point:  20008000   Verifying Checksum ... OK   Loading Kernel Image ... OKOKStarting kernel ...Uncompressing Linux................................................................................................ done, booting the kernel.Linux version 2.6.30 (root@ubuntu-laptop) (gcc version 4.0.0 (DENX ELDK 4.1 4.0.0)) #2 Thu Sep 15 08:25:15 CST 2011CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177CPU: VIVT data cache, VIVT instruction cacheMachine: Atmel AT91SAM9260-EKMemory policy: ECC disabled, Data cache writebackClocks: CPU 198 MHz, master 99 MHz, main 18.432 MHzBuilt 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256Kernel command line: root=/dev/mtdblock0 rw rootfstype=jffs2NR_IRQS:192AT91: 96 gpio irqs in 3 banksPID hash table entries: 256 (order: 8, 1024 bytes)Console: colour dummy device 80x30console [tty0] enabledconsole [ttyS0] enabledDentry cache hash table entries: 8192 (order: 3, 32768 bytes)Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)Memory: 64MB = 64MB totalMemory: 61772KB available (2732K code, 234K data, 124K init, 0K highmem)Calibrating delay loop... 98.91 BogoMIPS (lpj=494592)Mount-cache hash table entries: 512CPU: Testing write buffer coherency: oknet_namespace: 296 bytesNET: Registered protocol family 16bio: create slab <bio-0> at 0SCSI subsystem initializedusbcore: 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 registeredNET: Registered protocol family 1NetWinder Floating Point Emulator V0.97 (double precision)JFFS2 version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.msgmni has been set to 120io scheduler noop registeredio scheduler anticipatory registered (default)atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIALatmel_usart.2: ttyS2 at MMIO 0xfffb4000 (irq = 7) is a ATMEL_SERIALbrd: module loadedssc ssc.0: Atmel SSC device at 0xc4870000 (irq 14)Driver 'sd' needs updating - please use bus_type methodsMACB_mii_bus: probedeth0: Atmel MACB at 0xfffc4000 irq 21 (08:00:3e:26:1a:5b)eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:00, irq=-1)NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)AT91 NAND: 8-bit, Software ECCScanning device for bad blocksBad eraseblock 60 at 0x000000780000Bad eraseblock 134 at 0x0000010c0000Bad eraseblock 145 at 0x000001220000Bad eraseblock 166 at 0x0000014c0000Bad eraseblock 293 at 0x0000024a0000Bad eraseblock 330 at 0x000002940000Bad eraseblock 488 at 0x000003d00000Bad eraseblock 500 at 0x000003e80000Bad eraseblock 604 at 0x000004b80000Bad eraseblock 881 at 0x000006e20000Creating 1 MTD partitions on "atmel_nand":0x000000400000-0x000008000000 : "rootfs"usbmon: debugfs is not availableohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driverat91_ohci at91_ohci: AT91 OHCIat91_ohci at91_ohci: new USB bus registered, assigned bus number 1at91_ohci at91_ohci: irq 20, io mem 0x00500000usb usb1: configuration #1 chosen from 1 choicehub 1-0:1.0: USB hub foundhub 1-0:1.0: 2 ports detectedInitializing USB Mass Storage driver...usbcore: registered new interface driver usb-storageUSB Mass Storage support registered.udc: at91_udc version 3 May 2006mice: PS/2 mouse device common for all micertc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0IRQ 1/rtc0: IRQF_DISABLED is not guaranteed on shared IRQsrtc-at91sam9 at91_rtt.0: rtc0: SET TIME!i2c /dev entries driverAT91SAM9 Watchdog: sorry, watchdog is disabledat91_wdt: probe of at91_wdt failed with error -5Advanced Linux Sound Architecture Driver Version 1.0.20.ALSA device list:  No soundcards found.TCP cubic registeredNET: Registered protocol family 17RPC: Registered udp transport module.RPC: Registered tcp transport module.rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clockVFS: Mounted root (jffs2 filesystem) on device 31:0.Freeing init memory: 124K[@LinChao:/]#

下一步目标:
1> 进一步理解各个linux配置项的作用,以及整个配置过程。
2> 移植yaffs2 文件系统

0 0
原创粉丝点击