1. 到kernel.org下载4.1.33,修改顶层Makefile
ARCH ?= arm
CROSS_COMPILE ?= arm-Linux-根据自己的环境修改交叉编译器前缀
如果发现:/tmp/cc8nFJm8.s:549: Error: garbage following instruction -- `dsb nshst', 则到linaro.org下载新版本的编译器,我使用的版本为5.3.1
2. make s5pv210_defconfig; make menuconfig; make; make LOADADDR=0x20008000 uImage
(s5pv210_defconfig在arch/arm/configs下, LOADADDR为uImage自解压后搬运内核到此处)
3. make dtbs; cp arch/arm/boot/dts/s5pv210-smkdv210.dtb到tftp目录
4. tftp 40000000 uImage; tftp 50000000 s5pv210-smdkv210.dtb; fdt addr 5000000; bootm 40000000 - 50000000
只打印了如下所示就不打印了:
SMDKC100 # bootm 40000000 - 50000000## Current stack ends at 0x5fe4adc8 * kernel: cmdline image address = 0x40000000## Booting kernel from Legacy Image at 40000000 ... Image Name: Linux-4.1.33-g8db86c6-dirty Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1925344 Bytes = 1.8 MiB Load Address: 20008000 Entry Point: 20008000 Verifying Checksum ... OK kernel data at 0x40000040, len = 0x001d60e0 (1925344)## Skipping init Ramdisk## No init Ramdisk ramdisk start = 0x00000000, ramdisk end = 0x00000000* fdt: cmdline image address = 0x50000000## Checking for 'FDT'/'FDT Image' at 50000000* fdt: raw FDT blob## Flattened Device Tree blob at 50000000 Booting using the fdt blob at 0x50000000 of_flat_tree at 0x50000000 size 0x0000650e Loading Kernel Image ... OKOK kernel loaded at 0x20008000, end = 0x201de0e0using: FDTusing: FDT## initrd_high = 0xffffffff, copy_to_ram = 1 ramdisk load start = 0x00000000, ramdisk load end = 0x00000000## device tree at 50000000 ... 5000650d (len=38158 [0x950E]) Loading Device Tree to 3fff6000, end 3ffff50d ... OKNo alias for ethernet0## Transferring control to Linux (at address 20008000)...
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
仔细研究发现这个linux中的代码居然没有测试,注释中写到根据3.15中代码改写过来的,我将3.16代码下载下来,发现3.16中没有DTS化的代码,看来这个4.1.33中的代码是写了后肯定没有测试了,所以跑步起来也正常了。。。。。。
2016.10.2
使用early_print打印发现setup_arch中的cmd_line居然是uboot中set args的值,不是dtb中的值....为何如此?
经验证发现是在uboot/arch/arm/lib/bootm.c的create_fd中将bootargs进行了替换,这样可以使用设置变量的方法来改变传入的dtb的内容!!!!但是为何kernel跑不起来???
添加打印发现是卡在了init/calibrate.c中的calibrate_delay_converge函数的recalibrate,不停的在recalibrate,注释掉便可以向下跑:
Uncompressing Linux... done, booting the kernel.
ryz first 3fff6000
ryzMachine model: YIC System SMDKV210 based on S5PV210
search "chosen", depth: 0, uname:
search "chosen", depth: 1, uname: chosen
12ryzconsole=ttySAC0,115200n8 noinitrd init=/init root=/dev/nfs nfsroot=192.168.1.199:/opt/EmbedSky/TQ210/rootfs_linux_v1.4_CoreB ip=192.168.1n
ryzSamsung S5PC110/S5PV210-based board
ryzconsole=ttySAC0,115200n8 noinitrd init=/init root=/dev/nfs nfsroot=192.168.1.199:/opt/EmbedSky/TQ210/rootfs_linux_v1.4_CoreB ip=192.168.1.6n
ryz unflatten_device
s3c24xx_serial_console_setup: co=80394998 (0), 115200n8
ryz console_init
ryz console_init2.0
ryz console_init2.1
ryz console_init2.2
ryz console_init2.2.1
ryz console_init2.2.2
ryz console_init2.2.3
ryz console_init2.2.4
ryz console_init2.2.5
ryz console_init2.2.6
ryz console_init287
ryz console_init314
ryz console_delay195
ryz console_delay200
ryz console_delay215
ryz console_delay221
ryz console_delay241
ryz console_delay253
ryz console_init319
ryz console_init329
ryz console_init331
ryz console_init2.2.7
ryz console_init2.3
ryz console_init3.1
ryz console_init3.2
ryz console_init3
s3c24xx_serial_probe(bf0e3800) 0
s3c24xx_serial_probe: initialising port 803949d0...
s3c24xx_serial_init_port: port=80394a00, platdev=bf0e3800
resource [mem 0xe2900000-0xe29003ff])
port: map=0xe2900000, mem=f7000000, irq=58 (58,59), clock=1
s3c24xx_serial_probe: adding port
s3c24xx_serial_console_setup: co=80394998 (0), 115200n8
s3c24xx_serial_console_setup: port=80394a00 (0)
s3c24xx_serial_console_setup: baud 115200
Booting Linux on physical CPU 0x0
Linux version 4.1.33-g8db86c6-dirty (yazhou@yazhou-ubuntu) (gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05) ) #22 PREEMPT Tue Oct 4 16:57:6
CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: YIC System SMDKV210 based on S5PV210
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260096
Kernel command line: console=ttySAC0,115200n8 noinitrd init=/init root=/dev/nfs nfsroot=192.168.1.199:/opt/EmbedSky/TQ210/rootfs_linux_v1.4_Con
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1035464K/1048576K available (2598K kernel code, 102K rwdata, 816K rodata, 152K init, 227K bss, 13112K reserved, 0K cma-reserved)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xc0800000 - 0xff000000 (1000 MB)
lowmem : 0x80000000 - 0xc0000000 (1024 MB)
modules : 0x7f000000 - 0x80000000 ( 16 MB)
.text : 0x80008000 - 0x8035de28 (3416 kB)
.init : 0x8035e000 - 0x80384000 ( 152 kB)
.data : 0x80384000 - 0x8039dbc0 ( 103 kB)
.bss : 0x8039dbc0 - 0x803d68e0 ( 228 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
Additional per-CPU info printed with stalls.
NR_IRQS:16 nr_irqs:16 16
VIC @c0800000: id 0x00041192, vendor 0x41
VIC @c0802000: id 0x00041192, vendor 0x41
VIC @c0804000: id 0x00041192, vendor 0x41
VIC @c0806000: id 0x00041192, vendor 0x41
S5PV210 clocks: mout_apll = 0, mout_mpll = 0
mout_epll = 0, mout_vpll = 0
Division by zero in kernel.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at kernel/time/clockevents.c:44 cev_delta2ns+0x104/0x118()
---[ end trace cb88537fdc8fa200 ]---
Division by zero in kernel.
Division by zero in kernel.
sched_clock: 32 bits at 0 Hz, resolution 0ns, wraps every 0ns
Division by zero in kernel.
clocksource samsung_clocksource_timer: mask: 0xffffffff max_cycles: 0x0, max_idle_ns: 0 ns
Console: colour dummy device 80x30
ryz console init2
Calibrating delay loop... ryz console_delay195
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x20008240 - 0x20008298
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302231375000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
SCSI subsystem initialized
Division by zero in kernel.
Switched to clocksource samsung_clocksource_timer
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 5, 163840 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
UDP hash table entries: 512 (order: 2, 24576 bytes)
UDP-Lite hash table entries: 512 (order: 2, 24576 bytes)
futex hash table entries: 256 (order: 0, 7168 bytes)
romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
e2900000.serial: ttySAC0 at MMIO 0xe2900000 (irq = 58, base_baud = 0) is a S3C6400/10
console [ttySAC0] enabled
s3c24xx_serial_probe(bf0e3a00) 1
s3c24xx_serial_probe: initialising port 80394b10...
s3c24xx_serial_init_port: port=80394b40, platdev=bf0e3a00
resource [mem 0xe2900400-0xe29007ff])
port: map=0xe2900400, mem=f7000400, irq=59 (59,60), clock=1
s3c24xx_serial_probe: adding port
e2900400.serial: ttySAC1 at MMIO 0xe2900400 (irq = 59, base_baud = 0) is a S3C6400/10
s3c24xx_serial_probe(bf0e3c00) 2
s3c24xx_serial_probe: initialising port 80394c50...
s3c24xx_serial_init_port: port=80394c80, platdev=bf0e3c00
resource [mem 0xe2900800-0xe2900bff])
port: map=0xe2900800, mem=f7000800, irq=60 (60,61), clock=1
s3c24xx_serial_probe: adding port
e2900800.serial: ttySAC2 at MMIO 0xe2900800 (irq = 60, base_baud = 0) is a S3C6400/10
s3c24xx_serial_probe(bf0e3e00) 3
s3c24xx_serial_probe: initialising port 80394d90...
s3c24xx_serial_init_port: port=80394dc0, platdev=bf0e3e00
resource [mem 0xe2900c00-0xe2900fff])
port: map=0xe2900c00, mem=f7000c00, irq=61 (61,62), clock=1
s3c24xx_serial_probe: adding port
e2900c00.serial: ttySAC3 at MMIO 0xe2900c00 (irq = 61, base_baud = 0) is a S3C6400/10
brd: module loaded
loop: module loaded
mousedev: PS/2 mouse device common for all mice
ryz do_basic_setup
ryzxx do_basic_setup
s3c64xx_serial_startup: port=80394a00 (e2900000,f7000000)
s3c64xx_serial_startup ok
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.1.33-g8db86c6-dirty #22
Hardware name: Samsung S5PC110/S5PV210-based board
[<80013ff4>] (unwind_backtrace) from [<80011fa0>] (show_stack+0x10/0x14)
[<80011fa0>] (show_stack) from [<80277390>] (panic+0xa0/0x1f8)
[<80277390>] (panic) from [<8035f2b0>] (mount_block_root+0x238/0x2c8)
[<8035f2b0>] (mount_block_root) from [<8035f60c>] (prepare_namespace+0x17c/0x1b4)
[<8035f60c>] (prepare_namespace) from [<8035eed0>] (kernel_init_freeable+0x1b4/0x1c4)
[<8035eed0>] (kernel_init_freeable) from [<80276bac>] (kernel_init+0xc/0xe0)
[<80276bac>] (kernel_init) from [<8000f488>] (ret_from_fork+0x14/0x2c)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
random: nonblocking pool is initialized
什么原因呢?好像是clk设置不正确!!!
2016.10.11 仔细的研究clocksource,timer_event_device代码和三星的pll与pwm timer结构,慢慢分析
2016.10.16 这几天又认真的分析了clk驱动,最后确定是dts文件中没有设置xxti的时钟频率造成的,添加xxti频率配置在xusbti平级:
&xxti {
clock-frequency = <24000000>;
};
这样就可以看到kernel正常加载各种驱动的信息了,但是文件系统给没有加载成功,下面进一步的调试!