Skip to content

Instantly share code, notes, and snippets.

@EmbeddedAndroid
Last active July 13, 2018 08:07
Show Gist options
  • Save EmbeddedAndroid/54d6a7f8a8f13e8fdf71 to your computer and use it in GitHub Desktop.
Save EmbeddedAndroid/54d6a7f8a8f13e8fdf71 to your computer and use it in GitHub Desktop.
nv-uboot on Chromebook2
1) Enter Developer Mode
Disclaimer. I will take no responsibility if you somehow brick your chrome book. You should only attempt the following if you are familiar with embedded system hackery :)
With the laptop turned off, hold down the escape and refresh keys, then press the power key
The device is now in Recovery Mode, pressing Ctrl-D will enable Developer Mode.
Confirm the action by pressing Enter.
On the next boot of the laptop press Ctrl-D once again on the OS verification is OFF screen.
The laptop will then start preparing itself for Developer Mode. Every time you turn on the device press Ctrl-D to boot the default installation of Chrome OS.
2) Prepare SD card
DEV=/dev/sdb (Make sure this is your SD card device, as this is just an example)
# Create a fresh GPT label on the SD card
parted $DEV mklabel gpt
# Create first kernel partition (A) (16MB)
cgpt add -b 8192 -s 32768 -t kernel -l "KERN-A" $DEV
# Create second Kernel parition (B) (16MB)
cgpt add -b $((8192 + 32768)) -s 32768 -t kernel -l "KERN-B" $DEV
# root fs, remainder 15523807 is where my 8G sdcard had the start of the
# secondary gpt partition. Use cgpt show /dev/mmcblk0 to check
cgpt add -b $((8192 + 32768 + 32768)) -s $((15523807 - (8192 + 32768 + 32768))) -t rootfs -l "root" $DEV
# Tell the bootloader to boot from the first parition
cgpt add -i 1 -T 2 -P 10 -S 1 $DEV
3) Burn nv-uboot
# For the peach-pi download this nv-uboot
https://drive.google.com/file/d/0B9DbsE2BbZ7ubUxHOUduTFlpeFk/edit?usp=sharing
# Burn nv-uboot to the sdcard
DEV=/dev/sdb (Make sure this is your SD card device, as this is just an example)
PART=1
dd if=images/nv_uboot-peach-pi.kpart of=${DEV}${PART}
4) Install rootfs
# Mount partition three
mkdir tmp
mount /dev/sdb3 tmp/
# Debootstrap filesystem
debootstrap --arch=armhf sid tmp/ (I did this on an ARM platform so use you are on a different architecture you will need to use the --foreign flag)
# Setup the console
echo T0:23:respawn:/sbin/getty -L ttySAC3 115200 vt102 >> /etc/inittab
echo >> /etc/securetty
echo ttySAC3 >> /etc/securetty
# Download the kernel image or build the kernel image
https://drive.google.com/file/d/0B9DbsE2BbZ7uMVRXbUZVSDZyQWM/edit?usp=sharing
https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-3.8
# Install kernel image onto / of root file system
cd tmp/
cp /path/to/uImage .
# Umount filesystem
umount tmp/
4) Insert card into SD slot on Chromebook2 and boot nv-uboot
# Power on
# Ctrl-U to launch nv-boot
5) Configure nv-uboot
# Set bootfile name
setenv bootfile uImage
# Load kernel
ext2load mmc 1:3 ${loadaddr}
# Set kernel arguments
setenv bootargs console=tty1 root=/dev/mmcblk1p3 rw
# Boot it!
bootm ${loadaddr}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment