levinboot tutorial
Q. Why should I install levinboot instead of a more common bootloader like u-boot?
A. Speed! It's just faster. suspend-to-ram is broken in TF-A for the forseeable future, and us Pinebook Pro users are turning our laptops on and off frequently, so being able to boot significantly faster is much appreciated. I can get from power key press to gdm login in 14 seconds. I would be interested in hearing other peoples times.

Here is my tweet showcasing the fast boot capabilities: https://twitter.com/AlexRob12252696/stat...5974057984

Q. Why shouldn't I install levinboot?
A. Frankly, if you are new to using linux it's not the most friendly software to install, and if you don't have a serial console you can quickly find yourself in a tough situation. But if you're brave and like being on the bleeding edge, you should give it a go.

Q. What's the difference between levinboot and u-boot?
- levinboot uses a compressed payload which needs to include the kernel, dtb, bl31.elf, and initramfs, and immediately boots the kernel, where u-boot seems to find these in the userspace.
- because this payload is pre-compressed before booting, the user must update the payload whenever kernel or initramfs change, while u-boot is more flexible about this.
- levinboot is specifically created for Pinebook Pro and RockPro64, whereas u-boot can be applied to a broader range of devices.

Q. How did you build levinboot?
(btw, if you are confused by any of the below or want more info there is a good readme section in the source code: https://gitlab.com/DeltaGem/levinboot)
A. I cross-compiled on an x86 machine running Ubuntu (pop os), and here are my steps:

install cross-compiler (gcc-aarch64) i used version 10.
sudo apt install -y gcc-aarch64-linux-gnu

clone dependency (arm trusted firmware) no need to build but you will use the headers later
git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git

clone levinboot
git clone https://gitlab.com/DeltaGem/levinboot.git
cd levinboot

setup build variables
export CC=$CROSS-gcc
export OBJCOPY=$CROSS-objcopy
export LD=$CROSS-ld

if you want to use emmc, you have the option to enable high-speed emmc mode as a config parameter, but it was not working at the moment, so i left this out.
then I build it with CFLAG -mno-outline-atomics for GCC 10 support
mkdir _build && cd _build
CFLAGS="-O3 -mno-outline-atomics" ../configure.py --payload-{lz4,gzip,zstd,initcpio,sd,emmc,nvme,spi} --with-tf-a-headers /path/to/trusted-firmware-a/include/export

BOOM! that's it. the file i want is called levinboot-sd.img, and because i want it on the emmc instead, i'll just rename it.
mv levinboot-sd.img levinboot-emmc.img

Q. How did you install levinboot?
A. first i had to make a GPT partition on my emmc. I used a special fdisk tool for GPT called GPT fdisk.
sudo gdisk /dev/mmcblk2
in the partition table scan it does, you should see

GPT: present

if you don't, i think you need to look at the wiki to find out how to add the GPT partition table. Exclamation this will wipe your data. Exclamation
the commands are the same as fdisk so i pressed n to add my first partition; I chose this as my payload partition.

i made my first sector be offset by 65536 because this is how much space people leave room at the start for u-boot, and hey, it works for levinboot too
(i wanted levinboot on my emmc too!)

i made my last sector be +60M because the payload is about that big Smile
levinboot requires the payload to be in a specific type of GPT partition with one of three specific GUIDs, I chose e5ab07a0-8e5e-46f6-9ce8-41a518929b7c
gdisk will let you enter the GUID around this point

next I also created a root partition. i guess if you already have one on the device you don't need to create it. but this should just be any root device and since its not levinboot specific I will leave it out of this tutorial.

press w to save and exit

At this point I am ready to flash my emmc with both the payload and levinboot.

I use two scripts to do this and you should scrutinize and edit the scripts to suit your particular needs before executing them.

- compress and flash payload: https://ironrobin.net/clover/droppy/#/Pi...payload.sh
- flash levinboot: https://ironrobin.net/clover/droppy/#/Pi...vinboot.sh

And that's really it. if you have those scripts adjusted to your situation, it should boot your root partition.

Enjoy! and I hope this sheds some more light on this cool promising bootloader.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Lid Magnet Moving tutorial (with pictures) PineyMike 1 2,795 11-27-2020, 04:54 PM
Last Post: KC9UDX
  Deepin Desktop Installation (Fedora 32 Workstation) Tutorial Upokupo 2 3,937 11-04-2020, 07:19 PM
Last Post: tllim
  Tutorial: Run Debian off NVMe hive 4 4,171 10-19-2020, 10:09 AM
Last Post: hive

Forum Jump:

Users browsing this thread: 1 Guest(s)