Alpine on the Aopen Chromebase Mini with Mainline Kernel
This wiki article details the steps I took to get the mainline Linux kernel and Alpine Linux running on an Aopen Chromebase Mini.
The Aopen Chromebase Mini is based on the Rockchip RK3288 32-bit ARM SOC and goes by the board name of veyron-tiger.
The device is switched to developer mode and the stock bootloader is used to boot the mainline kernel.
To skip the guide and just download and write a boot image to a 500MB or larger USB stick:
Prep the Build Machine
In my case, the kernel build will be done on an RPi4 running the armv7 build of Alpine Linux. The RPi4 is set up for building packages, though since we won't actually be building any Alpine packages, you can just install the necessary development packages noted below and skip much of the package wiki. See Creating an Alpine Package for help on setting up the build environment.
I have successfully cross-compiled kernels and root filesystems in the past, but for this effort I chose to do everything natively on armv7. Next, create a working directory to use for the rest of this guide. Once you have your armv7 build machine setup, the next step is to gather some support files from the Chromebase and then start the kernel build.
Prep the Chromebase Mini
My Chromebase Mini was configured as a Google TV Meter device and I needed to get a standard ChromeOS image restored to it.
Go to Google's recovery help page, scroll to the bottom and follow the steps to "Use a Linux Computer" to make the USB recovery media.
Using a paperclip or similar tool, press and hold the recovery button on the right hand side of the Chromebase and then connect power.
Release the recovery button when the recovery screen is displayed.
Plug in the USB recovery media and follow the prompts to restore the image.
I don't know if there's a way around it or not, but I had to go through the initial setup and device registration steps using my personal google account before I was able to enable developer mode. After the registration steps are complete, remove power, plug in a keyboard, press and hold the recovery button, apply power and then at the "Chrome OS is missing or damaged", release the recovery button and press ctrl-d on the keyboard. Press the recovery button again to confirm entering developer mode.
Once in developer mode you can log in or choose "browse as guest" to login and get a chrome browser window. Once there, open a crosh terminal window tab by pressing the ctrl+alt+t key combination. Then get to a root prompt:
Enable USB boot:
Generate the ChromeOS kernel config:
Tar up /lib/firmware
Copy /proc/config.gz and the chrombase-firmware.tar.gz to a working directory on the build machine.
Prep the Working Directory
Change to the working directory on the build machine. Create a dummy bootloader file:
Create two kernel cmdline files, one for USB and one for the onboard mmc:
Create the image source file kernel-veyron.its with the following contents:
Create or download the partition map file for the internal emmc:
Download the mainline linux kernel source:
Download the most recent chromeos kernel source:
Make a build directory and extract the mainline kernel source:
Make a chromeos directory and extract the efi.c and efi.h files from the chromeos kernel source to it:
Create a patch file for efi.c and efi.h, this is needed so the partitions on the internal emmc are detected correctly:
The working directory should now contain the following files and directories:
bootloader.bin build/ chrombase-firmware.tar.gz chromeos/ chromeos-5.10.tar.gz cmdline-mmc cmdline-usb config.gz efi.patch kernel-veyron.its linux-5.12-rc5.tar.gz mmc_type2.partmap
That's it for the prep, time to build the kernel.
Extract config.gz into the build directory:
cd into the build directory and rename config to .config:
Enable some additional config options:
Answer y when asked to overwrite .config then enable the rest of the options:
Patch efi.c and efi.h:
Compile the zImage, modules, and dtbs - this will take some time:
Copy the zImage and tiger dtb file into the root of the working directory:
cd to the root of the working directory and create the FIT image (ignore warnings about "no reg property"):
Create the signed kernel images kernel-usb.bin (for the USB stick) and kernel-mmc.bin (for the internal emmc):
The kernel-usb.bin file will be written to the boot partition of the USB stick later in the procedure.
Create Alpine Root Filesystem
Create a new directory in the working directory for the root filesystem:
Copy apk directories from the host system:
Initialize the apk package database and install a minimal package set:
cd into the build directory and install the kernel modules to the new alpine rootfs:
cd back to the root of the working dir and extract the firmware into the rootfs:
Have Alpine start some basic services on boot:
Tar up the rootfs:
Create the USB Boot Media
Insert a USB stick into the build machine, determine it's device path and substitute that path as applicable in the following steps.
Create a new gpt label on the USB stick:
Run cgpt create:
Create the kernel and root filesystem partitions:
Reread the partition table on the USB stick:
Write the kernel to the USB stick first partition:
Create an ext4 filesystem on the USB stick second partition:
Create a directory and mount the USB stick second partition:
Extract the root filesystem to the USB stick second partition:
Create a script file for installing to internal mmc:
Make it executable:
Copy the kernel-mmc.bin, mmc_type2.partmap, and install-mmc.sh files to root's home directory:
Sync and unmount the second partition:
Boot and Reload the Chromebase Mini
Remove the USB stick from your build machine and insert into the Chromebase Mini.
Connect a USB keyboard and power up the Chromebase.
At the OS verification screen press ctrl+u to boot from USB.
Login as root with no password.
Run the install script:
At this point we are done. Type reboot and at the OS verification screen, remove the usb stick and then press ctrl-d to boot from the internal flash.
If all went well you should be at a login prompt and can login as root with no password.
The rest of the OS configuration is the same as an any other Alpine install.