PINE64
Manjaro with BSP kernel - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Linux on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=114)
+--- Thread: Manjaro with BSP kernel (/showthread.php?tid=9253)



Manjaro with BSP kernel - jichu4n - 02-22-2020

I've been exploring the possibility of running Manjaro on the eMMC but with a BSP kernel on the SD card. Not totally stable yet but wanted to see if anyone has thoughts on this.

Why

I love the overall experience in Manjaro ARM a lot (up-to-date packages, AUR etc). I've installed it to the eMMC and use it on a daily basis. The included mainline kernel has come a long way and mostly works well, but I'm still running into a few issues compared to the BSP kernel in mrfixit2001's Debian and ayufan's Ubuntu images:
  • Redshift doesn't work. This is a big problem for me as I use the laptop mostly in the evenings at home.
  • Sound from the speakers is fairly quiet even at max volume.
  • S3 sleep: wakes up a few seconds after closing the lid.
  • (minor) Power LED indicator doesn't change color during sleep.
So I wondered if it'd be possible to use the BSP kernel from ayufan with Manjaro, but without borking the default mainline kernel. The basic idea:
  • Write ayufan's Bionic image containing BSP kernel to SD card
  • Change the kernel boot flags on SD card to use the Manjaro partition on the eMMC as rootfs
  • Copy over BSP kernel modules and firmware from Bionic image to Manjaro partition on the eMMC
Now, without the SD card, the laptop would still boot normally from the eMMC into "regular" Manjaro with mainline kernel. With the SD card inserted, it would boot from the kernel and initramfs on the SD card, but then still use the Manjaro userspace on the eMMC.

How

This is what I did:

1. Write ayufan's Bionic image to SD card:
Code:
xzcat bionic-mate-pinebookpro-0.9.14-1159-armhf.img.xz  | sudo dd of=/dev/mmcblk1 bs=1M status=progress conv=fsync

2. Reboot into Bionic on the SD card, verify everything is working.

3. Mount the Manjaro partition on the eMMC.
  • Note that with the mainline kernel in Manjaro, mmcblk1 is the SD card and mmcblk0 is the eMMC storage, but with the BSP kernel in Bionic it's the other way around where mmcblk0 is the SD card and mmcblk1 is the eMMC storage.
  • Say the Manjaro root partition is /dev/mmcblk1p1 in Bionic and is mounted at /mnt. The default Manjaro eMMC installer sets a label of "ROOT" on the partition, which you can confirm with "ls -l /dev/disk/by-label/".

4. Edit /boot/extlinux/extlinux.conf on the SD card.Change the kernel boot argument "root=LABEL=linux-root" to "root=LABEL=ROOT" (or to "root=/dev/mmcblk1p1"). Again, make sure to confirm the label maps to the correct partition with "ls -l /dev/disk/by-label/".
  • The line to be edited is the first line that starts with "append". After editing, the first few lines of my /boot/extlinux/extlinux.conf looked like this:
    Code:
    timeout 10
    menu title select kernel

    label kernel-4.4.190-1233-rockchip-ayufan-gd3f1be0ed310
        kernel /boot/vmlinuz-4.4.190-1233-rockchip-ayufan-gd3f1be0ed310
        initrd /boot/initrd.img-4.4.190-1233-rockchip-ayufan-gd3f1be0ed310
        devicetreedir /boot/dtbs/4.4.190-1233-rockchip-ayufan-gd3f1be0ed310
        append rw panic=10 init=/sbin/init coherent_pool=1M ethaddr=${ethaddr} eth1addr=${eth1addr} serial=${serial#} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 root=LABEL=ROOT rootwait rootfstype=ext4

5. Copy over kernel modules and firmware from Bionic on the SD card to the Manjaro partition on the eMMC.
  • I located the necessary modules by looking through the "linux-image-4.4.190-1233-rockchip-ayufan-gd3f1be0ed310" and "board-package-pinebookpro-0.9-182" packages:
    Code:
    dpkg -L board-package-pinebookpro-0.9-182 linux-image-4.4.190-1233-rockchip-ayufan-gd3f1be0ed310
  • Ultimately, here are the files I copied over:
    Code:
    sudo cp -a /lib/modules/4.4.190-1233-rockchip-ayufan-gd3f1be0ed310 /mnt/lib/modules/sudo cp -a /usr/lib/linux-image-4.4.190-1233-rockchip-ayufan-gd3f1be0ed310 /mnt/usr/lib/sudo cp -a /vendor /mnt/sudo cp -a /lib/firmware/rtlbt /mnt/lib/firmware/[/list]

6. Fix wi-fi by editing /mnt/etc/NetworkManager/NetworkManager.conf (on the Manjaro partition) to add:
Code:
[device]
wifi.scan-rand-mac-address=no

7. Reboot with SD card inserted. If all went well, you should be able to log in to the eMMC Manjaro install as normal.

Hope this helps!