Thursday, 29 June 2017

Ubuntu on the GPD Pocket using 'isorespin.sh'


Although the GPD Pocket has already started to ship the support for running Ubuntu on the device is currently still in development. This means anyone trying to run Ubuntu is faced with the usual hurdles of booting, wifi, screen rotation and all the other frequently encountered issues.

Not surprisingly you can't just download an official Ubuntu ISO and be up running problem free. However I thought it would be interesting to see if the fixes required could be incorporated into an ISO through respinning using my 'isorespin.sh' script.

I've used the solutions that chrisawcom has posted on reddit (https://www.reddit.com/r/GPDPocket/comments/6idnia/linux_on_gpd_pocket) and created a script that basically updates an official ISO with the required fixes allowing it to be respun.

The command I use to respin the ISO is:

isorespin.sh -i ubuntu-17.04-desktop-amd64.iso -u -p thermald -p "libproc-daemon-perl libproc-pid-file-perl liblog-dispatch-perl" -f linuxium-install-UCM-files.sh -f gpd_pocket -f gpd_pocket.sh -c gpd_pocket.sh -g "" -g "i915.fastboot=1 fbcon=rotate:1"

and I'll briefly cover each of the options as follows:

-i  ubuntu-17.04-desktop-amd64.iso uses an official Ubuntu desktop 64-bit ISO as the base ISO.
-u updates the kernel to the latest Ubuntu Kernel Team kernel build located at http://kernel.ubuntu.com/~kernel-ppa/mainline (current is v4.12-rc7). This is important as the proposed v4.12 kernel includes critical patches that fix many of the issues found when running Linux on an Intel Atom SOC including audio and wifi.
-p installs specific software packages required for thermal management and fan controls.
-f adds the scripts that I've written to specifically customize the ISO with audio, wifi and screen support together with the required files.
-g both removes the default kernel boot parameters and adds additional kernel boot parameters required for successfully booting the device related to screen handling.

Looking at the main configuration script (gpd_pocket.sh) in more detail this basically configures:

  • the internet access for the script
  • the Broadcom wifi driver
  • screen rotation
  • screen brighness
  • touchscreen  
  • fan

by implementing the solutions identified on reddit.

The key benefit is including all the fixes within an ISO that can then be repeatedly used for testing. Respinning the ISO produces the log file:


Script '/usr/local/bin/isorespin.sh' called with '-i ubuntu-17.04-desktop-amd64.iso -u -p thermald -p libproc-daemon-perl libproc-pid-file-perl liblog-dispatch-perl -f linuxium-install-UCM-files.sh -f gpd_pocket -f gpd_pocket.sh -c gpd_pocket.sh -g  -g i915.fastboot=1 fbcon=rotate:1' ...
Work directory 'isorespin' used ...
ISO '/home/linuxium/Documents/ubuntu-17.04-desktop-amd64.iso' respun ...
Kernel boot parameters 'i915.fastboot=1 fbcon=rotate:1' added ...
Initial kernel boot parameters 'quiet splash' deleted ...
Bootloader 'GRUB' added ...
Kernel updated with mainline kernel version '4.12.0-041200rc7-generic' ...
Package 'thermald' added ...
Package 'libproc-daemon-perl libproc-pid-file-perl liblog-dispatch-perl' added ...
File '/home/linuxium/Documents/linuxium-install-UCM-files.sh' added ...
Directory '/home/linuxium/Documents/gpd_pocket' added ...
File '/home/linuxium/Documents/gpd_pocket.sh' added ...
Command run ...
# gpd_pocket.sh
/usr/local/bin/gpd_pocket.sh: Configuring GPD Pocket ...
./linuxium-install-UCM-files.sh: Extracting UCM files ...
./linuxium-install-UCM-files.sh: Installing UCM files ...
./linuxium-install-UCM-files.sh: Reloading UCM driver ...
./linuxium-install-UCM-files.sh: Installation of UCM finished 
/usr/local/bin/gpd_pocket.sh: Installing Broadcom files ...
/usr/local/bin/gpd_pocket.sh: Reloading Broadcom driver ...
/usr/local/bin/gpd_pocket.sh: Installing rotation files ...
/usr/local/bin/gpd_pocket.sh: Installing brightness files ...
/usr/local/bin/gpd_pocket.sh: Installing touchscreen files ...
/usr/local/bin/gpd_pocket.sh: Installing fan service ...
Created symlink /etc/systemd/system/multi-user.target.wants/gpdfand.service -> /lib/systemd/system/gpdfand.service.
/usr/local/bin/gpd_pocket.sh: Starting fan service ...
Running in chroot, ignoring request.
/usr/local/bin/gpd_pocket.sh: Configuration of GPD Pocket finished.
Respun ISO created as 'linuxium-v4.12-rc7-ubuntu-17.04-desktop-amd64.iso'.

