The following tools are required in the build system: install cgpt, uboot-tools, vboot-utils and Chrome OS developer keys (vboot-kernel-utils / chromeos-devkeys / etc).
To build on a platform other than ChromeOS, in addition a cross-compilation toolchain for ARM is required.
In Debian based systems, these requirements correspond to the following packages:
u-boot-tools
vboot-kernel-utils
device-tree-compiler
cgpt
gcc-arm-none-eabi
-
Power on while holding down the ESC and Refresh keys.
-
Enable developer mode by pressing Ctrl-D on the recovery screen. WARNING: this will erase user data from the Chromebook.
-
Enable booting from external media by running
sudo crossystem dev_boot_usb=1
from a terminal once the the system has booted.
On the build system:
git clone https://chromium.googlesource.com/chromiumos/third_party/kernel -b chromeos-3.10
cd kernel
Get the USB firmware (from this overlay):
wget http://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/xhci-firmware-2014.11.06.00.00.tbz2
tar xf xhci-firmware-2014.11.06.00.00.tbz2
cp -R lib/firmware/ .
rm -R ./lib/firmware/
Prepare the config file:
./chromeos/scripts/prepareconfig chromeos-tegra
WIFIVERSION=-3.8 ARCH=arm CROSS_COMPILE=arm-none-eabi- make menuconfig
The WIFIVERSION variable is required to build the drivers in drivers/net/wireless-3.8
; the mwifiex driver in /drivers/net/wireless/ does not support the Chromebook's adapter. The ARM and CROSS_COMPILE variables are only required if cross-compiling. CROSS_COMPILE should be changed to the correct prefix for your toolchain.
Set Device Drivers > Generic Driver Options > External firmware blobs to build into the kernel binary
to nvidia/tegra124/xusb.bin
.
Change any other required settings. I've had some issues with HDCP negociation timing out when connecting a HDMI monitor, I would recommend disabling it.
Now the kernel can now be built:
WIFIVERSION=-3.8 ARCH=arm CROSS_COMPILE=arm-none-eabi- make zImage
WIFIVERSION=-3.8 ARCH=arm CROSS_COMPILE=arm-none-eabi- make modules
If the build fails because of compiler warnings treated as errors (happens especially when you enable additional options in the kernel config), disable CONFIG_ERROR_ON_WARNING
(Kernel hacking -> Treat compiler warnings as errors in menuconfig
).
Start by identifying the board revision to which your device correspondes. Run the following command in the Chrome OS shell:
cat /proc/device-tree/model
You can check that your board revision is supported by using this command in the build system:
ls arch/arm/boot/dts/tegra124-nyan-big-*.dts
Now use your board revision number to build the DTB file:
WIFIVERSION=-3.8 ARCH=arm CROSS_COMPILE=/usr/bin/arm-none-eabi- make tegra124-nyan-big-<board revision>.dtb
Build a Flattened Image Tree using the configuration file I provide:
wget https://raw.githubusercontent.com/lgeek/gnu-linux-on-acer-chromebook-13/master/nyan-big-fit.cfg
Open the nyan-big-fit.cfg
with your favourite text editor and in line 19 replace the path to the DTB file by the one you just created, e.g. "arch/arm/boot/dts/tegra124-nyan-big-rev3_7.dtb".
Finally, build the Flattened Image Tree:
mkimage -f nyan-big-fit.cfg nyan-big-kernel
A bootable image must now be generated using the vboot toolkit. To do so you must locate the kernel key block (<PATH TO KEYBLOCK>
below) and the private key (<PATH TO PRIVATE KEY>
) installed with vboot
. In Debian based systems these keys are found at:
- /usr/share/vboot/devkeys/kernel.keyblock (
<PATH TO KEYBLOCK>
) - /usr/share/vboot/devkeys/kernel_data_key.vbprivk (
<PATH TO PRIVATE KEY>
)
Replace these paths in the commands below to obtain the bootable image:
echo "root=/dev/mmcblk1p2 rootwait rw noinitrd" > ./cmdline
echo blah > dummy.txt
vbutil_kernel --arch arm --pack kernel.bin --keyblock <PATH TO KEYBLOCK> --signprivate <PATH TO PRIVATE KEY> --version 1 --config cmdline --vmlinuz nyan-big-kernel --bootloader dummy.txt
Two partitions must be created in the SD card, one for the kernel image and a second for the rootfs:
sudo cgpt create <MMC BLOCK DEVICE>
sudo cgpt add -b 34 -s 32768 -P 1 -S 1 -t kernel <MMC BLOCK DEVICE> # 16 MB kernel image partition
To fully use the remainder of the SD card with the second partition a few calculations must be made. To know how many sectors the SD card has left, use the command:
sudo cgpt show <MMC BLOCK DEVICE>
It should provide an output like:
start size part contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 32768 1 Label: ""
Type: ChromeOS kernel
UUID: C2CC569B-1773-E94B-8504-E7026B4659C9
Attr: priority=1 tries=0 successful=1
60367839 32 Sec GPT table
60367871 1 Sec GPT header
The exact number of sectors available equals the start of the secondary table minus the size of the first partition minus the size of the primary table. In this example it is: 60367839 - 32768 - 34 = 60335037.
You may now use this figure to create the rootfs partition:
sudo cgpt add -b 32802 -s <ROOT PARTITION SIZE in 512B sectors> -t rootfs <MMC BLOCK DEVICE>
cgpt
does not seem to create a protective MBR. If one is not already in place, it can be created with:
sudo gdisk <MMC BLOCK DEVICE> # and enter command w
sudo dd if=./kernel.bin of=<MMC BLOCK DEVICE>p1
sudo mkfs.ext4 <MMC BLOCK DEVICE>p2
sudo mount <MMC BLOCK DEVICE>p2 /mnt/
Now you're ready to copy a GNU/Linux rootfs to the root partition. I use NVIDIA's L4T rootfs because it's ready to run NVIDIA's Xorg driver. If you decide to use it as well, you'll need the 'Sample file system' and 'Driver Package' archives. Don't forget to install the kernel modules for the kernel you've just built:
sudo INSTALL_MOD_PATH=/mnt/ WIFIVERSION=-3.8 ARCH=arm CROSS_COMPILE=/usr/bin/arm-none-eabi- make modules_install
Finally, unmount the rootfs, move the SD card to the Chromebook and boot the new system by pressing Ctrl-U at the boot warning screen.
- The packed kernel and the rootfs can presumably also be copied to the internal eMMC, but I have not tried that yet.
- The touchpad needs the
xserver-xorg-input-synaptics
driver (which has multitouch support) to work. WiFi seems to occasionally disconnect when idle for a long time if NetworkManager is used, wicd seems reliable.NetworkManager is now working reliably for me. Older versions of the mwifiex driver (including the one shipped with my device) crash when NetworkManager manages theuap0
device.- OpenGL and XV hardware acceleration work correctly with the kernel interfaces exposed by the Chrome OS kernel; I have not yet tested CUDA.
- The Chromebook's keyboard has a slightly different layout compared to standard keyboards: the function keys (from Back to Volume Up) map to F1 to F10 and there are no F11 and F12 keys, so any standard shortcuts using these keys must be remapped. There are no Insert, Delete, Home, End, Page Up and Page Down keys, which takes a while to get used to.
- The Tegra K1 SoC in my Chromebook is a lower speed grade than the one used by Jetson TK1, the maximum core frequency allowed by this kernel is 2.01 GHz.