Difference between revisions of "PineNote Development/Building Kernel"

From PINE64
Jump to navigation Jump to search
(Starting to write it out clearly)
Line 1: Line 1:
= Building the Kernel =
Hello geniuses. You've bought a pinenote (told you you were a genius!), followed Dorian's directions to get Arch installed, but then you've seen someone playing DOOM (TODO link) and you want to learn how to do that too. To get your PN running this smoothly, we'll need to build our own kernel. There are two kernel efforts underway right now:
# pgwipeout: https://gitlab.com/pgwipeout/linux-next
# smaeul: https://github.com/smaeul/linux/tree/rk35/pinenote-next
We'll be using smaeul's kernel + some additional patches provided by DorianRudolph, pgwipeout, Maximilian Weigand, occam_razor, and hrdl (did I forget anyone?). Thanks so much to them, and all the other users who have worked on piecing together drivers, twiddling configs, answering questions, and sharing their work in other ways. Brava!
=== A small warning ===
This guide is completely based off of the scripts provided by Maximilian. We'll be cloning and running them, but he owns them and he -- or others -- might change them. It's smart to have a look at what's going on, check when this page was last updated vs when his scripts were last updated, etc. Be nimble!
== What you should have already done ==
I assume you've already got an operating system installed on your Pinenote other than the stock Android. Doing this isn't trivial, but it is well understood -- you will be following the footsteps of many others. Dorian Rudolph made a guide for doing this, available here (TODO link).
== What do you need to know? ==
If you followed Dorian's guide to get here and felt semi-comfortable, you'll be fine. This is no more complicated than that. If you are intimidated, that's okay! I'll still encourage you to try :) you will learn a lot, just be patient and don't put any data on your PineNote that you wouldn't be okay losing. If you run into trouble, ask for help in the Discord/Matrix (TODO link). Please try to solve problems on your own first, and if nobody replies, please be patient and ask again soon. You can reach me at @aarondabomb on Matrix. Please edit this document if you think something could be clearer or you see a great opportunity for a joke! Have fun :)
= Getting Started =
<ol>
<li> Clone Maximilian's scripts: </li>
<pre> $ git clone https://github.com/m-weigand/mw_pinenote_misc.git </pre>
<li> Make a separate directory for patching the kernel. Then run Maximilian's <code>clone_and_prepare_git.sh</code>. This will clone smaeul's kernel and a number of patches. Read the script to see which patches it is using. Feel free to open the patches too -- it's helpful to get a slim idea of what's going on, if only looking at the commit messages in them: </li>
<pre>
$ cd ../
$ sh mw_pinenote_misc/custom_kernel/clone_and_prepare_git.sh
</pre>
<li> Compile the kernel: </li>
<pre> $ sh ../mw-pinenote_misc/custom_kernel/compile.sh </pre>
WIP!!!
WIP!!!



Revision as of 20:35, 19 August 2022

Building the Kernel

Hello geniuses. You've bought a pinenote (told you you were a genius!), followed Dorian's directions to get Arch installed, but then you've seen someone playing DOOM (TODO link) and you want to learn how to do that too. To get your PN running this smoothly, we'll need to build our own kernel. There are two kernel efforts underway right now:

  1. pgwipeout: https://gitlab.com/pgwipeout/linux-next
  2. smaeul: https://github.com/smaeul/linux/tree/rk35/pinenote-next

We'll be using smaeul's kernel + some additional patches provided by DorianRudolph, pgwipeout, Maximilian Weigand, occam_razor, and hrdl (did I forget anyone?). Thanks so much to them, and all the other users who have worked on piecing together drivers, twiddling configs, answering questions, and sharing their work in other ways. Brava!

A small warning

This guide is completely based off of the scripts provided by Maximilian. We'll be cloning and running them, but he owns them and he -- or others -- might change them. It's smart to have a look at what's going on, check when this page was last updated vs when his scripts were last updated, etc. Be nimble!

What you should have already done