and an ISO. Anyone interested can download my respun ISO 'linuxium-v4.12-rc7-ubuntu-17.04-desktop-amd64.iso' and write to a USB using the 'dd' command:

dd if=linuxium-v4.12-rc7-ubuntu-17.04-desktop-amd64.iso of=/dev/sdX bs=4M

where '/dev/sdX' is the correct device for your USB (but first check using commands like 'df', 'blkid' or 'lsblk' to confirm its correct name).

If you want to respin the ISO yourself then download and unzip the file 'gpd_pocket.zip' which contains the required script and files together with 'linuxium-install-UCM-files.sh' for the ALSA UCM files. For the ISO you need to download an Ubuntu 64-bit desktop ISO (e.g. Ubuntu 17.04 from http://releases.ubuntu.com/17.04/ubuntu-17.04-desktop-amd64.iso or Ubuntu 16.04 from http://releases.ubuntu.com/16.04.2/ubuntu-16.04.2-desktop-amd64.iso) together with my 'isorespin.sh' script and then run the command above.

One additional option you might consider adding is '-s 200MB' to add persistence to your ISO as it means that you can retain your data, settings and any changes you make between reboots which is particularly useful when trying to get things to work.

More details about my 'isorespin.sh' script can be found here including full documentation including examples.

If you find my script useful then please donate using the following link http://goo.gl/nXWSGf as everything helps with development costs.





15 comments:

  1. I think gpd_pocket.zip is missing some files:

    isorespin.log on a Kubuntu 17.04 .iso
    (lightdm user errors are expected: Kubuntu doesn't use lightdm.)

    /usr/local/bin/gpd_pocket.sh: Installing Broadcom files ...
    cp: cannot stat '/usr/local/bin/gpd_pocket/brcmfmac4356-pcie.txt': No such file or directory
    /usr/local/bin/gpd_pocket.sh: Reloading Broadcom driver ...
    /usr/local/bin/gpd_pocket.sh: Installing rotation files ...
    chown: invalid user: 'lightdm:lightdm'
    cp: cannot stat '/usr/local/bin/gpd_pocket/monitors.xml': No such file or directory
    chown: invalid user: 'lightdm:lightdm'
    cp: cannot stat '/usr/local/bin/gpd_pocket/adduser.local': No such file or directory
    chmod: cannot access '/usr/local/sbin/adduser.local': No such file or directory
    /usr/local/bin/gpd_pocket.sh: Installing brightness files ...
    /usr/local/bin/gpd_pocket.sh: Installing touchscreen files ...
    /usr/local/bin/gpd_pocket.sh: Installing fan service ...
    cp: cannot stat '/usr/local/bin/gpd_pocket/gpdfand': No such file or directory
    chmod: cannot access '/lib/systemd/system-sleep/gpdfand': No such file or directory
    cp: cannot stat '/usr/local/bin/gpd_pocket/gpdfand.service': No such file or directory
    Failed to enable unit, file gpdfand.service: No such file or directory.

    ReplyDelete
  2. I am not able to run this from Arch Linux. I have the following log:

    Script './isorespin.sh' called with '-i ubuntu-17.04-desktop-amd64.iso -l *.deb -p libproc-daemon-perl libproc-pid-file-perl liblog-dispatch-perl thermald va-driver-all vainfo libva1 i965-va-driver gstreamer1.0-libav gstreamer1.0-plugins-bad-faad gstreamer1.0-vaapi vlc -f 90x11-rotate_and_scale -f HiFi.conf -f chtrt56
    45.conf -f brcmfmac4356-pcie.txt -f wrapper-fix-sound-wifi.sh -f wrapper-rotate-and-scale.sh -f gpdfand/gpdfand -f gpdfand/gpdfand.pl -f gpdfand/gpdfand.service -f wrapper-gpd-fan-control.sh -f monitors.xml -f adduser.local -f 20-intel.conf -f 99-local-bluetooth.rules -f 90-monitor.conf -c wrapper-rotate-and-scale.sh
    -c wrapper-fix-sound-wifi.sh -c wrapper-gpd-fan-control.sh -g -g i915.fastboot=1 fbcon=rotate:1' ...
    Work directory 'isorespin' used ...
    ISO '/site/repo/gpd-pocket-ubuntu-respin/ubuntu-17.04-desktop-amd64.iso' respun ...
    Kernel boot parameters 'i915.fastboot=1 fbcon=rotate:1' added ...
    Initial kernel boot parameters 'quiet splash' deleted ...
    Bootloader 'GRUB' added ...
    Package 'libproc-daemon-perl' not found.

    I've been discussing this with stockmind, who made gpd-pocket-ubuntu-respin to encapsulate all the steps needed, and he concluded that the problem is not with his wrapper, but with isorespin.sh itself. Any suggestions? I'd love to be able to respin my own ISOs rather than relying on others to create them.

    ReplyDelete
    Replies
    1. So what happens when you run the script directly rather than through someone else's script? I tried and I didn't get any errors so it is not a problem with my script.

      Delete
    2. As stated in this comment:
      http://linuxiumcomau.blogspot.com/2017/06/new-functionality-and-simplification-of.html?showComment=1497290747332&m=1#c5844976514914115629


      To respin on Arch Linux without problems you should modify the PATH used:

      PATH=/usr/sbin:/sbin:/bin:$PATH ./isorespin.sh

      Also this packages might be required:
      sudo pacman -S cdrkit bc libisoburn squashfs-tools dosfstools

      Delete
  3. Can you add support for android-x86 in isorespinsh?

    ReplyDelete
    Replies
    1. No as the design and functionality provided by my script doesn't really align with Android based ISOs.

      Delete
  4. I was looking at the GPD Pocket web site and it seems that the new kernel (4.13-rc1) "contains all the fixups and drivers you need to run the GPD with Linux"...

    How this will affect the process of creating the iso of Ubunto LTS or I should use the mos recent Ubuntu?
    I still need all the other files?

    Thanks!!!

    ReplyDelete
    Replies
    1. The problem will only be if the latest kernel 'v4.13-rc1' requires userspace files to support 'all the fixups and drivers you need to run the GPD with Linux'. The latest Ubuntu release or even daily build is likely to be missing these so you will have to look at what the fixes are and what userspace dependencies they have if any. Once know they can be included as part of the respinning similar to the above example.

      Delete
  5. Would I go about this the same way if I wanted to try and install Kali Linux on the GPD? Any help would be appreciated, thanks!

    ReplyDelete
    Replies
    1. My 'isorespin.sh' script no longer supports Kali due to Debian kernels being incompatible with Canonical's DMKS release for Intel Atom devices.

      Delete
  6. Can you please add support for kali linux?

    ReplyDelete
    Replies
    1. See my latest post 'Respinning security distros and upgrading packages' (http://linuxiumcomau.blogspot.com.au/2017/08/respinning-security-distros-and.html).

      Delete
  7. Thanks Linuxium,
    I used your ISO image linked above. It installs fine and the OS mostly works, but the WiFi doesn't work ("No devices available" in the network menu). This is a critical problem for using the image. Any info on how to get this to work?

    ReplyDelete
    Replies
    1. Hans de Goede mentions on his website (http://hansdegoede.livejournal.com/17445.html)
      'If you kernel is new enough it will trip over a BIOS bug which causes the wifi chip to get disabled, you can "fix" the BIOS bug (if you do not have
      the 20161118 BIOS) by changing the following BIOS setting: "Chipset" -> "South Bridge" -> "LPSS & SCC Configuration" -> "SCC SDIO Support"
      to "Disabled"'. The patch to fix this is now in v4.13 rc kernels so if changing the BIOS doesn't work you can either respin the ISO (as the 'u' option with include the v4.13-rc4 kernel) or manually upgrade the kernel by downloading the binary files from 'http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13-rc4/' remembering you just want the three files which are linux-headers-4.13.0-041300rc4_*_all.deb and both the linux-*-4.13.0-041300rc4-generic_*_amd64.deb files and install using 'dpkg -i'.

      Delete