[ARMedslack] slackware-arm on chromebook

Ottavio Caruso ottavio2006-usenet2012 at yahoo.com
Wed May 8 14:31:29 UTC 2013


On 31 January 2013 01:59, james_ozone <ozone at cname.com> wrote:
> Greetings. Some google searching tells me you're the only one who has
> installed slackware on a chromebook, and now that I've finally seen the
> hardware, I want one too.
>
> Do you have something more current than the "interim" (now missing) docs?
> Would you like some help?

I've managed to recover my very first template for the installation of
Slackware onto the Samsung Chromeboook. It contains many errors and
originally it was meant for a USB flash drive, then I installed it on a SD
card. Unfortunately the final document has gone lost forever.

Attached in case anybody finds it useful

-- 
Ottavio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.armedslack.org/pipermail/armedslack/attachments/20130508/ac7391d6/attachment-0001.html>
-------------- next part --------------
?Stimulated by Olof Johansson?s post:
https://plus.google.com/u/0/109993695638569781190/posts/b2fazijJppZ




I have decided to venture in the epic task of running the Slackwarearm (formerly known as Armedslack) on my new little shiny Samsung Chromebook. 


Don?t get me wrong: I really love Chrome OS. I love it so much that now it has become my main operating system, but I have used Slackware on Intel for a few years and I wanted to replicate my happy experience on the ARM architecture.


Limitations:
1. This is not a proper port of Slackware for the Chromebook. It?s a cheap hack made by a non IT professional with too much time on his hands. A proper port would only happen if and when native kernel, module and firmware packages are available in the Slackwarearm tree. It might happen, it might not happen and it won?t be me to do the job.
2. The whole process is not very user-friendly, actually it was a massive pain for me with my limited skills. At the moment the system is barely usable but it does work. It boots all right, can acquire a proper and decent wireless connection and can be expanded downloading more packages from the Slackwarearm tree. I haven?t tested sound and video but I plan to do so once I have a proper graphical environment.
3. At the moment I haven?t replicated the installation on a SD card. Some commands might differ and you have to be extra careful when you mess with creating and deleting partitions and you might get rid of important data.
4. This document assumes that you are familiar with running the Chromebook in developer mode, that you have some experience with Slackware and the command line and have an understanding of the Slackware philosophy (What? No dependency resolution?)


If the bullet points above don?t ring any bell, please don?t mess with your Chromebook as you risk to make it unusable and invalidate the warranty (yes, you could always reflash the device, but...)


Before you start, familiarize yourself with these documents:
http://www.chromebook-linux.com/2011/11/booting-gnulinux-distribution-from-usb.html
https://plus.google.com/u/0/109993695638569781190/posts/b2fazijJppZ
https://plus.google.com/u/0/109993695638569781190/posts/34PYU79eUqP
http://www.armedslack.org/introduction/


Still awake and willing to take risks? Let?s go!


Insert a flash drive at the back of your Chromebook. It?s a safe option to plug it into the standard USB2 port. Once plugged in, the Chrome file manager will appear and will automatically mount the USB device on the left pane, just under the Downloads and the Google Drive folder. Right click on USB drive and select ?Eject device?.


Press CTRL+ALT+T and type:


shell
sudo su


Don?t use ?sudo bash?, you are going to have problems when chrooting to the slackware partition.


Type:
dmesg|tail


You will see an output similar to this:


[10730.135107] sd 1:0:0:0: [sda] Asking for cache data failed
[10730.135120] sd 1:0:0:0: [sda] Assuming drive cache: write through
[10730.135130] sd 1:0:0:0: [sda] Attached SCSI removable disk


Your flash drive will be identified as /dev/sda


You can?t use fdisk on this device as you need a GUID Partition Table (GPT), therefore you need ?parted?. Strictly speaking you could use the Chrome OS native tool ?cgpt? but I find parted a bit more user-friendly (I?m not joking).


[TODO: expand the alignment and ext4 options, ref:
http://www.styryx.com/en/computers/operating-systems/unix-linux/linux-installation-to-usb-flash
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=9&t=850
http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/
]


[libparted library
The libparted library powers many Linux partitioning tools that support file system manipulation. Through version 2.1, the text-mode GNU Parted program (command name parted) provides little support for aligning on anything but cylinder boundaries. The best approach may be to type unit s to change the default unit to sectors. You can then manually enter partition start points in sectors and verify partition start points precisely.
Version 2.2 has begun a transition toward a policy that's more useful for disks with 4096-byte physical sectors. With this version, you can specify a starting value of 1M and the sector will be properly aligned. This version also warns you when your partitions are not properly aligned.
]


