Jericho's blog

Jumpdrive only p-boot image

pinephone 2021-09-13 21:56:32 +0000

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

  1. install vagrant
  2. make an empty directory, run vagrant init, and make a Vagrantfile. 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
  1. launch vagrant
vagrant up
vagrant ssh
  1. 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.

  1. 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
  2. extract that file
mkdir builds
mv ppd.tar.gz builds/
cd builds/
tar xvf ppd.tar.gz
cd ..
  1. clone the p-boot repo
git clone https://megous.com/git/p-boot
  1. 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

  1. set kernel version
    • replace ppd-5.14 to whatever version you downloaded
sed -i 's/ppd-\d-\d\d/ppd-5.14/g' mkimage-boot.sh
  1. set distros
    • here's where you will do most of the customization
    • if you just want to remove distros then go to the distros folder, and remove all the directories that you don't want
      • you may also want to remove the associated argb files in the files folder
    • if you want to add distros then you will need to make a new directory in the distros folder, then make a README file 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 argb files into the files folder. however, I'm not sure how to do that
  2. set file size
    • edit config
    • set IMGSIZE to whatever size you want. (you may have to play around with it to get the appropriate size)
      • I used 200M for just jumpdrive
  3. 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