As of the current date (28th July 2023), there are two kernel types that can be used:
-
Mainline kernel: This is the latest stock Linux kernel directly from kernel.org.
-
ChromeOS kernel: This is a Google-customized Linux kernel, currently located here.
There is no definitive way to predict which kernel will work best for each device in the future. Therefore, it is recommended to test both kernels to determine which one performs better on your specific device.
Follow these steps with the desired kernel:
-
Download the kernel source code.
-
Install all tools and dependencies needed to compile the kernel.
-
Generate the default config with
make defconfig. -
Edit the default config with
make menuconfig:- 4.1. Enable any Chromebook/box or Google related options you find.
- 4.2. Find out which soundcard your Chromebook/box uses and enable any options related to it.
- 4.3. Enable modules that are needed for the storage format used when formatting the boot medium in preparing the boot medium.
-
Compile the kernel with
make -j"$(nproc)". This step might take a very long time, especially on slower devices. -
Compile the kernel modules with
mkdir kernel-modules && make -j"$(nproc)" modules_install INSTALL_MOD_PATH=mod INSTALL_MOD_STRIP=1. -
Optional: Compile the kernel headers.
-
Optional: Create an initramfs and compile it into the kernel. External initramfs are not supported by Depthcharge.
-
Create the kernel cmdline:
- 9.1. Run
blkid -o value -s PARTUUID /dev/insert_rootfs_partition_here. Replaceinsert_rootfs_partition_herewith your rootfs partition. It will be either/dev/insert_devicep2or/dev/insert_device2(notice the missing 'p' in the second example). - 9.2. Create a new file called
cmdline.txt. - 9.3. Paste the following into the file:
loglevel=15 root=PARTUUID=insert_partuuid i915.modeset=1 rootwait rw. Replaceinsert_partuuidwith the output you got in step 9.1. - 9.4. Optional: add
security=apparmororsecurity=selinuxat the end if your distro requires that. Not including this may cause your distro not to behave correctly.
- 9.1. Run
-
Sign the kernel with:
futility vbutil_kernel --arch x86_64 --keyblock /usr/share/vboot/devkeys/kernel.keyblock --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --bootloader cmdline.txt --config cmdline.txt --vmlinuz ./arch/x86/boot/bzImage --pack ./bzImage.signed.
Once you've finished compiling the kernel, you'll need to install it to the boot medium:
-
Determine the partition name to flash the kernel. It will be either
/dev/insert_devicep1or/dev/insert_device1(notice the missing 'p' in the second example). Once you have it, flash the kernel with:dd if=/path-to-kernel-source-code/bzImage.signed of=/dev/insert_device1. Replacepath-to-kernel-source-codewith the appropriate path where you have stored the signed kernel image. -
Mount the second partition of the storage medium (if you haven't already) and copy the kernel modules into
/lib/modules(or/usr/lib/modules) on the second partition. -
Optional: Copy the headers to the appropriate location and create symbolic links for all the required paths.