A little breakdown of the commands:
[TODO: replace parted with cgpt]


parted -a optimal /dev/sda




Then at the parted prompt


(parted) mktable gpt                                                      
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?Yes/No? Yes    
[TODO: this needs to be redone completely]
(parted) unit MiB


   http://en.wikipedia.org/wiki/Mebibyte




Create a small 17 MiB partition for the kernel starting at 1 MiB (melibytes, not megabytes)
(parted) mkpart primary ext4 1 16   





Then reuse all the remaining space for the root partition:
(parted) mkpart primary ext4 16 -1 
?-1? means until the last sector.


(parted) unit s                                                           
(parted) print                                                            


Number  Start   End       Size      File system  Name    Flags 1      
4096s   30719s    26624s                 KERN-A 2      
32768s  1998847s  1966080s  ext4         ROOT-A


make sure it starts at 4096s ???????


Umount the drive again as the Chromebook has this annoying habit of mounting drives when a new filesystem has been added. Duh!


??????? Don?t worry about the labels given to the partition, they will be overridden later.


As ?mkpart? does not really create a filesystem, you?ll have to do it manually only on the root partition:


mkfs.ext4 /dev/sda2


Don?t worry creating a filesystem on /dev/sda1.


Now it?s time to install the Slackware ARM mini root filesystem.


Point your Chrome browser to:
http://www.armedslack.org/getslack/

Scroll down to the end of the page and select a mirror.


I have selected http://ftp.slackware.org.uk/slackwarearm/ which will form the base url of the Slackware tree.


Navigate into the slackwarearm-devtools/minirootfs/ directory. Make sure that you bookmark or save the README.txt file.   


Now change into roots/ and download the latest minirootfs, which at the moment of writing is slack-14.0-miniroot_27Sep12.tar.xz


Bookmark or save also the slack-14.0-miniroot_details.txt file.


Go back to  slackwarearm-current/slackware/ap/   and download the latest slackpkg package, at the moment: slackpkg-2.82.0-arm-3.tgz.re        


Mount the second partition:


mount /dev/sda2 /media/removable/


As per the README.txt file that you have previously bookmarked or saved, unpack the mini root into /mnt/removable:


tar -xf /home/chronos/user/Downloads/slack-14.0-miniroot_27Sep12.tar.xz -C /media/removable/


Mount /tmp, /proc, /sys and /dev, copy some files over and chroot:


mount --bind /tmp/ /media/removable/tmp/
mount --bind /proc/ /media/removable/proc/
mount --bind /sys/ /media/removable/sys/
mount --bind /dev/ /media/removable/dev/
cp /etc/resolv.conf /media/removable/etc/resolv.conf
cp /home/chronos/user/Downloads/slackpkg-2.82.0-arm-3.tgz /tmp
chroot /media/removable/


Switch off syslog:
chmod -x /etc/rc.d/rc.syslog


nano /etc/inittab

and comment the first line beginning with "s0":

    # Local serial lines:
    s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100


nano /etc/securetty


and comment the first line starting with ttyS0


Change the root password and add a local user with adduser. Don?t forget to add yourself to the additional users or you won?t be able to have sound, print, add devices and so on. 


Wipe out all  kernel related packages:
removepkg /var/log/packages/kernel*


mkdir /lib/modules 


Temporarily exit from chroot and copy over the contents from /lib/modules and /lib/firmware


