Note that this will automatically get rid of ChromeOS. To reinstall ChromeOS, you need to load ChromeOS recovery image on a USB and boot from it.
gaining root access
sudo -i
Note. Password is same as for your user account
start by listing all available disks
lsblk
the output should look like this
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mtdblock0 31:0 0 8M 0 disk
sda 179:0 0 116,5G 0 disk <- this is the booted drive
├─sda1 179:1 0 64M 0 part <- this is a partition
├─sda2 179:2 0 64M 0 part
├─sda3 179:3 0 512M 0 part /boot
├─sda4 179:4 0 107,9G 0 part / <- it has current root partition
└─sda5 179:5 0 8G 0 part
mmcblk1 179:0 0 116,5G 0 disk <- this is an internal disk
├─mmcblk1p1 179:1 0 64M 0 part <- this is a partition
├─mmcblk1p2 179:2 0 64M 0 part
├─mmcblk1p3 179:3 0 512M 0 part
├─mmcblk1p4 179:4 0 107,9G 0 part
└─mmcblk1p5 179:5 0 8G 0 part
mmcblk1boot0 179:32 0 4M 1 disk
mmcblk1boot1 179:64 0 4M 1 disk
Tip. The chromebook partition will be the one without partition with "/"
emmc disks can usually easily identified by the fact that there are also the following two (not to be used) devices for them as well: mmcblkxboot0, mmcblkxboot1
Note. the internal memory is often (but not always) mmcblk1 or mmcblk0 but don't be thrown off if it's something else
Export the target disk
if you want to install onto mmcblk0 or mmcblk1 (number is different on different chromebooks)
export disk=mmcblk0
export part=mmcblk0p
or
export disk=mmcblk1
export part=mmcblk1p
respectively
if you want to install on sda or similar
export disk=sda
export part=sda
Export the source disk
if the booted device is mmcblk0 or mmcblk1 (number is different on different chromebooks)
export srcPart=mmcblk0p
or
export srcPart=mmcblk1p
respectively
if the booted device is sda or similar
export srcPart=sda
Wipe the partition table on the target disk
sgdisk -Z /dev/$disk
partprobe /dev/$disk
sgdisk -C -e -G /dev/$disk
partprobe /dev/$disk
Create a new partition table
cgpt create /dev/$disk
Create the two kernel partitions
cgpt add -i 1 -t kernel -b 8192 -s 65536 -l KernelA -S 1 -T 2 -P 10 /dev/$disk
cgpt add -i 2 -t kernel -b 73728 -s 65536 -l KernelB -S 0 -T 2 -P 5 /dev/$disk
For veyron ONLY the following four lines should be used instead of the two above
cgpt add -i 1 -t kernel -b 73728 -s 32768 -l KernelA -S 1 -T 2 -P 10 /dev/$disk
cgpt repair /dev/$disk
cgpt add -i 2 -t kernel -b 106496 -s 32768 -l KernelB -S 0 -T 2 -P 5 /dev/$disk
cgpt repair /dev/$disk
Create remaining partitions
wget https://raw.githubusercontent.com/hexdump0815/imagebuilder/main/systems/chromebook_veyron/gpt-partitions.txt
Note. But in theory, all arm chromebooks should use the same setup here.
fdisk /dev/$disk < gpt-partitions.txt
Create the boot and root filesystems and mount them
mkfs -t ext4 -O ^has_journal -m 0 -L bootemmc /dev/${part}3
mkfs -t btrfs -m single -L rootemmc /dev/${part}4
mount -o ssd,compress-force=zstd,noatime,nodiratime /dev/${part}4 /mnt
mkdir -p /mnt/boot
mount /dev/${part}3 /mnt/boot
_Note: If deploying for the 3.10 kernel for the early Chromebook Snow releases, you must add -O ^extref,^skinny-metadata,^no-holes,^zoned -R ^free-space-tree to mkfs to disable features not supported by Linux 3.10. You also must omit compress-force=zstd when mounting.
copy the kernel partition to the target emmc
dd if=/dev/${srcPart}1 of=/dev/${part}1 bs=1024k status=progress
Note. The second kernel partition is by default unused initially.
sync over the boot and root filesystems
rsync -axADHSX --no-inc-recursive --delete /boot/ /mnt/boot
rsync -axADHSX --no-inc-recursive --delete --exclude='/swap/*' / /mnt
create a new 2gb swapfile (optional)
rm -rf /mnt/swap
btrfs subvolume create /mnt/swap
chmod 755 /mnt/swap
chattr -R +C /mnt/swap
btrfs property set /mnt/swap compression none
cd /mnt/swap
truncate -s 0 ./file.0; btrfs property set ./file.0 compression none; fallocate -l 2G file.0; chmod 600 ./file.0; mkswap -L file.0 ./file.0
Note. You can also create a swap partition.
Adjust the filesystem labels in the new etc/fstab
sed -i 's,bootpart,bootemmc,g;s,rootpart,rootemmc,g' /mnt/etc/fstab
Do the same in the u-boot config file if it exists (on 32bit arm chromebooks only)
sed -i 's,rootpart,rootemmc,g' /mnt/boot/extlinux/extlinux.conf
umount everything
umount /mnt/boot /mnt
Now after a shutdown the SD card/USB can be taken out/disconnected and the system should boot into Linux from emmc on the next boot.