尚觀6410開發板移植linux 3.6.6問題記錄及經驗小結

把開發板右上角的紅色啓動選項開關,兩個都撥到下面(NAND),連接串口,已經內置了uboot 1.16。
根文件系統使用ext2的ramdisk,由於網卡無法驅動故無法使用nfs的根文件系統,網卡驅動問題待解決。

先安裝ubuntu基本開發包:
    sudo apt-getinstall build-essential bison flex automake autoconf libncurses5-dev



配置arm-linux-gcc交叉編譯環境

編譯最新的linux3.6.6內核,直接使用s3c6400_defconfig編譯通過,且基本能用(dm9000網卡無法驅動)

安裝uboot 的mkimage用於生成uImage及處理ramdisk:
    sudo apt-get install u-boot-tools

安裝ramdisk生成工具:
    sudo apt-get install genext2fs

創建rootfs文件夾,創建最基本的根文件系統結構:
    mkdir bin sbin dev etc lib proc sys usr mnt tmp var root

編譯busybox並安裝到剛纔創建的roofs目錄下去

創建rootfs/etc/init.d/rcS文件:

   #!/bin/sh
    mdev -s
   /bin/sh
    #ifconfigeth0 192.168.1.150
    #mount -a   


rootfs生成最基本的設備文件:
    mknod -m 666 console c 5 1
    mknod -m 666 null c 1 3



加載ramdisk出現can't open /dev/tty2: No such file ordirectory,解決方法:

    ln -sf /dev/null /dev/tty2
    ln -sf /dev/null /dev/tty3
    ln -sf /dev/null/dev/tty4   


genext2fs用法:
    genext2fs -b[目標ramdisk文件大小,1024的整數倍] -d [rootfs所在文件夾名] [ramdisk文件名]
   -b後接的值就是生成的ramdisk的文件大小,不要設定太大,只要比rootfs所在文件夾稍大即可

用mkimage處理ramdisk示例(若不處理,則會提示bad magic number):
 
  mkimage -n"RAMFS" -A arm -O linux -T ramdisk -C none -a 51800000 -e 51800040-d ramdisk ramdisk.img


   5180000是ramdisk在內存中的地址,51800040是偏移量,"ramdisk"是原ramdisk文件名,"ramdisk.img"是處理後的ramdisk文件名

加入busybox之後,製作的ramdisk無法啓動,提示/linuxrc無法執行,可能的解決方法之一:
   需要把交叉編譯工具鏈裏面的庫(至少要把/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/lib下面的所有文件)
      放到rootfs/lib下面,再重新打包ramdisk
   再確保有執行權限,chmod -R a+x rootfs

ramdisk不要使用gzip壓縮,無論是mkimage處理後再壓縮還是壓縮後再處理,都無法啓動.

加載根文件系統時提示:RAMDISK: image too big!解決方法:
   不需要重新編譯內核,修改uboot的bootargs,在後面加上ramdisk_size=20480,這個值不能比ramdisk的文件小
   因爲3.6.6內核默認的啓動選項是優先加載bootloader傳入的啓動參數

一個使用ramdisk的根文件系統的bootargs示例如下:
    setenv bootargs root=/dev/ram rootfstype=ext2 init=/linuxrc console=ttySAC0,115200 ramdisk_size=20480 mem=128M





下一步目標,解決dm9000網卡驅動問題,並使用NFS掛載根文件系統。







U-Boot 1.1.6 (Sep 16 2011 - 14:10:18) for SMDK6410

****************************************
**    UP-S3C6410Nand bootv0.18     **
**    ShenZhenUplooking Technology   **
**   Http://www.uplooking.com       **
****************************************

CPU:    S3C6410@532MHz
        Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNCMode)
Board:   SMDK6410
DRAM:    128MB
Flash:   0 kB
NAND:    256MB
In:     serial
Out:    serial
Err:    serial
dm9000 i/o: 0x18000300, id: 0x90000a46
MAC: 00:40:5c:26:0a:5b
operating at unknown: 15 mode
Hit any key to stop autoboot:  0
uplooking # tftp 0x50800000 zImage
dm9000 i/o: 0x18000300, id: 0x90000a46
MAC: 00:40:5c:26:0a:5b
operating at 100M full duplex mode
TFTP from server 192.168.1.103; our IP address is192.168.1.150
Filename 'zImage'.
Load address: 0x50800000
Loading:#################################################################
        #################################################################
        #################################################################
        #################################################################
        ###############################
done
Bytes transferred = 1488096 (16b4e0 hex)
uplooking # tftp 0x51800000 ramdisk.img
dm9000 i/o: 0x18000300, id: 0x90000a46
MAC: 00:40:5c:26:0a:5b
operating at 100M full duplex mode
TFTP from server 192.168.1.103; our IP address is192.168.1.150
Filename 'ramdisk.img'.
Load address: 0x51800000
Loading:#################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        #################################################################
        ########################
