Chromebook

From silverwiki

Last update: Kernel 4.18-rc5

kernel build

apt-get update && apt-get install build-essential bison flexflex bc libssl-dev u-boot-tools

Working: sleep, resume (worked in 4.3, not so well in 4.18), hdmi, brightness adjustment, wifi, sound (much louder than chromeos 3.8 kernel) not tested: bluetooth, headphones, usb3

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
make exynos_defconfig
make menuconfig #(If you want to add anything like game controller drivers or filesystems)
sed -i 's/# CONFIG_CFG80211_WEXT is not set/CONFIG_CFG80211_WEXT=y/' .config
make zImage modules exynos5420-peach-pit.dtb -j 10
cat arch/arm/boot/zImage arch/arm/boot/dts/exynos5420-peach-pit.dtb > zImage.dtb
mkimage -A arm -O linux -T kernel -C none -a 0x40008000 -e 0x40008000 -n Linux -d zImage.dtb uImage
sudo make modules_install
sudo cp /boot/uImage /boot/uImage.old
sudo cp uImage /boot/uImage

boot

To boot the thing, I use this boot.txt stored in partition 12 in /u-boot/. The kernel must be stored on an ext2 partition. Ext4 seems to only want to load 412 bytes...

setenv bootdelay 1
setenv cros_bootfile /uImage
setenv loadaddr 0x41000000
setenv rootpart 3
setenv bootpart 2
setenv set_devname 'setenv bootargs console=tty1 ro init=/sbin/init root=/dev/mmcblk${devnum}p${rootpart}'
setenv ext2_boot 'ext2load ${devtype} ${devnum}:${bootpart} ${loadaddr} ${cros_bootfile}; bootm ${loadaddr}'

It's turned into a uboot image with

mkimage -A arm -C none -T script -d boot.txt boot.scr.uimg

boot printenv

Here are pictures of printenv output from u-boot before 'run run_disk_boot_scripts' gets called by mmc_boot. I think this is stock but it might have been modified in flash by chrubuntu.

Peachpituboot.jpg Peachpituboot2.jpg

partitions

Number  Start   End     Size    File system  Name    Flags
 1      4194kB  6291kB  2097kB               U-Boot
 2      6291kB  543MB   537MB   ext2         Boot    msftdata
12      543MB   560MB   16.8MB  fat16        Script  msftdata
 3      560MB   15.6GB  15.1GB  ext4         Root    msftdata

Here's a slightly more sane one: (cgpt show /dev/mmcblk0)

       start        size    part  contents
           0           1          PMBR
           1           1          Pri GPT header
           2          32          Pri GPT table
        4130        4096       1  Label: "ChromeOS kernel"
                                  Type: ChromeOS kernel
                                  UUID: 23288480-03ED-4D9D-AB51-B3F09205737A
                                  Attr: priority=11 tries=5 successful=1
       40960    30494687       2  Label: "Root"
                                  Type: Linux data
                                  UUID: 57AEF36B-B80C-B746-A556-E4CD0835CD75
        8226       32734       3  Label: "Linux filesystem"
                                  Type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
                                  UUID: 8B243B3D-EE93-463C-AE1A-30A9BA19493B
          34        4096      12  Label: "Linux filesystem"
                                  Type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
                                  UUID: 82CF66B7-3FA5-4DAC-A805-C83932F00110
    30535647          32          Sec GPT table
    30535679           1          Sec GPT header

It is important to make sure the kernel has both the highest priority, and tries > 0. For each boot attempt failure tries will be lowered by one until it simply will say "No chromeos detected on inserted device" on boot.

This command will reset priorities, tries, and the success flag:

cgpt add -i1 -P 11 -T 5 -S 0 /dev/mmcblk0

sleep in slackware arm 14.1

Make sure /etc/rc.d/rc.acpid is chmod +x

Edit /etc/acpi/acpi_handler.sh to include a section for the lid

#!/bin/sh
# Default acpi script that takes an entry for all actions

IFS=${IFS}/
set $@

echo "$1 $2 $3 $4" >> /aout

case "$1" in
  button)
    case "$2" in
      power) /sbin/init 0
         ;;
      lid)
        case "$4" in
          close) pm-suspend
          ;;
          open) wpatool.sh
          ;;
          *) logger "ACPI action $2 $4 is not defined"
          ;;
        esac
      ;;
    *) logger "ACPI action $2 is not defined"
    ;;
    esac
    ;;
  *)
    logger "ACPI group $1 / action $2 is not defined"
    ;;
esac

wifi

Network manager pisses me off, so I use a script like this to find and connect to networks:

#!/bin/bash
INT=mlan0
MYNETWORKS="a56kmodem MJ6CH"
MYNETWORKS="$(ls /root/.wpaconfigs/ -1 | xargs)"
LOG=/var/log/wpatool

# set -v

ifconfig $INT up

success () {
echo "$(date) we are connected to $SSID" >> $LOG; 
ntpdate -s time.nist.gov;
exit 0;
}

bummer () { echo "$(date) wpatool could not connect to a network" >> $LOG; exit 1;}

echo "$(date) wpatool called!" >> $LOG
#If we can ping the last dhcp server we talked to, we are already online. yay
ping "$(grep DHCPACK /var/log/syslog | tail -1 | awk '{print $10}')" -w3 -c1 && success

echo "$(date) not able to ping last gw. scanning wlans" >> $LOG
tries=12
until [ "$ESSIDS" != "" ]; do
	sleep 1;
	tries=$(($tries-1))
	ESSIDS="$(iwlist mlan0 scanning | grep ESSID)"
	#Makes a list of items like this:
	#                    ESSID:"a56kmodem"
	if [ $tries == "0" ]; then bummer; fi
done
echo "$(date) Networks currently in range $ESSIDS" >> $LOG

#For each network named in MYNETWORKS, try to connect if in range
for SSID in $MYNETWORKS; do
	if [ "$(echo $ESSIDS | grep "ESSID:\"$SSID\"")" != "" ]; then
        echo "$(date) connecting to $SSID" >> $LOG
		killall wpa_supplicant
		wpa_supplicant -c /root/.wpaconfigs/$SSID -i mlan0 -B && dhclient mlan0 -v && success
	fi
done

#You're only here if you can't get online. Bummer!
bummer

Alsamixer

These are the settings I needed to get audio output:

  • Digital EQ: maximum
  • Digital: maximum
  • Left Speaker Mixer Left DAC: on
  • Right Speaker Mixer Right DAC: on
  • Speaker Left: on
  • Speaker Left Mixer: maximum
  • Speaker Right: on
  • Speaker Right Mixer: maximum
  • Speaker: Set volume as desired


I think this routes the right channel into the left speaker, and viceversa. It made it noticeably louder too.

  • Left Speaker Mixer Right DAC: on
  • Right Speaker Mixer Left DAC: on


Install arch the easy way

Follow new arch install guide for two partition stick

https://archlinuxarm.org/platforms/armv7/samsung/samsung-chromebook-2

Once booted, dd stick to mmc

run wifi setup

pacman -Sy gdisk

gdisk /dev/mmcblk0

x for extra mode

e to reallocate backup gpt table to end of disk

m for main menu

d to delete

2

n new partition

2

start where p2 started before, should be suggested

end at default

type 0700

n to name partition "Root"

w to write

q to quit

resize2fs /dev/mmcblk0p2 to fill space with filesystem