最近在学习内核设备树,打算在2440上面移植dts,期间发现网上关于u-boot如何加载dts描述比较少,做个笔记。
优先要在对应板卡配置文件里面定义:
#define CONFIG_OF_LIBFDT
重新编译u-boot即可让u-boot支持内核设备树dts,加载命令如下:
bootm + uImage地址 + ramdisk地址 + 设备树镜像地址
实例:
U-Boot 2016.03 (Mar 05 2018 - 14:56:38 +0800)
DRAM: 64 MiB
Flash: 0 Bytes
NAND: 256 MiB
Net: dm9000
Hit any key to stop autoboot: 0
SMDK2440 #
SMDK2440 #
SMDK2440 # tftp 0x30007FC0 uImage
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:c0:de:00:00:01
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.6.140; our IP address is 192.168.6.155
Filename 'uImage'.
Load address: 0x30007fc0
Loading: #################################################################
#################################################################
#################################################################
############################################
463.9 KiB/s
done
Bytes transferred = 3502968 (357378 hex)
SMDK2440 # tftp 0x30001000 s3c2440-smdk2440.dtb
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:c0:de:00:00:01
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.6.140; our IP address is 192.168.6.155
Filename 's3c2440-smdk2440.dtb'.
Load address: 0x30001000
Loading: #
1000 Bytes/s
done
Bytes transferred = 7879 (1ec7 hex)
SMDK2440 # bootm 0x30007FC0 - 0x30001000 (- 表示不使用ramdisk加载,如果使用ramdisk则提供其加载地址)
## Booting kernel from Legacy Image at 30007fc0 ...
Image Name: Linux-4.13.9
Created: 2018-03-02 6:25:06 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3502904 Bytes = 3.3 MiB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 30001000
Booting using the fdt blob at 0x30001000
XIP Kernel Image ... OK
Loading Device Tree to 33b7e000, end 33b82ec6 ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.