cp -pr /lib/modules/* /media/removable/lib/modules/
cp -pr /lib/firmware/* /media/removable/lib/firmware/


Re-enter chroot and:


installpkg /tmp/slackpkg-2.82.0-arm-3.tgz


Edit /etc/slackpkg/slackpkg.conf and /etc/slackpkg/mirrors to your taste.

Run:


slackpkg update


Ignore the errors and:


slackpkg install gnupg ncurses


Don?t worry about the frames not displaying properly. Try to live with it, the problem will be fixed once you boot into the real system.


Update the gpg key:


slackpkg update gpg


Install a minimal set of packages, just enough to give you a wireless connection:


slackpkg install wireless-tools wpa_supplicant libnl3


I assume you are using WPA authentication on your router, otherwise please refer to the Slackware wiki:
http://docs.slackware.com/slackbook:wifi


nano /etc/wpa_supplicant.conf


You will have to add this snippet of code if you use WPA-PSK:


network={
     ssid="my-router-ssid"  
     key_mgmt=WPA-PSK  
     psk="my-router-passphrase" 
 }


[TODO: change mount points]


nano /etc/fstab


This is my recommended file system table:


proc            /proc           proc    defaults                0       0
tmpfs            /dev/shm    tmpfs       defaults            0       0
tmpfs            /tmp           tmpfs       defaults            0       0
/dev/sda2       /               ext4    errors=remount-ro 0       1


Exit the chroot and copy the Chromebook mount points in case we are going to mount some partitions from within Slackware:


exit
cp /etc/fstab /media/removable/root/chromeos-fstab
mount > /media/removable/root/chromeos-mount-points






unmount everything:




umount /media/removable/proc/
umount /media/removable/tmp/
umount /media/removable/sys/
umount /media/removable/dev/
umount /dev/sda2


Now we are going to pack a kernel that will be flashed over the first partition. This command will generate the kernel command line:


echo "console=tty1 debug verbose \
root=/dev/sda2 rootwait ro" > /tmp/config 


Now I suggest to make a second config file with the read-write flag on the kernel


echo "console=tty1 debug verbose \
root=/dev/sda2 rootwait rw" > /tmp/config.rw


The reason for this as I had problems booting the first time with the ?ro? flg. More on this later.


This command will create newkern as the binary image and sign it with the verified boot tools:


vbutil_kernel --pack /home/chronos/user/Downloads/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


Also create a second kernel image with the ?rw? flag so that you can use this if you have problems booting the first kernel:


vbutil_kernel --pack /home/chronos/user/Downloads/newkern.rw \
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
--version 1 \
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
--config=/tmp/config.rw \
--vmlinuz /boot/vmlinuz-3.4.0 --arch arm


In my experience I had to write out the kernel with the ?rw? flag to the first partition first in order to make it work:


dd if=/home/chronos/user/Downloads/newkern.rw of=/dev/sda1


Output:
7240+0 records in
7240+0 records out
3706880 bytes (3.7 MB) copied, 3.7376 s, 992 kB/s


Verify the current kernel on the disk:


vbutil_kernel --verify  /dev/sda1




Key block:  
Size:                0x4b8  
Flags:               7  !DEV DEV !REC  
Data key algorithm:  4 RSA2048 SHA256  
Data key version:    1  
Data key sha1sum:    d6170aa480136f1f29cf339a5ab1b960585fa444
Preamble:  Size:                0xfb48  
Header version:      2.0  
Kernel version:      1  
Body load address:   0x100000  
Body size:           0x379000  
Bootloader address:  0x479000  
Bootloader size:     0x0
Body verification succeeded.






The final step is to mark the partition on the USB stick as known good so
that the firmware will try to boot it. I have tried many different permutations and this is the one that worked for me: 


cgpt add -i 2 -S 1 -T 5 -P 5 -t kernel -l KERN-A /dev/sda


A breakdown of this command: for partition index 1 (/dev/sda1), mark it as successful, priority to 5 and tries to 5. Typing:


cgpt show /dev/sda


should give ?Type: ChromeOS kernel? for partition 1, otherwise you have done something wrong.


Now, enable booting from "USB":


crossystem dev_boot_usb=1


You only perform this command once. You?ll more than most likely get this error:


Unable to open FDT property nonvolatile-context-storage


Just ignore it.


Then reboot. At the developer mode screen press CTRL+U to load the kernel and boot from the USB stick.


Fingers crossed, now you should have a familiar boot sequence and a login prompt.  What I have done at this point is to reboot the Chromebook into Chrome OS and rewrite out the kernel with the ?ro? flag to the first partition and reboot again:


dd if=/home/chronos/user/Downloads/newkern of=/dev/sda1


But you might be luckier at skipping this part.


So let?s go back to the login prompt. As root run:


ifconfig mlan0 up
wpa_supplicant -c /etc/wpa_supplicant.conf -i mlan0 -d


Test if it works, you should see a long stream of data and a reference to  ?CONNECTED?


Press CTRL+C to kill the process and restart it in the background:


wpa_supplicant -c /etc/wpa_supplicant.conf -i mlan0 -B
dhcpcd mlan0


Where to go from here? Now that you have a proper internet connection you should at least install the a, ap, f and n series:


slackpkg install a ap f n


But you probably want a full graphical environment, in which case you need the l, x and xap series. I advise against installing the Kde environment but you might well need some individual packages from the kde and kdei series. If you need to build packages from sources you also need all the D (development) package series.


I plan to write a second tutorial once I have a full graphical system and am able to test how audio and video perform on this system. For now, happy hacking!


More information about the ARMedslack mailing list