PinePhone Kernel Build & Install for CRIU

Native ARM64 build of the Linux Kernel for PinePhone to enable support for Checkpoint and Restore, used by container live migration.

Clone PinePhone kernel for Manjaro

Using megi’s kernel with manjaro patches

git clone --depth=1 --recursive -b 5.10-megi https://gitlab.manjaro.org/manjaro-arm/packages/core/linux-pinephone.git

Download Kernel source and apply patches

Prepare the kernel source

cd linux-pinephone

makepkg --nobuild --cleanbuild

Get path

Get the pkgbuild commit for the kernel source

linux=$(cat PKGBUILD | grep _commit | head -n 1 | awk -F = '{print $2}' | xargs)

Replace config

Using my config to enable checkpoint and restore suppor for PinePhone

cp ../config_base/herd-pinephone-config ./src/linux-$linux/.config
cp ../config_base/herd-pinephone-config config

Make default config using existing config

Sets default values for new kernel flags not set in the config

cd ./src/linux-$linux/

make olddefconfig

Build Kernel and Package for Manjaro

ARM64 Native Build (on PineBook Pro)

cd ../../

makepkg --noextract --noprepare --skipchecksums --force
...
==> Creating package "linux-pinephone-headers"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: linux-pinephone 5.10.19-1 (Fri 17 Sep 2021 10:21:16 PM AST)

Kernel build on PineBook Pro

Build time on PineBook Pro

12036.11s user 1178.03s system 436% cpu 50:28.88 total

Copy Packages from path

cp ./linux-pinephone-5.10.19-1-aarch64.pkg.tar.zst ../
cp ./linux-pinephone-headers-5.10.19-1-aarch64.pkg.tar.zst ../

Copy Packages to PinePhone

scp linux-pinephone-5.10.19-1-aarch64.pkg.tar.zst linux-pinephone-headers-5.10.19-1-aarch64.pkg.tar.zst kde@192.168.1.243:/home/kde/

Install kernel on PinePhone

ssh kde@192.168.1.1.243

# if your PinePhone is using newer kernel, remove dependecies
#sudo pacman -R alsa-ucm-pinephone

sudo pacman -U linux-pinephone-headers-5.10.19-1-aarch64.pkg.tar.zst linux-pinephone-5.10.19-1-aarch64.pkg.tar.zst
loading packages...                                                                                  
warning: linux-pinephone-headers-5.10.19-1 is up to date -- reinstalling                             
warning: linux-pinephone-5.10.19-1 is up to date -- reinstalling                                     
resolving dependencies...                                                                            
looking for conflicting packages...                                                                  
                                                                                                     
Packages (2) linux-pinephone-5.10.19-1  linux-pinephone-headers-5.10.19-1                            
                                                                                                     
Total Installed Size:  116.99 MiB                                                                    
Net Upgrade Size:        1.86 MiB                                                                    
                                                                                                     
:: Proceed with installation? [Y/n] y                                                                
(2/2) checking keys in keyring                     [######################] 100%                     
(2/2) checking package integrity                   [######################] 100%                     
(2/2) loading package files                        [######################] 100%                     
(2/2) checking for file conflicts                  [######################] 100%                     
(2/2) checking available disk space                [######################] 100%                     
:: Processing package changes...                                                                     
(1/2) reinstalling linux-pinephone-headers         [######################] 100%                     
(2/2) reinstalling linux-pinephone                 [######################] 100%                     
:: Running post-transaction hooks...                                                                 
(1/5) Arming ConditionNeedsUpdate...                                                                 
(2/5) Updating module dependencies...                                                                
(3/5) Updating linux-pinephone module dependencies...                                                
(4/5) Updating linux-pinephone initcpios...                                                          
==> Building image from preset: /etc/mkinitcpio.d/linux-pinephone.preset: 'default'                  
  -> -k 5.10.19-1 -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img                               
==> Starting build: 5.10.19-1                                                                        
  -> Running build hook: [base]                                                                      
  -> Running build hook: [udev]                                                                      
  -> Running build hook: [autodetect]                                                                
  -> Running build hook: [modconf]                                                                   
  -> Running build hook: [block]                                                                     
  -> Running build hook: [filesystems]                                                               
  -> Running build hook: [keyboard]                                                                  
  -> Running build hook: [fsck]                                                                      
==> WARNING: No modules were added to the image. This is probably not what you want.                 
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img                               
==> Image generation successful                                                                      
(5/5) Refreshing PackageKit...  

Kernel Config was created without modules by setting kernel tristate values to built-in (y)

Reboot PinePhone

sudo reboot

Check Checkpoint and restore status by running CRIU tests