Note: Adapted/inspired by this page
Introduction
This guide will walk you through installed Arch Linux with a mainline kernel on a USB key suitable for booting on the Chromebook Plus (kevin).
Preparing the USB keyPlug the USB key into your chromebook and run the following commands in the shell to create a new partition table and 2 partitions - one for the kernel and another for rootfs.
; umount /dev/sda*; fdisk /dev/sdaCommand (m for help): g
Command (m for help): w
Command (m for help): q
; cgpt show /dev/sda
start size part contents
0 1 PMBR
1 1 Pri GPT header
8192 65536 1 Label: "Kernel"
Type: ChromeOS kernel
UUID: A1E0BF2A-3687-A949-86F8-40507B1D0756
Attr: priority=10 tries=5 successful=1
73728 122470755 2 Label: "Root"
Type: Linux data
UUID: A3590EA0-A89B-434F-B6C3-902C0A87CDFB
122544483 32 Sec GPT table
122544515 1 Sec GPT header
The numbers above will differ depending on the size of your USB key. Grab the value under the "start" column for the "Sec GPT table" row and insert it in the command below (<start_value>)
; cgpt add -i 2 -t data -b 73728 -s `expr <start_value> - 73728` -l Root /dev/sda Your USB key is now formatted in such a way that the chromebook can book from it. Next step is to put something bootable on it.
Download Arch rootfsThe following will download the latest Arch Linux image for gru-kevin and flash the rootfs partition.
; cd /tmp ; wget http://os.archlinuxarm.org/os/ArchLinuxARM-gru-latest.tar.gz ; mkdir root ; sudo mount /dev/sda 2 root ; sudo tar -xf ArchLinuxARM-gru-latest.tar.gz -C root In order to test the image and your partition table, flash the kernel partition from the Arch tarball to your USB key
; sudo dd if=root/boot/vmlinux.kpart of=/dev/sda1 ; sync Finally, unmount the root partition:
; umount root Unplug the USB key from your workstation and test boot it on your kevin by pressing Ctrl+U at the developer screen. The device should boot to a login prompt (user: root, passwd: root).
; reboot Preparing the kernelBack on your workstation, sync a linux-next kernel for maximum freshness.
seanpaul: ^^ These links are broken now (thanks to Brian Carnes for the report). I don't remember what they did, but I also don't think they're needed any longer since rockchip display support is all in mainline. Building the kernelYou'll need to grab the kernel.keyblock and kernel_data_key.vbprivk files in order to package the kernel. They're stored in Arch Linux's PKGBUILDs repo on github here. I put them in <kernel_root>/resources/gru-kevin/. Also stored in <kernel_root>/resources/gru-kevin is the rk3399-gru-kevin.its file. Create and copy/paste the following into it: /dts-v1/; / { description = "Chrome OS kernel image with one or more FDT blobs"; #address-cells = <1>; images { kernel@1 { data = /incbin/("../../.build_arm64/arch/arm64/boot/Image"); type = "kernel_noload"; arch = "arm64"; os = "linux"; compression = "none"; load = <0>; entry = <0>; }; fdt@1 { description = "rk3399-gru-kevin"; data = /incbin/("../../.build_arm64/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb"); type = "flat_dt"; arch = "arm64"; compression = "none"; hash@1 { algo = "sha1"; }; }; }; configurations { default = "conf@1"; conf@1 { kernel = "kernel@1"; fdt = "fdt@1"; }; }; }; Grab my build script from github, and add a build.ini file in the kernel root with the following (changing the bold parts to suit your environment):
[target] ; From /dev/by-partuuid kernel_part_uuid=27c7f096-0f26-d544-a142-7273e6dcf01e ; From /dev/by-uuid root_uuid=89d88389-c5c3-4f88-9ea6-2efd6124bc49 [build] ; Choose one of these, not both. defconfig builds from an existing defconfig, ; whereas config_file points to a config file that will used verbatim defconfig=defconfig ;config_file=<path to config file> ; For the kernel build command; required kernel_arch=arm64 cross_compile=aarch64-linux-gnu- jobs=40 ; vbutil_kernel arguments, optional vbutil_kernel=/home/seanpaul/s/cros/chroot/usr/bin/vbutil_kernel keyblock=resources/gru-kevin/kernel.keyblock data_key=resources/gru-kevin/kernel_data_key.vbprivk cmdline=console=tty1 console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw noinitrd vbutil_arch=aarch64 ; mkimage arguments, optional mkimage=/home/seanpaul/s/cros/chroot/usr/bin/mkimage its_file=resources/gru-kevin/rk3399-gru-kevin.its ; post-build options install_modules=yes install_dtbs=yes generate_htmldocs=no Simply run the build_kernel.py script from the kernel root directory to build and flash your kernel. If all goes well, you should now have a USB key that will boot a mainline kernel with Arch Linux rootfs. |
Chromium OS > How Tos and Troubleshooting >