TLDR: if you just want my image: here you go
What is p-boot
p-boot is a project by megi. It aims to be a small, fast graphical bootloader for the Pinephone. You may have seen it before if you’ve tried megi’s multi distro image.
Why make a custom image
megi currently only makes the multi distro image which currently has 15 distros. However, you may want to add in your own list of distros. I personally wanted to make an image with only Jumpdrive and the option to boot to eMMC.
Setup
There’s a chance your distro of choice will be setup to correctly build images, but I was running into many issues running Ubuntu 20.04. So, I setup a vagrant setup
Vagrant
- install vagrant
- make an empty directory, run
vagrant init, and make aVagrantfile. this one will make a basic arch setup with a synced_folder
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "archlinux/archlinux"
config.vm.synced_folder "./data", "/vagrant_data"
end
- launch vagrant
vagrant up
vagrant ssh
- setup arch
sudo pacman -Sy
sudo pacman -S git wget
download repos
Now that you have a basic setup up and running, you can download the actual code.
- download a pre-built linux kernel from https://xff.cz/kernels/, eg: https://xff.cz/kernels/5.14/ppd.tar.gz
- if you’re doing this later then there may be a newer version of the kernel, if so download that one
- extract that file
mkdir builds
mv ppd.tar.gz builds/
cd builds/
tar xvf ppd.tar.gz
cd ..
- clone the p-boot repo
git clone https://megous.com/git/p-boot
- clone the pinephone-multi-boot repo
git clone https://megous.com/git/pinephone-multi-boot
setup pinephone-multi-boot
There’s a few modifications you have to make in order for the code to work
- set kernel version
- replace
ppd-5.14to whatever version you downloaded
- replace
sed -i 's/ppd-\d-\d\d/ppd-5.14/g' mkimage-boot.sh
- set distros
- here’s where you will do most of the customization
- if you just want to remove distros then go to the
distrosfolder, and remove all the directories that you don’t want- you may also want to remove the associated
argbfiles in thefilesfolder
- you may also want to remove the associated
- if you want to add distros then you will need to make a new directory in the
distrosfolder, then make aREADMEfile that is actually a bash script that will download and extract the initramfs (check the existing ones for examples)- you will also have to add
argbfiles into thefilesfolder. however, I’m not sure how to do that
- you will also have to add
- set file size
- edit
config - set
IMGSIZEto whatever size you want. (you may have to play around with it to get the appropriate size)- I used 200M for just jumpdrive
- edit
- fix mkimage-boot.sh
sed -i 's/..\/p-boot\/.build/..\/p-boot\/dist/g' mkimage-boot.sh
generating the image
Now all you should have to do is run ./download-images.sh to download the distros, and then run ./mkimage.sh to attempt to generate the image. The image will output to /tmp/multi.img by default