尚观6410开发板移植linux 3.6.6问题记录及经验小结

发布时间 2023-09-24 19:41:20作者: MaxBruce

原文:https://www.cnblogs.com/iwantcomputer/p/8489831.html

尚观6410开发板移植linux 3.6.6问题记录及经验小结

把开发板右上角的红色启动选项开关,两个都拨到下面(NAND),连接串口,已经内置了uboot 1.16。
根文件系统使用ext2的ramdisk,由于网卡无法驱动故无法使用nfs的根文件系统,网卡驱动问题待解决。

先安装ubuntu基本开发包:
    sudo apt-get install build-essential bison flex automake autoconf libncurses5-dev

配置arm-linux-gcc交叉编译环境

编译最新的linux 3.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
    #ifconfig eth0 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 or directory,解决方法:
    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-S3C6410 Nand boot v0.18     **
**    ShenZhen Uplooking Technology   **
**   Http://www.uplooking.com       **
****************************************

CPU:    S3C6410@532MHz
        Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)
Board:   SMDK6410
DRAM:    128 MB
Flash:   0 kB
NAND:    256 MB
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 is 192.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 is 192.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 ...
   Image Name:   RAMFS
  Created:     2012-11-13  13:01:59 UTC
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    9437184 Bytes =  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 nonaliasing instruction 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 grouping on.  Total pages: 32512
Kernel command line: root=/dev/ram rootfstype=ext2 init=/linuxrc console=ttySAC0,115200 ramdisk_size=20480 mem=128M
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 117552k/117552k available, 13520k reserved, 0K highmem
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   ( 872 MB)
   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 every 4294967286ms
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 coherent allocations
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); looks like 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 a S3C6400/10
console [ttySAC0] enabled
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is a S3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is a S3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is a S3C6400/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, 1 bytes/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 bus number 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 (133000000 Hz)
s3c-sdhci s3c-sdhci.0: clock source 2: mmc_busclk.2 (24000000 Hz)
mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA
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 b rev 5
s3c-rtc s3c64xx-rtc: setting system clock to 2012-11-13 21:03:42 UTC (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 armv6l GNU/Linux
/ #