For the last few days, I have been working on build new image for a new platform at work. I found out it is useful to able to boot manually with kernel, dtb, initramfs from u-boot. By doing this, if the thing doesn’t work, we can change any one of them to identify which one has issue.
First you need prepare kernel image as “Image” format, device tree blob (dtb file), and initramfs.
If you have initramfs file in cpio.gz format, you need do following:
#since it is for u-boot to use, it has to be converted to add a header in front
mkimage -A arm64 -T ramdisk -C gzip -n "Sparrow Ramdisk Image" -d initramfs.cpio.gz initramfs.cpio.gz.uRamdisk
When all three images are ready, and loaded them into SD card,
#check what files are in SD card partition#1
Marvell>> fatls mmc 0:1
14472704 image-armv8le-a70x0-a80x0-ga-17.02.2
25563 armada-7040-db-a-armv8le-a70x0-a80x0-ga-17.02.2.dtb
94229849 initramfs.igz
304035328 initramfs.cpio
407653 ramdisk.img.gz
97505226 uramdisk
21008 armada-7040-tsn-h-sgmii.dtb.cisco
12466176 image-4.4.27-a7040-16.07.8.cisco
3815722 initramfs.arm64.ir909.ramfs.cpio.gz
3815786 initramfs.arm64.ir909.filesystem
4758592 u_rootfs-buildroot-2015.11-16.08.0.ext2
1794156 uramdisk-armv8-tiny-le
3866681 initramfs.arm64.uramdisk
3815786 initramfs.arm64.ramfs.cpio.gz.uramdisk
13428224 image.new
12651270 initramfs.arm64.ir909.ramfs.new.cpio.gz
12651334 initramfs.arm64.ir909.ramfs.new.cpio.gz.uramdisk
25740 devicetree-image-armada-7040-db-a.new.dtb
18 file( s) , 0 dir ( s)
# load dtb file
Marvell>> fatload mmc 0:1 $fdt_addr devicetree-image-armada-7040-db-a.new.dtb
reading devicetree-image-armada-7040-db-a.new.dtb
25740 bytes read in 40 ms ( 627.9 KiB/s)
#load image file
Marvell>> fatload mmc 0:1 $kernel_addr image.new
reading image.new
13428224 bytes read in 2736 ms ( 4.7 MiB/s)
Marvell>> setenv ramfs_addr 0x12000000
Marvell>> fatload mmc 0:1 $ramfs_addr initramfs.arm64.ramfs.new.cpio.gz.uramdisk
reading initramfs.arm64.ir909.ramfs.new.cpio.gz.uramdisk
12651334 bytes read in 2587 ms ( 4.7 MiB/s)
# set console
Marvell>> setenv bootargs console = ttyS0,115200
Marvell>> booti $kernel_addr $ramfs_addr $fdt_addr
## Current stack ends at 0x3f970fd0 * ramdisk: cmdline image address = 0x12000000
## Loading init Ramdisk from Legacy Image at 12000000 ...
Image Name: Sparrow Ramdisk Image
Created: 2017-03-23 23:52:49 UTC
Image Type: AArch64 Linux RAMDisk Image ( gzip compressed)
Data Size: 12651270 Bytes = 12.1 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
ramdisk start = 0x12000040, ramdisk end = 0x12c10b46
## Flattened Device Tree blob at 01000000
Booting using the fdt blob at 0x1000000
using: FDT
## initrd_high = 0xffffffffffffffff, copy_to_ram = 1
Loading Ramdisk to 3ed5f000, end 3f96fb06 ... OK
ramdisk load start = 0x3ed5f000, ramdisk load end = 0x3f96fb06
Using Device Tree in place at 0000000001000000, end 000000000100948b
## Transferring control to Linux (at address 80000)...
Starting kernel ...
Timer summary in microseconds:
Mark Elapsed Stage
0 0 reset
987,000 987,000 id = 64
1,188,000 201,000 id = 65
1,214,000 26,000 main_loop
4,236,000 3,022,000 id = 80
4,236,000 0 tftp_start
4,236,000 0 eth_start
4,245,000 9,000 id = 81
4,245,000 0 tftp_done
4,258,000 13,000 bootm_start
160,127,000155,869,000 id = 9
160,127,000 0 id = 10
162,117,000 1,990,000 id = 11
162,135,000 18,000 id = 12
166,294,000 4,159,000 id = 15
166,296,000 2,000 start_kernel
769,189,068,930,788,833,6769,189,068,914,159,233,6 board_init_f
Accumulated time :
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.51-armada-17.02.2 ( xelinux@xe-linux-bld2) ( gcc version 5.3.0 ( GCC) ) #1 SMP Wed Mar 22 05:447
[ 0.000000] Boot CPU: AArch64 Processor [ 410fd081]
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 128 MiB at 0x0000000078000000
...