Pages
  • Homepage
  • Queztaz/Tech Inventory
  • Emacs/Emacs With BiDirectional Google Calendar Sync
  • Emacs/Setting up Mu4e and Multiple Gmail Accounts
  • Emacs/EWW Hacks
  • Linux/Creating an Offline Debian Mirror Repository
  • Linux/Migrate Wiki.js to Another Server
  • Linux/Adding Bitwarden to the Pinephone Pro
  • Pinebook Pro/Custom Kernel
  • Pinebook Pro/Keyboard Firmware Update
  • Pinebook Pro/Netbsd Installation
  • Pinebook Pro/Setting Up Zram
  • Pinebook Troubleshooting/Pro Common Issues
  • Pinebook Pro/Use NVME as Root
  • Pinebook Pro/Write to SPI Flash
  • Qemu/Chroot Into a Different Architecture
  • Qemu/Choot Into an Img File
  • Qemu/Mount Virtual Images
  • Qemu/Windows Xp Fix Smb Not Working
  • Qemu/Windows Xp Installation
  • Misc/Finding the Default Wireless Password to TG1672G Routers
  • Misc/Running Ollama Portably
  • Windows/Cloning a Bios Boot Drive to Disimilar Hardware with UEFI
  • Windows/Automatic CHKDSK Scans Using Powershell & Email Alerts
  • Windows/Creating a Decent Portable Terminal
  • Windows/Merging HyperV Snapshots With Powershell
  • Windows/Simulating Bad Blocks on NTFS Filesystems
  • Windows/Creating and Viewing a Storport on Windows Server
  • Mikrotik/Creating a Client to Site VPN With
  • Mikrotik/Securing Router With Firewall
  • Mikrotik Setup Dynamically Changing IP With No-IP Api
Homepage
  • Homepage
  • Queztaz/Tech Inventory
  • Emacs/Emacs With BiDirectional Google Calendar Sync
  • Emacs/Setting up Mu4e and Multiple Gmail Accounts
  • Emacs/EWW Hacks
  • Linux/Creating an Offline Debian Mirror Repository
  • Linux/Migrate Wiki.js to Another Server
  • Linux/Adding Bitwarden to the Pinephone Pro
  • Pinebook Pro/Custom Kernel
  • Pinebook Pro/Keyboard Firmware Update
  • Pinebook Pro/Netbsd Installation
  • Pinebook Pro/Setting Up Zram
  • Pinebook Troubleshooting/Pro Common Issues
  • Pinebook Pro/Use NVME as Root
  • Pinebook Pro/Write to SPI Flash
  • Qemu/Chroot Into a Different Architecture
  • Qemu/Choot Into an Img File
  • Qemu/Mount Virtual Images
  • Qemu/Windows Xp Fix Smb Not Working
  • Qemu/Windows Xp Installation
  • Misc/Finding the Default Wireless Password to TG1672G Routers
  • Misc/Running Ollama Portably
  • Windows/Cloning a Bios Boot Drive to Disimilar Hardware with UEFI
  • Windows/Automatic CHKDSK Scans Using Powershell & Email Alerts
  • Windows/Creating a Decent Portable Terminal
  • Windows/Merging HyperV Snapshots With Powershell
  • Windows/Simulating Bad Blocks on NTFS Filesystems
  • Windows/Creating and Viewing a Storport on Windows Server
  • Mikrotik/Creating a Client to Site VPN With
  • Mikrotik/Securing Router With Firewall
  • Mikrotik Setup Dynamically Changing IP With No-IP Api

Pinebook Pro/Custom Kernel

Table of content
  • Setting up our enviroment
  • Dependencies
  • Compiling the kernel
  • Installing the kernel
  • UBOOT (IMPORTANT)
  • ENCRYPTION

Here's how to compile tsys' mainline linux kernel for the Pinebook Pro. I'm using the "debian way" of installing the kernel. When compiling the kernel, we can tell "make" to package the binaries as multiple debian archive files (.deb). Afterward, we can simple run "dpkg -i .deb" to install it.

Setting up our enviroment

Dependencies

Compilation dependencies

sudo apt-get install linux-headers-$(uname -r) libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf bc fakeroot

Linux Source Files

git clone --depth=1 https://gitlab.manjaro.org/tsys/linux-pinebook-pro
cd linux-pinebook-pro

Compiling the kernel

The ARCH variable specifies the target machines architecture.

The CROSS_COMPILE variable specifies which compiler the system should use.

Running "make menuconfig" opens an ncurses menu which you can use to modify the kernel. You don't need to change anything. Run the command and exit the ncurses menu to save the kernel configuration to "$PWD/.config"

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu

# Exit the ncurses menu to save the default config
make -j 6 menuconfig
make -j 6 deb-pkg

The compiling process should take about two hours. My pinebook was left on a desk and stayed consistently at 68.4-69.8 degrees Celsius. The output deb files are in "../"

Installing the kernel

I forgot the exact names of the output deb files.

sudo dpkg -i linux-headers-*.deb
sudo dpkg -i linux-image-*.deb
sudo dpkg -i linux-libc-*.deb

DON'T REBOOT YET! It turns out that uboot, at least from the debian installer, isn't compiled with a gzip decompressor. If you haven't noticed, your linux kernel and initrd are actually both gzip archives! This confused the heck out of me at first. You'll need to decompress the files and put them back in /boot

# We need to rename them with the suffix ".gz" or else gzip returns errors
cd ~
mv /boot/vmlinuz-5.10.0-rc5-1-pinebookpro-arm64+ ~/vmlinuz-5.10.0-rc5-1-pinebookpro-arm64+.gz
gzip -d ~/vmlinuz-5.10.0-rc5-1-pinebookpro-arm64+.gz
mv ~/vmlinuz-5.10.0-rc5-1-pinebookpro-arm64+ /boot/

mv /boot/initrd.img-5.10.0-rc5-1-pinebookpro-arm64+ ~/initrd.img-5.10.0-rc5-1-pinebookpro-arm64+.gz
gzip -d ~/initrd.img-5.10.0-rc5-1-pinebookpro-arm64+.gz
mv ~/initrd.img-5.10.0-rc5-1-pinebookpro-arm64+

DONE! You can boot into your new mainline kernel now.

UBOOT (IMPORTANT)

Remove "maxcpus=4" from /boot/extlinux/extlinux.conf

This option was automatically added and is supposed to make boot times faster. Just remove it from the uboot config. The boot times are fine without it and are infact LONGER if you keep it.

FYI: Normally the default kernel re-enables the two large cores once it's booted. For some reason this one does not.

## /boot/extlinux/extlinux.conf
default 10
menu title U-Boot menu
prompt 0
timeout 10


label l0
        menu label Debian GNU/Linux bullseye/sid 5.10.0-rc5-1-pinebookpro-arm64+
        linux /vmlinuz-5.10.0-rc5-1-pinebookpro-arm64+
        initrd /initrd.img-5.10.0-rc5-1-pinebookpro-arm64+
        fdt /rk3399-pinebook-pro.dtb
        append root=PARTLABEL=mmcblk1-RootFS console=ttyS2,1500000n8 console=tty0 ro quiet splash plymouth.ignore-serial-consoles maxcpus=6 coherent_pool=1M

ENCRYPTION

I couldn't boot from my encrypted debian install. According to this post, you can update your initrd to include modules to decrypt the file system, but the display won't work. I couldn't even get a prompt to appear using the serial console when attempting this. I'm opting for an encrypted home partition instead.

PREVRANDOMNEXT