The chroot method is not suitable in my view for a serious Debian rootfs installation, as you'll bump into restrictions imposed by the ChromeOS chroot. For example, installing a CUPS network printer in the chroot is a major headache... you'll be wasting a lot of time chasing solutions to this and similar problems.
Better in that case to run the Debian rootfs directly on the hardware, with its own kernel. Initially, as described in this HOWTO, that will be a copy of the ChromeOS kernel, but this could eventually also be a Debian kernel configured for this Chromebook's hardware and firmware.
This HOWTO describes installing the Debian rootfs on external storage, which gets around the size limitations of the internal SSD. This can be an SDHC card, which is what I'm using in what follows, but a USB-3 hard disk (or even an SSD!) is also a good alternative. You'll need at least a 16 GB SDHC card for a full Debian rootfs, I used 32 GB. The kernel to go with the Debian rootfs will be put on the internal KERN-C partition, which only needs a measly 16 MB; I've found this to be faster than putting it on the external SDHC card. Unfortunately, an external USB-3 drive (which would be faster still) is not bootable with the current firmware of the Samsung ARM Chromebook.
The armhf architecture is relatively new to Debian, having just made it into the current (2013) stable release (Wheezy). Not all packages have yet been ported to Wheezy, so installing unstable (Sid) may be the preferred option -- hence the title of this HOWTO. There were some problems with Sid at the time of writing this revision, so I installed a Wheezy rootfs instead. A few necessary packages not in Wheezy can be installed from Sid as the need arises.
All commands in the following are to be run as root, both in Linux and in ChromeOS.
1. Install the Debian rootfs
This is mainly done on a running Linux box.
1.1 Prepare the SDHC
Connect the SDHC to the Linux box and install a GUID partition table (GPT) on it, for example with gparted. This will wipe the entire storage device, so the usual disclaimers about first backing up its contents apply. Still in gparted, install an Ext2 Linux partition for the Debian rootfs (I used all free space on the 32 GB SDHC). N.B. Use Ext4 if you're not concerned about frequent journal writes...
When done, mount that partition somewhere convenient, like
Code: Select all
# mount -o dev,exec /dev/mmcblk0p1 /mnt
1.2 Prepare the Debian rootfs
Still on the Linux box, with your SDHC card mounted as shown above, perform a first-stage debootstrap installation with
Code: Select all
# debootstrap --verbose --arch=armhf --foreign wheezy /mnt http://<your.preferred.mirror>/debian/
The debootstrap is completed when chrooted to the new rootfs, for which the packages qemu-user-static and binfmt-support must be available on the Linux host OS. The chroot is prepared and entered as follows:
Code: Select all
# cp /usr/bin/qemu-arm-static /mnt/usr/bin/
# mkdir /mnt/dev/pts
# modprobe binfmt_misc
# mount -t proc /proc /mnt/proc
# mount -t devpts /dev/pts /mnt/dev/pts
# chroot /mnt
Next, in the chroot, complete the installation of the base system with
Code: Select all
# /debootstrap/debootstrap --second-stage
1.3 Configure the rootfs
It is convenient, while still in the chroot, to configure at least the base system. First, edit /etc/apt/sources.list for your version of Debian using your mirror of choice, and
Code: Select all
# aptitude update
Code: Select all
# export LANG=C
# aptitude install dialog locales
# dpkg-reconfigure locales
Code: Select all
# export LANG=en_US.UTF-8
Edit /etc/network/interfaces for wireless access on the Chromebook by adding
Code: Select all
auto mlan0
iface mlan0 inet dhcp
wpa-ssid <SSID>
wpa-psk <passphrase>
Finally, fix passwords, user and hostname with
Code: Select all
# passwd
# adduser <user>
# vi /etc/hostname
Code: Select all
127.0.1.1 <your-hostname>
2. Prepare the Chromebook
We must enter development mode, repartition the internal SSD, and install a kernel to the KERN-C partition.
2.1 Enter development mode
Enter development mode by keeping the Esc and Refresh (swirl) keys depressed while powering the Chromebook on. Next, in a "scary" screen with dire warnings, hit Ctrl-D and follow instructions. This procedure will take a while.
Wait after a reboot for the login screen to appear, then enter a Linux root shell with Ctrl-Alt-Right (where Right is the right arrow in the top row). Alternatively, obtain a Linux root shell from the "crosh" window after logging in.
The Chromebook will remain in developer mode for dual-booting; new developer firmware will not be pushed in developer mode, so it may be necessary to update this manually in a root shell with
Code: Select all
# chromeos-firmwareupdate --mode=todev
Should one ever wish to return to normal user mode, then before doing so a regular firmware update is recommended,
Code: Select all
# chromeos-firmwareupdate --mode=tonormal
2.2 Repartition the internal SSD
Show the current partition table with
Code: Select all
# cgpt show /dev/mmcblk0
KERN-C must be given size 32,768 taken from the end of STATE, leaving Y - 32,768 (= 22,040,576 in my case) sectors for STATE. The expanded KERN-C will then start at sector X + Y - 32,768 (= 8,671,232 + 22,040,576 = 30,711,808 in my case). You need to compute these figures for your case.
First, repeatedly unmount the STATE partition (since it is multiply mounted), with
Code: Select all
# umount -l /dev/mmcblk0p1
Code: Select all
# cgpt add -i 1 -b 8671232 -s 22040576 -t data -l STATE /dev/mmcblk0
# cgpt add -i 6 -b 30711808 -s 32768 -t kernel -l KERN-C /dev/mmcblk0
3. Install kernel and modules/firmware
Enter a root shell on the Chromebook and insert the SDHC with the Debian rootfs -- it will be recognized as /dev/mmcblk1p2.
3.1 Install the kernel
Use an editor to put a suitable kernel command line in the temporary file /tmp/config
Code: Select all
console=tty1 debug verbose root=/dev/mmcblk1p1 rootwait rw lsm.module_locking=0
Find the current kernel version with
Code: Select all
# uname -r
Code: Select all
# cgpt show /dev/mmcblk0
Code: Select all
# dd if=/dev/mmcblk0p4 of=/tmp/oldblob
Code: Select all
vbutil_kernel --repack /tmp/newkern \
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
--version 1 \
--signprivate \
/usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--config=/tmp/config \
--oldblob /tmp/oldblob
Code: Select all
# sh /tmp/repack
Code: Select all
# dd if=/tmp/newkern of=/dev/mmcblk06
Code: Select all
# cgpt add -i 6 -S 1 -P 5 /dev/mmcblk0
3.2 Copy modules and firmware to Debian rootfs
Mount the SDHC for convenience on the new mount point /tmp/debian, then
Code: Select all
# cp -ar /lib/firmware /tmp/debian/lib/
# cp -ar /lib/modules /tmp/debian/lib/
# cp -ar /usr/share/alsa/ucm /tmp/debian/usr/share/alsa/
# cp -ar /usr/bin/alsaucm /tmp/debian/usr/bin
# chmod 755 /tmp/debian/usr/bin/alsaucm
We can now reboot with our new Debian rootfs.
4. Booting with the Debian rootfs
Reboot into that scary screen and hit Ctrl-D to boot the priority kernel, which for the Debian rootfs should be KERN-C.
4.1 Do this first...
Only after the first boot and with the ALSA packages installed (perhaps as part of the desktop environment) configure the sound card with
Code: Select all
# alsaucm -c DAISY-I2S set _verb HiFi
We also need to edit the new file 50-touchpad.conf in directory /etc/X11/xorg.conf.d (making directories as needed) with content
Code: Select all
Section "InputClass"
Identifier "Touchpad"
MatchIsTouchpad "on"
Option "FingerHigh" "5"
Option "FingerLow" "5"
EndSection
4.2 Install cgpt from Sid
We need the cgpt package in order to be able to boot ChromeOS again. Unfortunately, the cgpt package didn't make it in Wheezy, so download it from the Sid repositories for the armhf architecture instead. There are no dependency problems, so just install it with
Code: Select all
# dpkg -i cgptxxxxxxxxx_armhf.deb
Code: Select all
#!/bin/sh
## (Re)boot Chromebook with ChromeOS.
## Usage: chromeboot [now]
## to be run with root privileges.
cgpt add -i 6 -S 1 -P 0 /dev/mmcblk0
case "$1" in
now* ) echo "Will reboot ChromeOS now..."
sleep 3
reboot ;;
* ) echo "Will boot ChromeOS on next (re)boot..." ;;
esac
Code: Select all
# chmod 744 <path-to-script>
The 3rd post in this thread contains some pointers on how to get the screen brightness and audio volume buttons to work as intended.
Enjoy!
Credits: I found the http://linux-sunxi.org/Debian site helpful, as well as blogs by Andrew Wafaa and Marcin Juszkiewicz. The vbutil_kernel help page was, well, helpful as well...