Some Intel Apollo Lake devices have an option in the BIOS that allows the selection of a bootable OS. Unfortunately on a lot of mini PCs this option is either not present or doesn't include 'Linux' which is required to boot official Ubuntu and Ubuntu flavoured ISOs. Previously I addressed this through adding an option to my 'isorespin.sh' script allowing the ISO to be respun with the rEFInd boot manager to enabled booting.
Whilst investigating why GRUB fails to boot I've developed an alternative approach which I have incorporated into a new release of my 'isorespin.sh' script. Now when respinning with the '--apollo' option the respun ISO replaces the GRUB EFI files with a single EFI file that corresponds to the entry in NVRAM created by the GRUB installation. This EFI file boots the device directly to Linux similar to how Windows boots.
It uses a script I've written that hooks into the 'initramfs' tools to create a bootable EFI file every time 'update-initramfs' is executed. This means if a new kernel is installed the EFI file is automatically updated to boot the new kernel.
To respin an ISO suitable for Intel Apollo Lake devices first download my latest version of 'isorespin.sh' and then respin using the '--apollo' option.
If you have multiple kernels installed it is still possible to boot from a specific kernel simply by rebuilding the 'initramfs' file for that kernel. So for example if you are currently running the 4.10.0-40-generic kernel and want to revert to the 4.10.0-19-generic then just run 'update-initramfs -u -k 4.10.0-19-generic' and reboot.
One issue that might be encountered is where the EFI partition isn't large enough to store the bootable EFI file. Some Windows installations only create a 60MB partition which after installing the Windows EFI files leaves only around 30MB. With the later Linux kernel releases the size and number of modules have increased and if the 'linux-image-extra' package is installed then the corresponding 'initrd.img' is now quite large (over 200MB). Recent kernels only have the minimum set of kernel modules in the 'linux-image' package with the remaining ones in the 'linux-image-extra' package. Whilst in the past installing just the 'linux-image' package was sufficient when upgrading to a new kernel it is now recommended to install both 'linux-image' and 'linux-image-extra' packages. If there is insufficient space the resultant installation will not boot so the solution is to increase the size of the EFI partition by following the instructions posted here.
As a result I've written an additional script that will shrink the size of '/lib/modules' by removing all unused modules from the combination of the 'linux-image' and 'linux-image-extra' packages for a specified kernel. Simply download the script 'update-modules' and pass the kernel version you want to shrink as the parameter.
For example if you want to shrink the overall size of '/lib/modules/4.10.0-19-generic' then run the command 'update-modules 4.10.0-19-generic'. The script will also automatically regenerates the 'initramfs' file and create the bootable EFI file. So if you are running with a small EFI partition and installing a new kernel fails to create the bootable EFI file then running 'update-modules' will fix this. Note that the script requires an internet connection to temporarily download and examine the modules in the 'linux-image-extra' package.
If having removed unused modules a new peripheral requires a missing driver (i.e. module) simply reinstall the 'linux-image-extra' package. For example connecting a USB Ethernet adaptor for the first time when running a previously reduced 4.10.0-19 kernel does not get recognised. Reinstalling all the drivers/modules using the command 'apt install --reinstall linux-image-extra-4.10.0-19-generic' and the adaptor can now connect.
The remaining unused modules can then be removed by re-running the 'update-modules' script if space is a consideration.
It is also possible to respin a bootable ISO for Intel Apollo Lake devices by using the '-b Linuxium' option which is actually what the '--apollo' option now does. Adding the 'Linuxium' bootscript (as implied by the '--apollo' option) does not actually restrict the ISO to boot on a specific processor however it does depend on the boot loader used by the device. An ISO respun with the '-b Linuxium' option will work on any Intel Atom and Apollo Lake devices if they are using a 64-bit boot loader which is the case for Apollo Lake devices. Also note that persistence cannot be added to respinning an ISO in conjunction with the '--apollo' or '-b Linuxium' option. This is because persistence adds the rEFInd boot manager which incidentally also boots on both Intel Atom and Apollo Lake devices using a 64-bit boot loader.
As an example I've respun the Ubuntu 17.04 ISO using the '--apollo' option and included the 'update-modules' script which is available under '/usr/local/bin' and created an ISO suitable for booting on Intel Apollo-based mini PCs.
The ISO can be
- Apollo (-i ubuntu-17.04-desktop-amd64.iso --apollo -f update-modules)
(ISO removed due to Lenovo BIOS issues)Anyone wanting to spin their own can download an ISO and respin using my 'isorespin.sh' script with the above options or after consulting my documentation.
Please donate if you find the ISO or scripts useful using the following link http://goo.gl/nXWSGf.