Labels

administration (2) advocacy (1) arm (1) artist (1) author (1) bash (1) biology (1) birthday (2) book (1) caleb (2) comedy (1) command line (1) computer (1) configuration (3) convention (1) cooking (1) customer service (1) debugging (1) desktop (1) emotion (1) equality (2) essay (1) exercise (1) family (1) fedora (14) festival (1) food (3) free software (1) ftl (1) gaming (7) gay (2) git (5) gnome (1) google (3) gripes (1) hacking (1) hardware (4) health (1) hiking (1) holiday (2) homosexuality (3) humor (1) kde (1) kernel (2) keyboard (1) kindle (4) laptop (3) linux (23) marriage (1) movie (2) music (3) mutt (1) news (1) online (1) open source (1) opinions (2) packaging (2) perl (1) philosophy (1) phishing (1) phone (2) physics (1) podcasting (3) politics (1) present (1) problem (2) programming (19) rachel (2) rails (1) RIchard Feynman (1) rights (1) rpm (1) ruby (8) rumor (1) school (2) science (4) search (1) seasons (1) security (1) space (1) subversion (3) super heroes (2) systemd (1) technology (1) television (1) test driven development (1) university (2) update (1) upgrade (1) utility (1) video (1) virtual machine manager (1) virtualization (2) weekend (1) work (1) zombies (1)

Tuesday, February 5, 2013

Loading Fedora On A Samsung Chromebook

Overview And Goals

The goal is to describe how to boot and run Fedora Linux on a Samsung Chromebook. Lots of thanks go to Chris Hewitt for laying the foundation for this page.

Equipment & Software

