Saturday, June 23, 2018

ASUS X200LA runs terra (Chrome OS for the ASUS C202SA)

A few weeks ago I loaded an image of both terra and kip on to my ASUS X200LA.  Aside from a "behind the scenes" action requiring a keypress to boot, terra and kip boot nicely. I picked terra specifically under the hope that ASUS uses the media key mappings in their spins of Chrome OS.

terra has Google Play; which is one of my requirements to make a Chromebook useful. 

The X200LA has a 100Mb Realtek, which is okay for testing out builds for different Chromebook hardware. All of the editions I've staged (peppy, kip, terra, glimmer, squawks and ultima) have the r8169 driver, but for the Chromebook to be useful for anyone else, it must have working wireless.

terra has a tolerable function key map and since it has Google Play support working out of the box, I sought to figure out how I could roll in wireless without rebuilding the kernel.  I left kip on /dev/sda5 as I have no need to mess with it right now.

I postulated searching the big mass of recovery images for a build having the exact same kernel and the right wireless module, but it was easier to spend $22 on a mini PCIe Intel AC 7260.  This model corrects for the AR9485 lacking 5Ghz A and AC.  My residential district is oppressed with a "TroposNetworks" SSID and eats up three B/G channels, so 5Ghz is the only cost effective way.  The X200LA has a i3-4010u, and plenty of zip for a Chromebook.

About two years ago I replaced the 500GB laptop drive in the X200LA with a Crucial 128GB SSD, and I already had working knowledge of loosing the external screws and spudging the bottom case open.   Getting accessto the wireless card, once inside, was easy.  Replacing the wireless adapter only involved removing a single retention screw and carefully popping off the wifi/bluetooth antenna connectors.  Assembly is that same process, in reverse. 

I captured screenshots of the old adapter, new adapter installed, terra's lack of wireless with the AR9485 and also screenshots of a working wireless menu with the Intel 7260 and I plan on integrating them with this post, later.

Everything works except:

1. youtube video in Chrome
2. casting to my Miracast endpoints.  I'll use the Android YouTube app for now.
3. HDMI output (hasn't been tested)
4. XBOX One controller causes it to reboot (PS3 SixAxis works fine as /dev/js0)
5. G-sensor / accelerometer

This is the function key map:
F1 -> back
F2 -> forward
F3 -> refresh
F4 -> mlaptopzaximize
F5 -> app switcher
F6 -> dim LCD
F7 -> brighten LCD
F8 -> mute
F9 -> lower volume
F10 -> raise volume
F11 -> maximize
F12 -> F12

Tuesday, June 5, 2018

What to do with a Latitude 5175 2-in-1

This is a short post meant only to summarize my first adventure in deploying Chrome OS on a Latitude 5175 2-in-1.  The instructions are brief, and meant as a reminder of what I did to make it work, but why not share?


Hardware configuration of the Latitude 5175:
  • 4GB RAM
  • Intel m5-6Y57
  • 128GB SATA SSD
  • Venue 11 Travel keyboard (extended battery version)
  • Intel Wireless AC-8260
  • EFI enabled
  • Secure boot disabled


The first build of Chrome OS I found that had similar enough hardware was the HP Chromebook x360 G1 EE.  The model or hwid prefix is SNAPPY. There may be a release with native support of the Intel AC 8260.  Let me know if you find one!

In the absence of native Intel AC 8260 support with an official Chrome OS recovery image, proceed with caution.

Searching Intel's support for Linux indicates that as of kernel 4.1.x, the AC 8260 is supported.  It appears that as of May 2018, several Chrome recovery images use a 3.8 or a 4.4 kernel.  A 4.4 kernel meets the requirement.  Although the SNAPPY image is pretty close, it fails to come with the 8260 firmware.  dmesg reveals that it is looking specifically for iwlwifi-8000C-31.ucode.  dmesg also has a standard message directing to download the correct firmware from git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git.  You can only imagine how thankful I was to have the next breadcrumb tossed in front of me!

I did my Chromium to Chrome OS preparation with an Ubuntu live distribution, with the prerequisite that I installed Chromium OS before Ubuntu.

I'm going to get the cart ahead of the horse for a moment and explain how I loaded the Ubuntu live distribution so that way when I reference it below, you'll know what I'm talking about. If you don't care about this "side trip," jump down to "To prepare your SSD".

I duplicated the Ubuntu 1.4GB data of the ISO as partition #14 of my internal drive and the EFI volume of the ISO as partition #15.  To repeat what I did with live media, install Chromium OS, create a 13th partition but don't take up the remaining disk space.  Plan for the 15th partition (Ubuntu EFI volume) to be at the very end of the disk.  Plan for the 14th partition (Ubuntu ISO data) to be just in front of the partition 15 Ubuntu EFI volume. Change partition 14 (Ubuntu ISO data) to type 11 (Microsoft data) and partition 15 (Ubuntu EFI volume) to type 1 (EFI).  Save your changes to the gpt. Then, say if /dev/sdb is the Ubuntu live media,

1. dd if=/dev/sdb1 of=/dev/sda14
2. dd if=/dev/sdb2 of=/dev/sda15.

With that established, you should now be able to use F12 during the Dell "POST" to select partition 15 for EFI boot.

As an overview, the gpt will then resemble this (using fdisk -l /dev/sda):
Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 478103D4-2A22-384F-88F8-1816B09D50F8

Device         Start       End  Sectors  Size Type
/dev/sda1    8704000  17092607  8388608    4G Microsoft basic data
/dev/sda2      20480     53247    32768   16M ChromeOS kernel
/dev/sda3    4509696   8703999  4194304    2G ChromeOS root fs
/dev/sda4      53248     86015    32768   16M ChromeOS kernel
/dev/sda5     315392   4509695  4194304    2G ChromeOS root fs
/dev/sda6      16448     16448        1  512B ChromeOS kernel
/dev/sda7      16449     16449        1  512B ChromeOS root fs
/dev/sda8      86016    118783    32768   16M Microsoft basic data
/dev/sda9      16450     16450        1  512B ChromeOS reserved
/dev/sda10     16451     16451        1  512B ChromeOS reserved
/dev/sda11        64     16447    16384    8M unknown
/dev/sda12    249856    315391    65536   32M EFI System
/dev/sda13  17092608  62533261 45440654 21.7G Linux filesystem
/dev/sda14 247133196 250065036  2931841  1.4G Microsoft basic data
/dev/sda15 250065038 250069646     4609  2.3M EFI System
Partition table entries are not in disk order.

To prepare your SSD:
# Get the firmware with a computer that has git
Step 1: git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
Step 2: from the linux-firmware directory, isolate iwlwifi-8000C-31.ucode and copy it to a temporary directory.
# Focus on your 5175
Step 3: install Arnold The Bat's Chromium OS to your 5175.  This means any operating system on the 5175 gets completely wiped out and I assume you will be dumping the Chromium OS image over the top of your 5175 internal disk.
Step 4: Now installed, boot in to Chromium on your 5175 (or use Ubuntu live media if you're applying the update manually).
Step 5: Locate the directions on reddit's Update Chromium OS to official Chrome OS
Step 5a OPTION 1) and note that the reddit article specifically has the current recovery.conf URL shortened to http://goo.gl/8v1ZkV in it.  Follow this article unless you're doing it manually.
Step 5b OPTION 1) Select the image for the HP Chromebook x360 G1 EE and follow through with the documented procedure on that page. Skip over the rest of the 5a/b/c/d/e steps and continue at step 6.
Step 5a OPTION 2)  or you can search and grab recovery.conf and grep/vi/less whatever yourself.
Step 5b OPTION 2) wget or curl the SNAPPY image, unzip it, or zcat to a flash drive.
Step 5c OPTION 2) and dump the image's/flash drive's 3rd gpt partition over the top of your internal disk's 3rd gpt  partition
Step 5d OPTION 2) and then copy the [image-part12]/syslinux/vmlinuz.A from the image's 12th partition to your internal disk's 12th gpt (EFI ) partition [sda12]/syslinux/vmlinuz.A.
Step 5e OPTION 2) if it doesn't boot Chrome OS in a matter of seconds, use blkid to identify the UUID of /dev/sda3 and edit /efi/boot/grub.cfg on the EFI partition /dev/sda12 to use that UUID of /dev/sda3.  I elected to mimic the same UUID format I found in grub.cfg by stripping the quotes and capitalizing the UUID in grub.cfg.
Step 6: Add a 13th partition and format, say using ext3 which then becomes /dev/sda13.  If you want to park Ubuntu at the end, keep about 2GB at the end of the disk free for partitions 14 and 15.
Step 7: mkdir /tmp/sda13 and mount /dev/sda13 to /tmp/sda13.
Step 8. copy the firmware images from step 2 to /tmp/sda13.
Step 9. add this script named activate8260.sh to /tmp/sda13

