
We have been working lately with Enric Balletbo and Dorinda Bassey to improve the support for the HP X2 Chromebook in Fedora. This post explains how to install Fedora on that Chromebook.
The article ended being up being longer than I thought, so for the impatient this is the summary:
-
Switch the Chromebook to Developer Mode.
-
Boot from the internal disk.
-
Go to a virtual terminal with Ctrl+Alt+F2 and login as root.
-
Enable developer mode boot from external disk (USB/microSD):
$ crossystem dev_boot_usb=1
-
Install packages needed by the
chromebook-setup.sh
script:$ sudo dnf install bc curl util-linux gdisk lz4 \ e2fsprogs uboot-tools udisks2 vboot-utils \ guestfs-tools qemu-user-static
-
Clone Enric’s chromebooks scripts repo:
$ git clone https://github.com/eballetbo/chromebooks.git $ pushd chromebooks
-
Flash a Fedora image to a storage media (replace
/dev/sda
with your block device):$ sudo ./chromebook-setup.sh deploy_fedora \ --architecture=arm64 --storage=/dev/sda \ --kparams="clk_ignore_unused deferred_probe_timeout=30"
-
Plug the USB/microSD device into the Chromebook and choose to boot from an external device.
-
After the Fedora initial setup, install the following packages:
$ sudo dnf install uboot-tools vboot-utils lz4 -y
-
Remove packages that expects the grub2 bootloader to be used:
$ sudo dnf remove grubby kexec-tools -y
-
Enjoy Fedora on the Chromebook 🙂
Now the longer version…
Challenges supporting the Chromebooks in Fedora
Supporting the Chromebooks is not trivial, because these laptops use a different firmware (Coreboot) and boot stack (Depthcharge) than what is used by all the other aarch64 machines supported by Fedora (UEFI and GRUB). There are good reasons why that is the case, but it poses some challenges and complicates making these laptops to work in Fedora out-of-the-box.
For this reason, a standard Fedora ISO image can’t just be booted on a Chromebook to start an installation process.
Current approach used to install Fedora on the Chromebooks
To overcome this, Enric wrote a set of chromebook scripts that can be used to setup a block device (i.e: USB drive or microSD card) and write a Fedora image that can be booted directly. The script also adds to the system a kernel-install plugin, written by Dorinda, that takes the Linux kernel image being installed and package it in the format (FIT) expected by the Chromebook bootloader.
That way, the Fedora installation would look and behave exactly the same than in any other system.
In the future support for Chromebooks might be added to the Anaconda OS installer used by Fedora, but in the meantime using this script allows us to do experimentation and make further customization that wouldn’t be suitable for a general system installer.
Following are the instructions to install Fedora on a HP X2 Chromebook using the chromebook-setup.sh
script.
Switch the Chromebook to Developer Mode
In the default mode the Chromebook can only boot binaries that are trusted by its firmware. This means that nothing besides ChromeOS can be installed. To boot a different OS, the mode should be change to Developer. In this mode, any binary that is signed with the Google’s developer key can be booted. That key is available for anyone so is what is used to sign the Linux images when generating the FIT images during the Fedora kernel packages installations.
The ChromiumOS project has excellent articles explaining the Developer Mode and how to enable it on Chromebooks without a physical keyboard, such as the HP X2.
After enabling developer mode, boot from the internal disk and switch to a virtual terminal with Ctrl+Alt+F2. Then login as root and execute the following to enable booting from an external disk (USB/microSD):
$ crossystem dev_boot_usb=1
Flashing a Fedora image
The chromebook-setup.sh script can be used to flash fedora images to a block device and do all the needed setup to make it bootable.
It supports many different options but it also has reasonable defaults. The list of options can be listed with ./chromebook-setup --help
.
Following are the steps to flash a Fedora image.
Install packages needed by the chromebook-setup.sh
script:
$ sudo dnf install bc curl util-linux gdisk lz4 \
e2fsprogs uboot-tools udisks2 vboot-utils \
guestfs-tools qemu-user-static
Clone Enric’s chromebooks scripts repository:
$ git clone https://github.com/eballetbo/chromebooks.git
$ pushd chromebooks
Execute the script, for example:
$ sudo ./chromebook-setup.sh deploy_fedora \
--architecture=arm64 --storage=/dev/sda \
--kparams="clk_ignore_unused deferred_probe_timeout=30"
The deploy_fedora
option will install a Fedora image in the specified storage media. By default the latest Fedora Workstation Rawhide image will downloaded and used, but a different image can be chosen using the --image=$image
option.
The --architecture
and --storage
options specify the architecture and block device used respectively.
Finally, the --kparams
option allows to set additional kernel command line parameters.
The clk_ignore_unused
parameter is currently needed because there is a bug when the MSM/snapdragon DRM driver is built as a module. Some needed clocks are gated before the driver probe function is executed, causing it to fail.
And the deferred_probe_timeout=30
is needed because there are a lot of drivers probe deferrals and the default 10 seconds expires causing drivers to fail to probe due timeouts.
Hopefully these two issues would be fixed soon and the parameters won’t be needed anymore.
One the script finishes flashing the image, plug the USB drive or insert the microSD in the Chromebook and choose "Boot from external media".
The system should boot and start the Fedora initial setup program to configure the system and create a user. Once that is done, start a terminal and install the following packages needed by the kernel-install
Chromebook plugin:
$ sudo dnf install uboot-tools vboot-utils lz4 -y
Remove packages that expects the grub2 bootloader to be used:
$ sudo dnf remove grubby kexec-tools -y
And that’s it. Now the Fedora should behave like in any other system. If there are any bugs, please file issues in the chromebooks scripts repository.
Happy hacking!