linuxonastick

Shell script to easy install GNU/Linux on USB

chromebook-linux.com presents chrolin-usb! (Chromebook Linux USB) I wrote this set of shell scripts called chrolin-usb to easy install and boot GNU/Linux from your USB stick. Note that these scripts are just for Chromebooks*. * WARNING: this script will not work for CR-48 Chromebook, at least on this version Currently in version 1.3.1 you can install [...]

chromebook-linux.com presents chrolin-usb! (Chromebook Linux USB)

I wrote this set of shell scripts called chrolin-usb to easy install and boot GNU/Linux from your USB stick. Note that these scripts are just for Chromebooks*.

* WARNING: this script will not work for CR-48 Chromebook, at least on this version

Currently in version 1.3.1 you can install Debian 6.0.3, Ubuntu 11.04 and Gentoo simply executing a shell script to download the root filesystem and another script to copy to your USB drive. All the work as partitioning the USB, signing the kernel, copying the rootfs and Chrome OS kernel, copying the Chrome OS kernel modules… is done with this last script.

Basically, the process of these scripts is what I wrote on this post: http://www.chromebook-linux.com/2011/11/booting-gnulinux-distribution-from-usb.html

Here is the procedure how to install and run chrolin-usb.

Download chrolin-usb on your PC (requires GNU/Linux)

The scripts are hosted on this server, you need to run this scripts in your GNU/Linux system (and not inside your Chromebook).

You can download it here: http://files.chromebook-linux.com/chrolin-usb/chrolin-usb.tar.bz2

Or download with wget, open a console and type:

wget http://files.chromebook-linux.com/chrolin-usb/chrolin-usb.tar.bz2

Now, decompress the file:

tar -xjvf chrolin-usb.tar.bz2

This will generate a new folder called chrolin-usb, which contains some files and folders:

chrolin-usb.sh: the main script, to format partitions, kernel signing, installing on USB… makes all the stuff
get-debian-6.0.3.sh: script to download a prepared rootfs of Debian 6.0.3 for Chromebooks
get-ubuntu-11.04.sh: script to download a prepared rootfs of Ubuntu 11.04 for Chromebooks
get-gentoo.sh: script to download a prepared rootfs of Gentoo for Chromebooks
bugreport.sh: if you found a bug, please run this script and write down the bug you have found. This will send me your bug report

kernel_data_key.vbprivk: the private key to sign the Chrome OS kernel
config.txt: this file contains the set of parameters to pass to Chrome OS kernel
kernel-2.6.38.3.bin: this is the Chrome OS kernel 2.6.38.3+
2.6.38.3+: folder with Chrome OS kernel 2.6.38.3+ modules (to enable audio, wifi, etc.)

tools/cgpt: binary to create the Chrome OS partitions
tools/vbutil_kernel: binary to repack the kernel blob (with the parameters on config.txt)
builds: shell scripts as ‘get-debian-6.0.3.sh’ and ‘get-ubuntu-11.04.sh’ download the files on this folder

README: read this to quick install GNU/Linux on USB
CHANGELOG: modifications between versions
VERSION: text file with the your current version of chrolin-usb

Choose your GNU/Linux distribution to download

With the scripts get-debian-6.0.3.sh and get-ubuntu-11.04.sh you can download this prepared rootfs for Chromebook. It’s your choice, choose whatever you want and run the script.

To download Debian 6.0.3, open a console and run:

sh get-debian-6.0.3.sh

To download Gentoo, open a console and run:

sh get-gentoo.sh

If you want Ubuntu 11.04, then execute:

sh get-ubuntu-11.04.sh

And the script will download automatically the files, will take some time (5 GB in total, each one).

The files are splitted in some parts, but this script automatically unzip the parts, then merge and create a new file on the folder ‘builds’.

Run script ‘chrolin-usb.sh’

You have to known which device corresponds to your USB, this is pretty easy, just plug-in the USB and run this command in a console:

dmesg | tail

