- Hold down Esc + Refresh and press the Power button.
- Once you see the Recovery Mode screen, press Ctrl-D, then press Enter.
The following section assumes your chromebook's SSD is /dev/mmcblk0. If you're unsure, run:
rootdev -d -s
-
Get to a root shell.
-
Decide what size you want to make Debian's root partition and the stateful partition.
The size of the stateful partition should be at least 256MiB and the sum of the sizes of the stateful partition and the Debian root partition should be equal to the current size of the stateful partition+1.
Note that the sizes used by cgpt are in sectors, or 2KiB.
You can find the current size of the stateful partition by running the following command:
cgpt show -i 1 -n -s -q /dev/mmcblk0
- Unmount your stateful partition
umount -f /mnt/stateful_partition
- Find the current start offset of your stateful partition:
cgpt show -i 1 -n -b -q /dev/mmcblk0
- Resize the stateful partition. This will wipe all user data stored on this partition.
cgpt add -i 1 -b $stateful_start -s $stateful_size -l STATE /dev/mmcblk0
- Resize the new kernel partition. $kernc_start can be found by adding $stateful_size to $stateful_start. Note that the kernel partition is always 16MiB.
cgpt add -i 6 -b $kernc_start -s 32768 -l KERN-C /dev/mmcblk0
- Resize the new root partition. $rootc_start can be found by adding 32768 to $kernc_start.
cgpt add -i 7 -b $rootc_start -s $rootc_size -l ROOT-C /dev/mmcblk0
- Reboot your system. It will reformat the stateful partition.
reboot
-
Get to a root shell.
-
Create a new ext4 filesystem in your new root partition.
mkfs.ext4 /dev/mmcblk0p7
- Make a directory called /tmp/urfs and mount your new Debian root partition into it
mkdir /tmp/urfs
mount /dev/mmcblk0 /tmp/urfs
- Create a directory in /tmp/urfs called debootstrap to store files needed for installation and cd into it.
mkdir /tmp/urfs/debootstrap
cd /tmp/urfs/debootstrap
- Get debootstrap dependencies from another x86_64 Linux box or download them from http://blaiseritchie.com/UPLOAD_TAR_GZ_HERE and copy them into /tmp/urfs/debootstrap/{bin,lib}: /usr/bin/ar, /usr/lib/libbfd-2.22-system.so, /usr/bin/perl, and /usr/lib/libperl.so.5.14
wget -O deps.tar.gz http://blaiseritchie.com/URL
tar xf deps.tar.gz
- Download and extract debootstrap
wget http://http.debian.net/debian/pool/main/d/debootstrap/debootstrap_1.0.48+deb7u1.tar.gz
tar xf debootstrap_1.0.48+deb7u1.tar.gz
- Add /tmp/urfs/debootstrap/lib to LD_LIBRARY_PATH and /tmp/urfs/debootstrap/bin to PATH
export PATH="$PATH:/tmp/urfs/debootstrap/bin" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/tmp/urfs/debootstrap/lib"
- cd into /tmp/urfs run debootstrap
cd /tmp/urfs debootstrap --arch amd64 testing . http://http.debian.net/debian/
- Remove unneeded debootstrap directory
rm -rf debootstrap
- Bind mounts
mount -o bind /proc proc
mount -o bind /dev dev
mount -o bind /dev/pts dev/pts
mount -o bind /sys sys
- Copy files from ChromeOS.
cp /etc/hosts etc
cp /proc/mounts etc/mtab
cp /etc/resolv.conf etc
cp /usr/bin/old_bins/{cgpt,chromeos-tpm-recovery,common_minimal.sh,crossystem,dev_debug_vboot,dev_sign_file,dumpRSAPublicKey,dump_kernel_config,enable_dev_usb_boot,gbb_utility,make_dev_firmware.sh,make_dev_ssd.sh,resign_firmwarefd.sh,set_gbb_flags.sh,tpm-nvsize,tpm_init_temp_fix,tpmc,vbutil_firmware,vbutil_kernel,vbutil_key,vbutil_keyblock,vbutil_what_keys} usr/local/bin
KERN_VER=$(uname -r)
mkdir -p lib/modules/$KERN_VER/
cp -ar /lib/modules/$KERN_VER/* lib/modules/$KERN_VER/
mkdir -p lib/firmware
cp -ar /lib/firmware/* lib/firmware/
- Pick a hostname and put it in etc/hostname and etc/hosts
echo "ChrDebian" > etc/hostname
echo -e "\n127.0.1.1 ChrDebian" >> /etc/hosts
- chroot into your new system.
chroot . /bin/bash
- Install needed packages.
apt-get -y update
apt-get -y dist-upgrade
apt-get update
tasksel install standard
tasksel install laptop
- Configure a user account
useradd -m -s /bin/bash -G adm,sudo,audio user
echo user:password | chpasswd
- Exit your chroot
exit
- Create /kernel-config
echo "console=tty1 debug verbose root=/dev/mmcblk0p7 rootwait rw lsm.module_locking=0" > kernel-config
- Write the kernel into the new kernel partition
current_rootfs="$(rootdev -s)"
current_kernfs_num=$((${current_rootfs: -1:1}-1))
current_kernfs=${current_rootfs: 0:-1}$current_kernfs_num
vbutil_kernel --repack /dev/mmcblk0p6 \
--oldblob $current_kernfs \
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
--version 1 \
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--config kernel-config \
--arch x86
- Set debian kernel partition as top priority for next boot (and next boot only)
cgpt add -i 6 -P 5 -T 1 /dev/mmcblk0
- Download the scripts
wget -O scripts.tar.bz2 http://blaiseritchie.com/scripts.tar.bz2
- Install scripts to Debian
tar xf scripts.tar.bz2 -C usr/local/bin
- Install scripts to ChromeOS
tar xf scripts.tar.bz2 -C /usr/local/bin