I assume you've already got an operating system installed on your Pinenote other than the stock Android. Doing this isn't trivial, but it is well understood -- you will be following the footsteps of many others. Dorian Rudolph made a guide for doing this, available here (TODO link).

What do you need to know?

If you followed Dorian's guide to get here and felt semi-comfortable, you'll be fine. This is no more complicated than that. If you are intimidated, that's okay! I'll still encourage you to try :) you will learn a lot, just be patient and don't put any data on your PineNote that you wouldn't be okay losing. If you run into trouble, ask for help in the Discord/Matrix (TODO link). Please try to solve problems on your own first, and if nobody replies, please be patient and ask again soon. You can reach me at @aarondabomb on Matrix. Please edit this document if you think something could be clearer or you see a great opportunity for a joke! Have fun :)

Getting Started

  1. Clone Maximilian's scripts:
  2.  $ git clone https://github.com/m-weigand/mw_pinenote_misc.git 
  3. Make a separate directory for patching the kernel. Then run Maximilian's clone_and_prepare_git.sh. This will clone smaeul's kernel and a number of patches. Read the script to see which patches it is using. Feel free to open the patches too -- it's helpful to get a slim idea of what's going on, if only looking at the commit messages in them:
  4.  $ cd ../
     $ sh mw_pinenote_misc/custom_kernel/clone_and_prepare_git.sh
    
  5. Compile the kernel:
  6.  $ sh ../mw-pinenote_misc/custom_kernel/compile.sh 


    WIP!!!

    What I'm Doing

    1. Clone mw's stuff and parse out his scripts
      1. Start clone_and_prepare_git.sh
        1. We can just run this as is. Note whatever dir we run it in will have smaeul's linux kernel cloned into it (as well as patches. aka make this a clean directory to work in)
        2. I recommend looking through the patches to see what they do. Worth noting that the patch mentioned in Dorian's notes for GPU is already here, in `rk3566-pinenote_dtsi.patch`
      2. compile.sh
        1. Run this in the same directory. I started at 12:32 (finished within 15 mins)
      3. install_to_pn.sh
        1. send dtb into `/boot/dtbs/rockchip/` (note that I don't have v1.2 yet this is new) `scp rk3566-pinenote-v1.2.dtb root@pinenote:/boot/dtbs/rockchip/`
        2. update extlinux.conf to point to this new dtb
        3. send over image to /boot
        4. send modules to overwrite what's in /lib/modules : `rsync --delete -avh --progress lib/modules/5.17.0-rc6-next-20220304-* root@pinenote:/lib/modules/`
          1. I didn't have rsync installed on pinenote (it needs to be on client and server). Installation failed because i had new dtb "existing in filesystem" so I moved it to /root for now.
      4. compile mesa
        1. get mesa from here: https://github.com/0cc4m/pinenote-misc/releases (I can't install since I am deving on debian, not arch).
        2. Try to run dpkg-buildpackage gives me an error saying it can't open debian/changelog. This is because I don't have the debian package, which can be obtained here (I think) : https://salsa.debian.org/xorg-team/lib/mesa/-/tree/mesa-22.1.3-1.
        3. Install devscripts, run `mk-build-deps --install --root-cmd sudo --remove` to install build dependencies, then run dpkg-buildpackage.
        4. This spat out a ton of files into ../ (but not libmutter-9-0_41.4-1_arm64.deb as indicated in the install script. Worse, I didn't cross compile, it's all amd64 deb! I'm so dumb because it comes prebuilt in 0cc4m's stuff: https://github.com/0cc4m/pinenote-misc/releases lol
        5. Send that stuff over to the pinenote!!
        6. Untar it and install the packages like this: https://wiki.archlinux.org/title/offline_installation_of_packages
    2. At this point everything should be installed. Let's restart and see what happens.
      1. Kernel panic: https://pastebin.com/4Z0aJgHz
      2. Looking back to see if I missed anything. Mutter? Similar to mesa, but I actually have to build it. Build script has commands needed. Ah shit but I'm on debian, meaning I can only build for debian. I could do a chroot thing...but it's probably not mutter.
      3. Somehow I was booting the wrong kernel. I re-scp'd smaeul's kernel, confirmed md5's, and could boot.
    3. But now networking is busted. Looking trhough `journalctl` for hints.
      1. https://matrix.to/#/!QtTzSRYMuozjbOQkzJ:matrix.org/$HdLaPUKxQr3F690EFNa0Qk0tm_k-72p8cX6ngObk_XQ?via=matrix.org&via=kde.org&via=tchncs.de
      2. Just rename those files and we'll boot, but still not display -- do I need modified mutter? It's X that's failing to start
    4. Display doesn't work either
      1. Need to change lib/firmware/waveform.bin to lib/firmware/rockchip/ebc.wbf. This whole conversation is a lot of the same stuff i ran into: https://matrix.to/#/!QtTzSRYMuozjbOQkzJ:matrix.org/$hnt-F-5YkDfb5I4Ky_ENI7s2jqq4O5Aeo-y4dFCsp_0?via=matrix.org&via=kde.org&via=tchncs.de

    https://pastebin.com/VqXyHg6m Aug 24 17:36:06 manjaro-arm sddm[693]: Display server starting... Aug 24 17:36:06 manjaro-arm sddm[693]: Adding cookie to "/var/run/sddm/{e87f9555-bfb2-4d27-899d-1adea4cedbf1}" Aug 24 17:36:06 manjaro-arm sddm[693]: Running: /usr/bin/X -nolisten tcp -background none -seat seat0 vt1 -auth /var/run/sddm/{e87f9555-bfb2-4d27-899d-1adea4cedbf1} -noreset -displayfd 18 Aug 24 17:36:06 manjaro-arm NetworkManager[682]: <info> [1661387766.6634] dhcp4 (wlan0): state changed new lease, address=192.168.50.184 Aug 24 17:36:06 manjaro-arm sddm[693]: Failed to read display number from pipe Aug 24 17:36:06 manjaro-arm sddm[693]: Display server stopping... Aug 24 17:36:06 manjaro-arm systemd-timesyncd[658]: Network configuration changed, trying to establish connection. Aug 24 17:36:06 manjaro-arm sddm[693]: Attempt 3 starting the Display server on vt 1 failed Aug 24 17:36:06 manjaro-arm sddm[693]: Could not start Display server on vt 1

      1. yea looks like display server isn't starting. I tried running the x command from tty: https://pastebin.com/yP3A9cde "no screens found"


    1. Going to try switching to gnome?

    https://wiki.ubuntu.com/LightDM#Changing_the_Default_Session

    1. Try switching to wayland? Idk the other guy was getting this error with wayland and sway, I'm getting with X and kde. Maybe something else.
    1. Look for sddm logs

    Occam rescued me again!

    Aug 21 12:53:07 manjaro-arm audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=upower comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' Aug 21 12:53:07 manjaro-arm kernel: audit: type=1130 audit(1661111587.904:73): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=upower comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' Aug 21 12:53:08 manjaro-arm kwin_wayland_wrapper[436]: MESA-LOADER: failed to open rockchip_ebc: /usr/lib/dri/rockchip_ebc_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/dri, suffix _dri) Aug 21 12:53:08 manjaro-arm kwin_wayland_wrapper[436]: failed to load driver: rockchip_ebc

    from journal

    DEBUGGING NETWORK NOT WORKINg Hints: cfg80211: Process '/usr/bin/set-wireless-regdom' failed with exit code

    brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.pine64,pinenote-v1.2.bin brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.bin failed with error -2

    Yep, this whole conversation:

    Debug display not working [ 4.532267] rockchip-ebc fdec0000.ebc: Direct firmware load for rockchip/ebc.wbf failed with error -2 [ 4.533249] rockchip-ebc: probe of fdec0000.ebc failed with error -2