!/bin/sh

WORKDIR=`pwd`
cd /lib/firmware
find | cpio -ov -H crc > /tmp/lib-firmware.cpio
cd /lib
mount tmpfs -t tmpfs /lib/firmware
cd /lib/firmware
cat /tmp/lib-firmware.cpio | cpio -idv 2> /dev/null
cp ${WORKDIR}/iwlwifi*.ucode /lib/firmware
echo 0 > /proc/sys/kernel/chromiumos/module_locking
rmmod iwlmvm
rmmod iwlwifi
modprobe iwlwifi
echo 1 > /proc/sys/kernel/chromiumos/module_locking
touch /tmp/lib-firmware.cpio.unpacked
clear
sleep 2
ifconfig -a
ifconfig -a | grep -q ^wlan0 && echo "ifconfig says wlan0 is loaded."
ifconfig -a | grep -q ^wlan0 || echo "ifconfig does not show wlan0. Check firmware load with dmesg."

Step 10. chmod +x /tmp/sda13/activate8260.sh

Please note that every time you reboot you will have to activate it.  As of writing this I barely spent an evening on this plight.

With the script, you should now be able to manually activate on next boot.  Since deploying over Chromium OS likely means developer mode is on, the CTRL-ALT-F2 console is probably available after Chrome OS boots. If it isn't, you can try adding cros_debug to your grub command line at the next boot.

To activate:
1. CTRL-ALT-F1 and logon as chronos
2. sudo su
3. mkdir /tmp/sda13; mount /dev/sda13 /tmp/sda13
4. cd /tmp/sda13
5. ./activate8260.sh
5a) The script should report if the wlan0 ethernet adapter is successfully found.
6. cd /tmp
7. umount /dev/sda13
8. CTRL-D (to exit su)
9. CTRL-D (to exit chronos shell)
10. CTRL-ALT-F1 to return to Chrome OS.

Wireless should now be live!  Take this foundation and run with it.

In the future I plan on sharing a script that'll deploy Ubuntu Live to the end of the disk.  But that'll depend on if there's already a good write up or existing tool.

I used my actual first successful deployment to add this blog entry.  Immediately, it appears
there is no functional volume up shortcut key along the traditional function key bar.
when closing the lid and effectively putting it to sleep, it can be quite difficult to resume as the power button didn't wake it up and neither did opening the lid.
The battery state never changes from 100% and calculating.

I can confirm that these are working:

  • touchscreen input
  • stylus intput
  • keyboard and touchpad
  • Google Play store


I can confirm that this/these are not working:

  • bluetooth
  • sound