Hardware: Samsung Chromebook XE303C12 (ARM Exynos 5 processor)
Storage: Sandisk 32G card, which identifies as /dev/mmcblk0 (substitute your own drive's device in the instructions below)
Fedora Image: The generic hardware floating point image from here (or click here to download the image now).

Preparing The Disk

The first thing to do is to prepare the SD card. What we want to do is create two partitions for the kernel images and a partition for holding the root filesystem for Fedora.

You don't need a lot of space for the kernel images, so two 15MB partitions are find. You can either leave the remaining space for the root file system. Or, if you want to keep /home separate to protect it in case you have to redo the rootfs, you can create a fourth partition for the home file system. The latter is how I do things.

Partition The Drive

To partition the drive, first create the GPT partition table:

sudo gdisk /dev/mmcblk0
(parted) mktable gpt
(parted) w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/mmcblk0.
The operation has completed successfully.



Next you need to create the individual partitions. As Chris did, I'll just post what you need to type to create the partitions since it can be VERY verbose otherwise. Here we configure the geometry for the disk:

sudo gdisk /dev/mmcblk0

x # go into extra functionality/expert mode
l # set the sector alignment value
8192 # 8192 bytes
m # return to the main menu



Now we create the partitions. We'll create two 16MB partitions to hold the kernels from the Chromebook, a 15G partition for the root file system and use the remaining space for a home filesystem. If you don't want to have a separate home filesystem, then follow the instructions inline:

n # creates a new partition
1 # partition 1
(ENTER) # accept the default starting sector
+16M # make partition 1 16MB
7f00 # make the partition type "ChromeOS kernel"

n # creates a new partition
2 # partition 1
(ENTER) # accept the default starting sector
+16M # make partition 1 16MB
7f00 # make the partition type "ChromeOS kernel"

If you want the root filesystem to use the rest of the disk, then do this:

n # another partition
3 # partition 3
(ENTER) # accept the default starting sector
(ENTER) # go to the end of the free space
(ENTER) # use the default file system type

What I did was this:

n # another partition
3 # partition 3
(ENTER) # accept the default starting sector
+15G # make the root filesystem 16G
(ENTER) # use the default file system type

n # another partition
4 # partition 4
(ENTER) # accept the default starting sector
(ENTER) # go to the end of the free space
(ENTER) # use the default file system type

When it's all done, you need to update the disk:
w # writes the changes to disk

Format Root And Home

Now format the filesystems. Again, if you didn't create a home filesystem, then don't format it. And BE CAREFUL when specifying the device to format!

For me /dev/mmcblk0p3 is the root file system, while /dev/mmcblk0p4 is the home file system.

sudo mkfs -t ext4 /dev/mmcblk0p3
sudo mkfs -t ext4 /dev/mmcblk0p4

Extracting The Fedora Image

Now that you have a prepared disk, you need to first mount the file system and then extract the Fedora root filesystem onto it.

First thing is to mount the root filesystem:

sudo mount /dev/mmcblk1p3 /mnt


Now extract the file containing the image that you downloaded from Fedora:

sudo tar Jxvf Fedora-18-armhfp-rootfs.tar.xz -C /mnt

Fixing /etc/fstab In The Image

You'll want to now update the /etc/fstab file in the new image, comment out the existing entries and add a single one:

/dev/mmcblk1p3 / ext4 defaults 1 1

Using UUIDs Instead Of Device IDs

Thanks to Steve Falco for this.

To use the UUIDs, use the following command line:

dumpe2fs /dev/sdf3 | grep UUID

and then replace the UUIDs for each partition in /etc/fstabs with thes shown.

Installing The Chromebook Kernel

There is work being done to get a Fedora kernel to install on the Chromebook. But, for now, you have to work with the one that came with the Chromebook itself. To do this, you need to boot up your Chromebook into developer mode. To do this, hold down both the Escape and Refresh keys and press the Power button. When the system reboots it will say "To turn OS verification OFF, press ENTER".

Do this.

The system will then tell you that OS verification is off. This puts your Chromebook into developer mode. Don't get worried when it says your local data is being cleared, this is normal. You'll be able to dual boot your system, booting either Fedora from the SD card or ChromeOS from the SSD. It will take about 15 minutes or so to wipe the data, so be patient.

Once the system has finished clearing your data and restarting, it will reboot and show you a screen that says, "OS verification is OFF". Press Ctrl+D to boot the system at this point.

Log into the system (you will need to recreate your account). Once into the system, type Ctrl+Alt+T to launch a crosh box. Then type:

crosh> shell

Then type:

chronos@localhost / $ sudo -s 

Now lets create some bootable images!

To create a bootable image, which we'll copy to our two boot partitions, type the following:

 cd /tmp 

echo "console=tty1 debug verbose root=/dev/mmcblk1p3 rootwait rw lsm.module_locking=0" > /tmp/config vbutil_kernel --pack /tmp/newkern --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/tmp/config --vmlinuz /boot/vmlinuz-3.4.0 --arch arm  

 Now we need to copy that image onto our two boot partitions and enable booting from it. To do that, type the following:

dd if=/tmp/newkern of=/dev/mmcblk1p1 

dd if=/tmp/newkern of=/dev/mmcblk1p2 

crossystem dev_boot_usb=1

It's okay if you see the message "Unable to open FDT property nonvolatile-context-storage". Apparently this happens to everybody and is not a sign that something's gone wrong.

To mark the partitions as bootable, type:

cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/mmcblk1 

cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B /dev/mmcblk1

Copy the kernel firmware and libraries onto the new root filesystem.

Notice that I'm using "External Drive 3" here. That's because I'm using a separate filesystem for /home. If you went with just a single filesystem then you'll use "External Drive 2" here.

Again thanks to Steve Falco for pointing out that, in some cases, these drive letters might be reversed or different. Be sure, us ls to check both External Drive mounts to see which contains the actual root file system for Fedora.

After copying the files, you'll remount the partition and chroot it to isolate our new Fedora root filesystem:

cp -rf /lib/modules/* /media/removable/External\ Drive\ 3/lib/modules/ 

cp -rf /lib/firmware/* /media/removable/External\ Drive\ 3/lib/firmware/ 

mount -o remount,suid,exec /media/removable/External\ Drive\ 3/ 

chroot /media/removable/External\ Drive\ 3/

Next we will set a password for root, and then create the GUEST account. Don't try to create a normal user account at this point:

passwd adduser guest 

exit 

umount /media/removable/External\ Drive\ 3/

Now you're ready to boot your Chromebook into Fedora!

Booting Your Chromebook Into Fedora

Reboot the Chromebook. On the screen where it says OS verification is turned off, now you will type Ctrl+U to boot from the SD card. You should see the standard Fedora booting output which means you've successfully install Fedora. Once the system has booted, if you created a separate file system for /home, you can log in as guest, su to root, add the file system by UUID, then create a proper user account. Any feedback on these instructions, about how to fix problems that come up or how to make them more efficient, please send them to me or post them below as comments.