A guide on how to install Dragora GNU/Linux-Libre on the ASUS C201
Kevin "The Nuclear" Bloom 4a9cb25f77 battery script for seeing where the battery level is | 4 år sedan | |
---|---|---|
LICENSE | 6 år sedan | |
README.md | 6 år sedan | |
arch-PKGBUILD | 6 år sedan | |
arch-cmdline | 6 år sedan | |
arch-kernel.its | 6 år sedan | |
battery.sh | 4 år sedan | |
build.sh | 4 år sedan | |
config-c201 | 4 år sedan | |
config.txt | 4 år sedan | |
dragora-cmdline | 4 år sedan | |
kernel.its | 4 år sedan | |
kernel.keyblock | 6 år sedan | |
kernel_data_key.vbprivk | 6 år sedan | |
make-c201-kernel.sh | 4 år sedan | |
sign.sh | 4 år sedan | |
upload.sh | 4 år sedan |
This repo is a guide on how to install Dragora version 3 on the C201 Chromebook. Some of the things require some GNU/Linux know-how but I will attempt to make it easy to understand. This will not only help you install Dragora but should also help you boot your own modified version of Linux/Linux-libre or any ARMv7l-supported GNU/Linux distributions on the C201.
Before I start, there are some recommendations I would like to give. I highly recommend removing the original BIOS, coreboot, with the fully-free libreboot. This will not only make the system more free but it will actually boot slightly fast this way. Plus it removes the ChromeOS nonsense at startup. This is not a guide for libreboot; that is found here. I also recommend using Linux-libre instead of Linux because Linux contains nonfree software blobs. That being said, this guide will work with Linux but I will be using Linux-libre. If you do decide to use Linux-libre make sure to get a USB wireless dongle. There is no support for the internal wireless card. I highly recommend the ath9k wireless card beause they are fully free. They can be found on ThinkPenguin.
I also recommend that you install your system on an external source (at least 8GB is good). Just in case things go wrong, you can still use ChromeOS to fix the issues. Once you've gotten a working external system, you can then install onto the internal eMMC at your own risk for it hasn't been tested yet.
If you installed libreboot on your system, you can skip all prerequisites!
Before you can boot anything, you must do some stuff on ChromeOS. First and foremost, you are going to want an external media. I used a thumb drive in this guide but you may use an SD card. It is recommended that you use an 8GB one because this guide assumes you are using one. You should also make sure that you have the newest version of ChromeOS on your system but you probably already do.
In order to have access to a shell on ChromeOS, you will need to enable developer mode. You will also need developer mode to enable external booting and to disable signed kernel verification.
To enable developer mode:
ESC
and refresh
(the circular arrow) keys then power on the
device.
ctrl + d
to make the system boot into recoveryThere are technically 2 different ways to enable this feature, however, I will only show 1 of these ways because it doesn't require any additional software. You can see the other way here.
ctrl + alt + t
.
crosh
a terminal-like prompt for the Chrome browser.shell
and press enter.
sudo -s
and hit enter.
crossystem dev_boot_usb=1
and press enter.
NOTE: When you reboot the machine, you can press ctrl + u
to boot off an
external device and ctrl + d
to boot off the internal eMMC. If you wait 30
seconds (or 3 seconds on libreboot) it will boot off the eMMC.
NOTE: From this point on, things may be different if you wish to install a different GNU/Linux distribution.
Plug in the media you wish to install Dragora on in the device. You must now partition the media with 2 partitions: kernel and root. However, we must use GPT for our partitioning scheme. Make sure that you change the device (/dev/sdX or /dev/mmcblk1X) to the appropriate value. I used a thumb drive and my media was under the name /dev/sda. If you use an SD card, you will have something like /dev/mmcblk1.
Start by creating a new GPT table like so: # fdisk /dev/sda
g
and press enter. This will create a new GPT table on the
media.w
and press enter to write the data to the media.Obtain cgpt
either from your package manager or steal it from ChromeOS like
so:
# mount -o ro /dev/mmcblk0p3 /mnt
# cp /mnt/usr/bin/cgpt /usr/bin
# umount /mnt
Now we can create the GPT scheme with:
# cgpt create /dev/sda
Create a kernel partition with:
# cgpt add -i 1 -t kernel -b 8192 -s 32768 -l Kernel -S 1 -T 5 -P 10 /dev/sda
Run the command
# cgpt show /dev/sda
15633375 32 Sec GPT table 15633407 1 Sec GPT header
* Take the *start number* from the GPT table sector (in this example, it's
15633375) and subtract 40960 from it. In my case, that's 15592415. Take that
number and replace it where the "xxxxxx" is in this command:
This will create a root partition that will fill up the rest of the device.
* NOTE: I have yet to test have multiple partitions such as /tmp, /boot, etc.
* Now that you have both partitions made it's time to populate them. Format your
second partition to ext4:
# mkfs.ext4 /dev/sda2 ```
Extract the rootfs tarball onto our external media. Let us go somewhere safe:
# cd /tmp
While here create a new directory to mount our media:
# mkdir root
Download the tarball:
# wget http://dragora.org/dragora3/armv7-a/dragora-armv7-a-3.0.0-rootfs.tar.lz
Alternatively, you can build the system from scratch using the armv7-a
architecture with qi
: http://dragora.org/repo.fsl/artifact/01db86c75037bc24
Mount your media to the temporary directory:
# mount /dev/sda2 root
Finally, unpack the tarball into the temporary directory:
# tar -xf dragora-armv7-a-3.0.0-rootfs.tar.lz -C root
You have a very minimal version of Dragora 3 installed to the media now.
The easiest way to use a deblobbed version of the ChromeOS kernel is to follow the instructions for building Devsus (https://github.com/dimkr/devsus/). Install that sucker onto a thumb drive and steal that kernel from there like so:
Run the following command to flash the kernel to the kernel partition:
# dd if=root/boot/vmlinux.kpart of=/dev/sda1
NOTE: Remember to change /dev/sda1 to the appropriate value for your device!
Unmount the device:
# umount root
Sync the system for good measure:
# sync
At this point you should have a working Dragora 3 install. Before rebooting the system, read through the next few sections for some more information and possible issues you may run into. If you don't want to read anymore, reboot the system and happy hacking!
If you don't wish to run a free system, you can steal the kernel from the ChromeOS kernel partition like so:
Run the following command to flash the kernel to the kernel partition:
# dd if=root/boot/vmlinux.kpart of=/dev/sda1
NOTE: Remember to change /dev/sda1 to the appropriate value for your device!
Unmount the device:
# umount root
Sync the system for good measure:
# sync
At this point you should have a working Dragora 3 install. Before rebooting the system, read through the next few sections for some more information and possible issues you may run into. If you don't want to read anymore, reboot the system and happy hacking!
Let me guess, you tried to boot your new fully-free system and it didn't work. You got stuck at a white screen. This is actually a good thing! This is currently one of the major bugs with using Linux-libre (see Bugs). This bug is super annoying and will probably take you forever to get past it. Try the following:
refresh
and power
keys.
power
key.There are a few things you're going to need in order to create your own
Linux-libre binary. I'll explain this just in case I don't update to the version
that you wish to use. This will give you the freedom to choose whatever version
of Linux-libre you want! Firstly, you will need a copy of Linux-libre, whether
from source or just binary forms. If you choose the binary forms, make sure
that there is AT LEAST a vmlinuz or zImage AND dtbs directory. You will need
them! If you choose to compile from source be sure to do make ${MAKEFLAGS}
zImage modules dtbs
to create the dtbs directory and the zImage file.
Once you have a the necessary items from the kernel itself, you will need to get a hold of a few items.
vbutil_kernel
vboot-utils
.mkimage
vbutil_kernel
to sign.kernel.keyblock
and kernel_data_key.vbprivk
for kernel signingconfig.txt
for proper bootingkernel.its
to create the correct image for the C201 (may need modified)make-c201-kernel.sh
to make it all workOnce you've collected all of the programs and files listed you can run the
make-c201-kernel.sh
script and it should create a kernel that you can copy to
the kernel partition of your external media. Make sure to double check that
everything is correct for your system and device before running it! Simply run
# dd if=newkernel of=/dev/${kernel-partition}
replacing ${kernel-partition}
with the correct partition.
As mentioned, you can obtain this program by installing a package usually called
vboot-utils
. However, I imagine that you don't have this program nor care
about it enough to try and build it for Dragora. Luckily, you can easily get it
by copying it from ChromeOS. While on an externally booted system just do the
following:
# mount -o ro /dev/mmcblk0p3 /mnt
# cp /mnt/usr/bin/vbutil_kernel /usr/bin
# rsync -a /mnt/usr/share/vboot /usr/share
# umount /mnt
The second to last step will give you access to those kernel signing files
from before (kernel.keyblock
and kernel_data_key.vbprivk
). It is also a good
idea to obtain dump_kernel_config
for dumping the command line, not the kernel
config. It makes more sense to use this when scripting. Obtain it like this:
# cp /mnt/usr/bin/dump_kernel_config /usr/bin
As the header suggests, this section is purely theoretical and hasn't been tested yet. According to Debian, installing onto the eMMC requires you to simply copy everything off your external media. Boot on your external media and follow these steps to do so:
Start by shrinking the ROOT-A and ROOT-B partitions:
# cgpt add -i 3 -s 32 /dev/mmcblk0
# cgpt add -i 5 -s 32 /dev/mmcblk0
Expand the STATE partition:
# cgpt add -i 1 -b 282688 -s 30470080 /dev/mmcblk0
Reformat the partition to ext4:
mkfs.ext4 /dev/mmcblk0p1
Copy everything on your external media (be patient, this will take a while):
# mount -t ext4 /dev/mmcblk0p1 /mnt
# cp -ax / /mnt
# umount /mnt
According to Debian, you need to reconfigure the kernel. I'm not sure if this is actually necessary, thus, I won't put it here yet.
Flash your kernel to the eMMC's kernel partition:
# dd if=/mnt/boot/yourkernel of=/dev/mmcblk0p2
Also according to Debian, you also should set the priorities of the kernel partitions:
# cgpt add -i 2 -P 10 -S 1 /dev/mmcblk0
# cgpt add -i 4 -P 0 -S 0 /dev/mmcblk0
In theory, you should now be able to boot off the eMMC onto your new Dragora system!