-
Notifications
You must be signed in to change notification settings - Fork 286
Dragonboard Boot Image
The boot image that can be used with fastboot uses a specific format, and this document provides instructions to create such a boot file. The boot image generally contains the kernel image, an initrd image as well as a specific/custom device tree image.
NOTE: This section is for Linux (Ubuntu, Debian, OE, ...) only! Android uses a different tools.
This wiki page assumes that you have already built a kernel from source, and that you are currently located at the root of the kernel source tree you have built. If you don't know how to build the kernel from source, or which version to build, please refer to the release notes, there is section that provides kernel information (git tree, tag, defconfig, compiler version, ...). Note that the following instructions also assume that you have built the DTB files from the kernel sources.
Somewhere, on your machine, install the following tools:
git clone git://codeaurora.org/quic/kernel/skales
To use this tool you should have the fdtget program. This is commonly distributed as part of the device tree compiler package.
device-tree-compiler and libfdt-dev (debian)
dtc (redhat)
sys-apps/dtc (gentoo)
The boot image consists of the table of device tree, the kernel image and an init ramdisk image.
In a terminal window that will be used for the entire section, please run:
cd <kernel source tree>
export PATH=<path of the skales tools>:$PATH
The dtbTool is a standalone application that will process the DTBs generated during the kernel build, to create the table of device tree image, simply run:
dtbTool -o dt.img -s <pagesize> ./arch/arm64/boot/dts/qcom/
Note that pagesize must be set as follows:
- 2048 on APQ8064 or APQ8016 based boards (IFC6410, DB410c, DB600c, ...)
- 4096 on APQ8096 based boards (DB820c, ...)
To create the boot image, you need a ramdisk image. For now it is recommended to download one of the ramdisk image from Linaro builds. For example, for DB820c:
wget -O ramdisk.img http://builds.96boards.org/snapshots/dragonboard820c/linaro/debian/latest/initrd.img-*
The tool mkbootimg is a standalone application that is part of skales.git above, that will process all files and create the boot image that can then be booted on the target board, or flash into the on-board eMMC.
The boot image also contains the kernel bootargs, which can be changed as needed in the next command.
To mount the rootfs from the ramdisk, set up the bootargs as follows:
export cmdline="root=/dev/ram0 rw rootwait console=ttyMSM0,115200n8"
If you have install a rootFS on the on-board eMMC, for example in the userdata partition, you can use this instead:
export cmdline="root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8"
For the text console add "text" to the end of cmdline:
export cmdline="root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8 text"
Create the boot image:
mkbootimg --kernel ./arch/arm64/boot/Image.gz \
--ramdisk ramdisk.img \
--output boot.img \
--dt dt.img \
--pagesize <pagesize> \
--base 0x80000000 \
--cmdline "$cmdline"
Note that pagesize must be set as follows:
- 2048 on APQ8064 or APQ8016 based boards (IFC6410, DB410c, DB600c, ...)
- 4096 on APQ8096 based boards (DB820c, ...)
The boot image generated using the instructions from the section above can be booted using fastboot:
sudo fastboot boot boot.img
Alternatively, it can be flashed into the on-board eMMC:
sudo fastboot flash boot boot.img
Instructions to update the boot partition using a kernel package on a running system.
sudo apt-get install libfdt-dev
git clone git://codeaurora.org/quic/kernel/skales /tmp/skales
export PATH=$PATH:/tmp/skales
wget http://repo.linaro.org/ubuntu/linaro-staging/pool/main/l/linux/linux-image-4.4.0-trunk-arm64_4.4.0.linaro.80-1_arm64.deb
sudo dpkg -i linux-image-4.4.0-trunk-arm64_4.4.0.linaro.80-1_arm64.deb
dtbTool -o dt.img -s <pagesize> /usr/lib/linux-image-4.4.0-trunk-arm64/qcom/
mkbootimg --kernel /boot/vmlinuz-4.4.0-trunk-arm64 --ramdisk /boot/initrd.img-4.4.0-trunk-arm64 --output boot.img --dt dt.img --pagesize "<pagesize>" --base "0x80000000" --cmdline "root=/dev/disk/by-partlabel/rootfs rw rootwait console=tty0 console=ttyMSM0,115200n8"
sudo dd if=boot.img of=/dev/disk/by-partlabel/boot