done
Bytes transferred = 9437248 (900040 hex)
uplooking # bootm 0x50800000 0x51800000
Boot with zImage
## Loading Ramdisk Image at 51800000 ...
   ImageName:   RAMFS
  Created:     2012-11-13  13:01:59 UTC
   ImageType:   ARM Linux RAMDisk Image(uncompressed)
   DataSize:    9437184Bytes =  9 MB
   Load Address: 51800000
   Entry Point: 51800040
   Verifying Checksum ...OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.6.6 (root@zhufeng-ThinkCentre) (gcc version 4.3.2(Sourcery G++ Lite 2008q3-72) ) #1 Tue Nov 13 15:31:35 CST 2
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7),cr=00c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasinginstruction cache
Machine: SMDK6410
Memory policy: ECC disabled, Data cache writeback
CPU S3C6410 (id 0x36410101)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
camera: no parent clock specified
S3C64XX: PLL settings, A=532000000, M=532000000, E=24000000
S3C64XX: HCLK2=266000000, HCLK=133000000, PCLK=66500000
mout_apll: source is fout_apll (1), rate is 532000000
mout_epll: source is epll (1), rate is 24000000
mout_mpll: source is mpll (1), rate is 532000000
usb-bus-host: source is clk_48m (0), rate is 48000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
irda-bus: source is mout_epll (0), rate is 24000000
camera: no parent clock specified
CPU: found DTCM0 8k @ 00000000, not enabled
CPU: moved DTCM0 8k to fffe8000, enabled
CPU: found DTCM1 8k @ 00000000, not enabled
CPU: moved DTCM1 8k to fffea000, enabled
CPU: found ITCM0 8k @ 00000000, not enabled
CPU: moved ITCM0 8k to fffe0000, enabled
CPU: found ITCM1 8k @ 00000000, not enabled
CPU: moved ITCM1 8k to fffe2000, enabled
Built 1 zonelists in Zone order, mobility groupingon.  Total pages: 32512
Kernel command line: root=/dev/ram rootfstype=ext2 init=/linuxrcconsole=ttySAC0,115200 ramdisk_size=20480 mem=128M
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 117552k/117552k available, 13520k reserved, 0Khighmem
Virtual kernel memory layout:
   vector  : 0xffff0000 -0xffff1000  (   4 kB)
   DTCM    :0xfffe8000 - 0xfffec000  (  16 kB)
   ITCM    :0xfffe0000 - 0xfffe4000  (  16 kB)
   fixmap  : 0xfff00000 -0xfffe0000   ( 896 kB)
    vmalloc :0xc8800000 - 0xff000000   ( 872MB)
   lowmem  : 0xc0000000 -0xc8000000   ( 128 MB)
    modules :0xbf000000 - 0xc0000000  (  16 MB)
     .text : 0xc0008000 - 0xc028d5bc  (2582 kB)
     .init : 0xc028e000 - 0xc02ab12c  ( 117 kB)
     .data : 0xc02ac000 - 0xc02d86c0  ( 178 kB)
      .bss : 0xc02d9024 - 0xc030a0a0  ( 197 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1,Nodes=1
NR_IRQS:246
VIC @f6000000: id 0x00041192, vendor 0x41
VIC @f6010000: id 0x00041192, vendor 0x41
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every4294967286ms
Console: colour dummy device 80x30
Calibrating delay loop... 353.89 BogoMIPS (lpj=1769472)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x501e5bb0 - 0x501e5c0c
DMA: preallocated 256 KiB pool for atomic coherentallocations
s3c64xx_dma_init: Registering DMA channels
PL080: IRQ 73, at c8846000, channels 0..8
PL080: IRQ 74, at c8848000, channels 8..16
S3C6410: Initialising architecture
bio: create slab at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c.0: slave address 0x10
s3c-i2c s3c2440-i2c.0: bus frequency set to 64 KHz
s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter
s3c-i2c s3c2440-i2c.1: slave address 0x10
s3c-i2c s3c2440-i2c.1: bus frequency set to 64 KHz
s3c-i2c s3c2440-i2c.1: i2c-1: S3C I2C adapter
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (junk in compressed archive); lookslike an initrd
Freeing initrd memory: 9216K
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
start plist test
end plist test
s3c-fb s3c-fb: window 0: fb
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is aS3C6400/10
console [ttySAC0] enabled
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is aS3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is aS3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is aS3C6400/10
brd: module loaded
loop: module loaded
at24 0-0050: 1024 byte 24c08 EEPROM, writable, 1 bytes/write
at24 1-0057: 16384 byte 24c128 EEPROM, writable, 1bytes/write
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned busnumber 1
s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000
s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
s3c2410-ohci s3c2410-ohci: can't start s3c24xx
s3c2410-ohci s3c2410-ohci: startup error -75
s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
s3c2410-ohci: probe of s3c2410-ohci failed with error -75
mousedev: PS/2 mouse device common for all mice
s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdhci s3c-sdhci.0: clock source 0: mmc_busclk.0 (133000000Hz)
s3c-sdhci s3c-sdhci.0: clock source 2: mmc_busclk.2 (24000000Hz)
mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] usingADMA
mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hz
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
VFP support v0.3: implementor 41 architecture 1 part 20 variant brev 5
s3c-rtc s3c64xx-rtc: setting system clock to 2012-11-13 21:03:42UTC (1352840622)
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 9216KiB [1 disk] into ram disk... mmc0:mmc_rescan_try_freq: trying to init card at 200000 Hz
mmc0: mmc_rescan_try_freq: trying to init card at 100000 Hz
done.
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing init memory: 116K
mdev: /sys/class: No such file or directory
/bin/sh: can't access tty; job control turned off
/ # uname -a
Linux (none) 3.6.6 #1 Tue Nov 13 15:31:35 CST 2012 armv6lGNU/Linux
/ #


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章