You will get something like: /dev/sdb or /dev/sdc, or /dev/sdg, that depends on your system. But you have to use the entire USB device which you have found and not a single partition on this device.

Again, if you’re unsure, please check that device is really your USB stick. Because if you wrong type your USB device, you will lose all data on this device! Remember that on GNU/Linux a command like: “dd if=/dev/zero of=/dev/sdX” is a beast and shows no mercy…

I’m going to assume that my USB device is /dev/sdg and I had succesfully downloaded Debian 6.0.3 using the downloader script, so now I’ve a rootfs binary on builds/debian_rootfs-6.0.3.bin

Then, installing Debian 6.0.3 to USB is easy as executing the script chrolin-usb.sh:

sudo sh chrolin-usb.sh -u /dev/sdg -i builds/debian_rootfs-6.0.3.bin

Confirm pressing ‘y’ key.

Then you will be prompted on how many space to reserve, so type how many GB want on your system, or just press enter to use the default value. The default value is calculated over the size of the rootfs you passed, if you want more space just type a bigger value but cannot exceed the size your total USB drive, of course.

Then wait until the process finishes.

And that’s all, now we’ve GNU/Linux Debian 6.0.3 installed on our USB. Put your Chromebook in developer mode, then plug-in the USB stick on your Chromebook and when the message: “Chrome OS verification is turned off” appears press the keys:

CTRL + U

This will boot from your USB and you should view your new GNU/Linux system running from USB!

Info about chrolin-usb parameters

If you run chrolin-usb.sh without parameters you should view this help menu:

– Chromebook Linux USB 1.3 –

http://www.chromebook-linux.com

Usage: sudo sh chrolin-usb.sh -u  -i  [-t ] [-b] [-k] [-f] 
-u Set USB drive to copy GNU/Linux. Ex: /dev/sdg 
-i Install the selected GNU/Linux root filesystem. Value: path with rootfs
-t Set type filesystem for the rootfs image. Optional. Default: ext2 
-b Set the block size to dd the files. Optional. Default: 4096 
-k Sign again the kernel and copy to KERN-A without installing the rootfs. Optional. Useful when change the kernel parameters 
-f Dont’ format data on KERN-A and ROOT-A partitions. Optional 

Example: sudo sh chrolin-usb.sh -u /dev/sdg -i builds/debian_rootfs-6.0.3.bin

Required parameters:
-u : set the USB drive to copy GNU/Linux.
-i : set the binary of your rootfs. Note that you can prepare yourself your own rootfs with VirtualBox (or similar) and put the path here.

Optional parameters:
-t : set the filesystem type of your rootfs. (ext2, ext3, ext4, …).
-b : set the blocksize used with ‘dd’ (to make the copy). By default is 4096 for improving the speed when copying to your USB.
-k: repack the kernel blob, but don’t copy the rootfs. This parameter is useful when you have your rootfs installed, but you want to change some parameters in your Chrome OS kernel. To do it: edit the parameters on config.txt file, and execute the script ‘chrolin-usb.sh‘ using this argument.
-f: don’t format data on KERN-A and ROOT-A partitions

Important notes

1. Running this script will format your USB drive, so make a backup of the content before!

2. By default kernel root argument is /dev/sdb2. This is the USB device in your Chromebook. You could have to change this value on config.txt to the desired USB device to boot in your Chromebook, but probably not. Just keep in mind.

Login and passwords

If you download Debian or Ubuntu with the downloader scripts, use this values to login:

Debian 6.0.3

Login: user
Password: chromebook
Root password: chromebook-linux.com
Note: for your convenience the user ‘user’ was added on /etc/sudoers, so open a terminal and change your root password using the command: sudo passwd root

 
Gentoo

Login: user
Password: chromebook
Root password: chromebook

 
Ubuntu 11.04 (is the version that made Jay Lee)

Login: user
Password: user
No root password

If you have any question, suggestion or problem please don’t hesitate to ask! :-)