Samsung Chromebook 2 XE503C32/Installing Linux
Contents |
Switching to developer mode
- Turn off the laptop.
- To invoke recovery mode, poke the Power key while holding the Esc and Refresh key.
- Once the recovery screen shows up, press the Ctrl and D keys.
- Confirm switching to developer mode by pressing the enter key. The laptop will now reboot and reset the system, this process will take about fifteen to twenty minutes.
If all went well, developer mode should now be enabled.
Note: if developer mode has been enabled, the Ctrl and D keys have to be pressed in order to boot from eMMC.
Disabling the verification
- Boot into ChromeOS and log into a session.
- In the Chrome browser, press the T key while holding the Ctrl and Alt keys. This will open up a crosh shell.
- Type 'shell' to get into a bash shell.
- Type 'sudo su' to become root.
- Type 'crossystem dev_boot_usb=1 dev_boot_signed_only=0' to enable USB-booting, and to disable boot verification.
- Reboot the system to allow the changes to take effect.
The laptop should now be able to boot from external media, such as SD-cards and USB-pens, when pressing the Ctrl and U keys. In addition to that, it will also be able to boot images that haven't been signed.
Partitioning
The following GPT partition lay-out is recommended:
- 1st partition: ChromeOS kernel partition.
- 2nd partition: root partition.
In order to set up the partition lay-out, one can use cgpt or gdisk. Here we'll be using cgpt:
cgpt create -z /dev/mmcblk1
cgpt create /dev/mmcblk1
export OFFSET=$(expr 8 \* 1024)
export SIZE=$(expr 64 \* 1024)
cgpt add -i 1 -t kernel -b $OFFSET -s $SIZE -l kernel -S 1 -T 5 -P 10 /dev/mmcblk1
export OFFSET=$(expr $OFFSET + $SIZE)
export SIZE=$(expr $(cgpt show /dev/mmcblk1 | grep "Sec GPT table" | tr -s " " | cut -f2 -d' ') - $OFFSET)
cgpt add -i 2 -t data -b $OFFSET -s $SIZE -l root /dev/mmcblk1
Now that the partition table has been written to the disk, the root partition can be formatted:
After the partition lay-out has been set up, you'll want to install a root filesystem onto the second partition.
Linux kernel
Start by cloning Google's latest release of their Linux 3.8 kernel, which is R40-6457.B at the moment of writing:
cd chromeos
Take the default configuration, and tweak it a bit (disable CONFIG_CC_STACKPROTECTOR and CONFIG_SECURITY_CHROMIUMOS):
CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm make menuconfig
After that you can build the kernel image, the modules and the device tree:
CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm make modules
CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm make dtbs
Mount the root partition, and install the modules:
mount /dev/mmcblk1p3 /mnt/extern CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- ARCH=arm INSTALL_MOD_PATH=/mnt/extern make modules_install umount /mnt/extern
Then we can bundle up the kernel and the device tree into a FIT-image. Download kernel.its and save it as kernel.its in chromeos/arch/arm/boot (in the kernel repository you cloned before). After you have saved the kernel.its file, you can bundle up the kernel and device tree:
mkimage -f arch/arm/boot/kernel.its vmlinux.uimg
The FIT-image then has to be signed using the developer keys. The vbutil_kernel utility will do that for us. In addition to signing the image, it is also possible to add a kernel cmdline to the image. We'll be using /proc/cmdline as a template:
Open up kernel-cmdline, and change the rootfs arguments to: "root=/dev/mmcblk1p2 rootfstype=ext4 rootwait rw"
Now that the kernel-cmdline has been set up, we can sign the image:
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--arch arm \
--version 1 \
--config kernel-cmdline \
--vmlinuz vmlinux.uimg \
--pack chromeos-3.8-R40-6457.B.kpart
Finally, we can write the signed kernel image to the kernel partition: