ARM64 – Dragonboard 410c – Now with U-Boot..
One of the shortcomings of the DragonBoard 410c was that it relied on the Android-phone-centric fastboot for any Kernel updates, but now there is a version of U-Boot available, thanks to Mateusz Kulikowski..
This is very much a work-in-progress, but I thought I would give it a try…
I started with the version at https://github.com/hallor/u-boot/tree/dragonboard-2015.11.01, and made some modifications to get it working on my 410c (Fedora 23, EXT4 rootfs, boot from SDCard)..
I should emphasize that I am a complete novice when it comes to hacking u-boot, and there may well be a better way of doing all this, but this worked, for me..
Modify u-boot/include/configs/dragonboard.h
add:
#define CONFIG_CMD_EXT4 /* EXT4 support */
#define CONFIG_SYS_BOOTM_LEN (16 << 20) /* Increase max image size */
And.. as the SAVEENV command was not included, for some reason – and I could not work out how to reenable it – I hard-coded the boot parameters, as follows:
after:
/* Environment – Boot*/
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
insert:
#define CONFIG_BOOTARGS “root=/dev/mmcblk1p1 rw rootwait console=tty0 console=ttyMSM0,115200n8 rootfs=ext4 noinitrd selinux=0”
#define CONFIG_BOOTCOMMAND “ext4load mmc 1:1 0x90000000 /boot/uImage; ext4load mmc 1:1 0x89000000 /boot/apq8016-sbc.dtb; bootm 0x90000000 – 0x89000000; ”
< each of these #defines should be a single line..>
Then:
#] make distclean #] make dragonboard_config #] make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- (or whatever cross-compiler you are using..)
And make a ‘fake kernel’ image to use with fastboot, to install u-boot…
mkbootimg can be found at git://codeaurora.org/quic/kernel/skales, and I just installed it in /opt, and then added the location to the $PATH..
#] export PATH=/opt/skales:$PATH #] mkbootimg --kernel=u-boot.bin --output=u-boot.img --dt=fake_dt --pagesize 2048 --base 0x80000000 --ramdisk=fake_ramdisk --cmdline="" (su, and enable fastboot on the 410c, after connecting the USB cable, etc. etc..) #] fastboot flash boot u-boot.img
So.. the fastboot-enabled ‘boot’ image is not the kernel now, but actually the u-boot executable.. You will only need to use fastboot to install/update u-boot.
The kernel can now be compiled on the Dragonboard, now, but the arm64 kernels do not include any built-in #make uImage or #make zImage capability, and so you will need to create a uImage after the #make Image kernel compile..
#] make defconfig (if necessary..) #] make xconfig (select qcom...) #] make -j5 Image #] make dtbs #] cp arch/arm64/boot/dts/qcom/apq8016-sbc.dtb /boot #] make -j5 modules #] make modules_install #] make firmware_install #] cp System.map /boot #] cp arch/arm64/boot/Image /boot
Then in the /boot directory:
#] mkimage -A arm64 -O linux -C none -T kernel -a 0x80080000 -e 0x80080000 -n Dragonboard -d Image uImage
U-boot boot sequence – after u-boot is loaded by the old android bootloader:
U-Boot 2015.10-00449-g8e0b5c4-dirty (Nov 09 2015 - 14:13:46 -0800) Qualcomm-DragonBoard 410C DRAM: 986 MiB MMC: msm_sdhci: 0, msm_sdhci: 1 Using default environment In: serial Out: serial Err: serial Net: Net Initialization Skipped No ethernet found. Hit any key to stop autoboot: 0 => printenv baudrate=115200 bootargs=root=/dev/mmcblk1p1 rw rootwait console=tty0 console=ttyMSM0,115200n8 rootfs=ext4 noinitrd selinux=0 bootcmd=ext4load mmc 1:1 0x90000000 /boot/uImage; ext4load mmc 1:1 0x89000000 /boot/apq8016-sbc.dtb; bootm 0x90000000 - 0x89000000; bootdelay=5 stderr=serial stdin=serial stdout=serial Environment size: 327/4092 bytes => boot
<< Linux Kernel boots… >>
................. [ OK ] Reached target Network is Online. Starting LSB: Start or stop the Webmin server... Starting rolekit - role server... Starting Availability of block devices... [ OK ] Reached target Remote File Systems (Pre). [ OK ] Reached target Remote File Systems. Starting Permit User Sessions... [ OK ] Started OpenSSH server daemon. Starting OpenSSH server daemon... [ OK ] Started Availability of block devices. [ OK ] Started Permit User Sessions. Starting Terminate Plymouth Boot Screen... [ OK ] Started Command Scheduler. Starting Command Scheduler... Starting Wait for Plymouth Boot Screen to Quit... Fedora 23 (Twenty Three) Kernel 4.2.0 on an aarch64 (ttyMSM0) rg410c login:
So.. I now have a Dragonboard 410c that I can compile the kernel on, and boot, without having to cross-compile or connect USB cables!
Robert Gadsdon. November 9, 2015.
Updated November 12, to add info on mkbootimg..
Could you point to the version of mkbootimg you are using? None of the ones I’ve found seem to support the –dt option.
Thanks for mentioning this.. I’ve added the info to the original article..
RG.
I tried to boot my kernel and rootfs from USB hard drive. However, I went into trouble. Thus, I want to debug it.
I’m not sure tty0/ttyMSM0 maps to UART0 in dragonboard. In any case, I connect USBtoSerial board to UART0. But I saw nothing.
Could you recommend how to debug it?
The Dragonboard 410c connection should be UART1, and the connection is shown here:
https://github.com/96boards/documentation/wiki/Dragonboard-410c-Installation-Guide-for-Linux-and-Android#setting-up-the-uart-console
The USB/UART connection is 1.8v..
RG
Thanks! I can see u-boot message from PC now
However, I got stuck when loading kernel from USB hard drive. Both my kernel and rootfs in an external ext4 partition USB hard drive. The UUID points to that partition.
Here is boot command:
#define CONFIG_BOOTCOMMAND “usb start; usb storage; ext4load usb 0:1 0x90000000 /boot/uImage; ext4load usb 0:1 0x89000000 /boot/apq8016-sbc.dtb; bootm 0x90000000 – 0x89000000”
#define CONFIG_BOOTARGS “root=UUID=ae5fa761-95be-469b-b7dc-a355d080ed23 rw rootwait console=tty0 console=ttyMSM0,115200n8 rootfs=ext4 noinitrd selinux=0”
———–
Output from serial console
DRAM: 986 MiB
MMC: msm_sdhci: 0, msm_sdhci: 1
Using default environment
In: serial
Out: serial
Err: serial
Net: Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot: 0 Escape CONFIG_ZERO_BOOTDELAY_CHECK: abort(0)
starting USB…
USB0: USB EHCI 1.00
scanning bus 0 for devices… 3 USB Device(s) found
scanning usb for storage devices… 1 Storage Device(s) found
scanning usb for ethernet devices… 0 Ethernet Device(s) found
Device 0: Vendor: StoreJet Rev: 0 Prod: Transcend
Type: Hard Disk
Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
13886016 bytes read in 927 ms (14.3 MiB/s)
59281 bytes read in 137 ms (421.9 KiB/s)
## Booting kernel from Legacy Image at 90000000 …
Image Name: Dragonboard
Image Type: AArch64 Linux Kernel Image (uncompressed)
Data Size: 13885952 Bytes = 13.2 MiB
Load Address: 80080000
Entry Point: 80080000
Verifying Checksum … OK
## Flattened Device Tree blob at 89000000
Booting using the fdt blob at 0x89000000
Loading Kernel Image … OK
I think there might be a typo in uImage creation:
mkimage -A arm64 -O linux -C none -T kernel -a 0x80080000 -e 0x80080000 -n Dragonboard -d Image uImage
Address and entry point according to context should be 0x90000000
I saw more output line after fixing it:
Image Name: Dragonboard
Image Type: AArch64 Linux Kernel Image (uncompressed)
Data Size: 13885952 Bytes = 13.2 MiB
Load Address: 90000000
Entry Point: 90000000
Verifying Checksum … OK
## Flattened Device Tree blob at 89000000
Booting using the fdt blob at 0x89000000
Loading Kernel Image … OK
Using Device Tree in place at 0000000089000000, end 0000000089011790
Starting kernel …
However, I don’t see the kernel get boot.
If all steps went fine, you should now have a Debian desktop with working GPU.