Alpine on the Aopen Chromebase or Chromebox 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 (updated for Alpine 3.15.0 and Kernel 5.15.4):
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 turn off OS verification and restart. At the OS verification screen, press ctrl-d again to transition to 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 chromebase-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 a kernel command line file that will work for both usb and the internal 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 a 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/ chromebase-firmware.tar.gz chromeos/ chromeos-5.10.tar.gz cmdline config.gz efi.patch kernel-veyron.its linux-5.12.tar.xz 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 and fievel dtb files into the root of the working directory:
cd to the root of the working directory and create the FIT image:
Create the signed kernel image kernel.bin:
The kernel.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 mmc_type2.partmap, install-mmc.sh, and alpine-rootfs.tar.gz 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.
A Note on the Onboard Speakers
I found that the headphone jack works out of the box with alsa. I couldn't immediately figure out how to test the onboard speakers though and found the answer here: https://unix.stackexchange.com/questions/585278/how-to-enable-speakers-on-armv7-chromebook
I figured out how to enable the speakers on this device:
Near the far right-hand-side of the alsamixer channel listing are some channels labelled 'Left Speaker Mixer Left DAC' and 'Left Speaker Mixer Right DAC' (and similar channels for the Right Speaker). These have to be enabled and then the speaker gain can be controlled by the more obvious Speaker gain channels, as usual. These channels apparently enable/disable DACs for the speakers.
It seems there are quite a few channels that appear in the 'playback' filter of alsamixer that shouldn't be there (such as many channels relating to ADCs, which I assume are related to recording).
I also haven't been able to find any option for auto-muting, so it seems it is necessary to manually mute/unmute the speaker/headphone channels, as necessary.
A Note on Video Drivers
Starting with the most recent kernel build (5.13) I enabled CONFIG_DRM_MALI_DISPLAY, that change, along with the mesa-dri-gallium and mesa-egl packages, greatly improved video playback performance with mpv under X.