void-linux / void-mklive

The Void Linux live image maker
https://voidlinux.org
Other
331 stars 194 forks source link

Pinebook Pro support #105

Open jcgruenhage opened 4 years ago

jcgruenhage commented 4 years ago

This issue tracks progress towards a usable voidlinux image for the Pinebook Pro. Currently, we can already build a working image

How to read the list: A checked box means that the work is done and merged, an unchecked box with a PR linked means that this is basically done, but not merged yet.

Vaelatern commented 4 years ago

Can we try to use the generic uboot and kernel for this? I believe upstream uboot can run this machine

jcgruenhage commented 4 years ago

If that's possible, absolutely. The kernel still needs a few patches, but is very close to mainline

Duncaen commented 4 years ago

upstream uboot supporting the device does not allow to build a "generic" uboot.

jcgruenhage commented 4 years ago

@xtraeme I do have the hardware here and am willing to test stuff, but I have no experience packaging things like the linux kernel, so your help is appreciated!

A lot of the work done by the manjaro people can be used, like https://gitlab.manjaro.org/manjaro-arm/packages/core/linux-pinebookpro/tree/master for example, so it's mostly a job of "translating" stuff from their PKGBUILDs to our templates

houki0 commented 4 years ago

I've already been playing around with a simple rootfs install by replacing the root partition of the default debian image, so it's running their kernel and uboot right now. It booted just fine out of the box, but I did have to copy the wifi firmware to get wifi to work.

Maybe we could make a pbp-firmware package like the one for the rpi3?

That said, I should be able to test most things, but I'm not great at packaging, and stuff like configuring kernels and uboot is probably beyond me.

ZachIndigo commented 4 years ago

I don't have any packaging knowledge, but I have a pbp and would be willing to offer my services to get void running on it.

jcgruenhage commented 4 years ago

I think we don't lack testers, we mostly lack someone with packaging experience and time who is interested in working on this. I have a bit of experience and am certainly interested, but my schedule is pretty packed right now..

renatoaguiar commented 4 years ago

I can do the packaging. I'm also pretty busy right now, but I hope to find some time to work on that over the weekend.

sunnaryt commented 4 years ago

would really like to see this happen, i only have packaging experience with arch though. i have a lot of free time coming up, like 2 months free time for reasons and PBP is my favorite new toy, i will learn and help maintain if someone points me in the right direction.

renatoaguiar commented 4 years ago

I just pushed WIP to 'pbp' branch on my forks:

I'm now working on packaging pinebookpro-uboot.

q66 commented 4 years ago

you know, there is already https://github.com/void-linux/void-packages/pull/17672

q66 commented 4 years ago

Also, we don't want a 4.4 kernel, it won't work with panfrost and the proprietary libmali which works with 4.4 doesn't work with modern userlands (and if you hack around it it still works poorly)

renatoaguiar commented 4 years ago

Also, we don't want a 4.4 kernel, it won't work with panfrost and the proprietary libmali which works with 4.4 doesn't work with modern userlands (and if you hack around it it still works poorly)

From what I read so far, mainline kernel still doesn't support some features, e.g. suspend/resume. My plan is to initially use same version as official (factory) build and upgrade to mainline kernel as soon as it becomes feature complete.

q66 commented 4 years ago

Suspend/resume may not work, but accelerated graphics not working is worse.

You can use s2idle for suspend for now, which works.

houki0 commented 4 years ago

Assuming the kernel @renatoaguiar packaged is the same one I copied from the default debian (I can confirm they are both version 4.4.202):

I am currently unable to launch any DE or WM both for wayland and x11 (I tested XFCE, KDE on both and Sway). I believe it is an issue with dbus because it seems NetworkManager doesn't work either (I normally use connman so I hadn't noticed before), but runit reports dbus as up, and I can't find any errors with socklog.

I haven't tried a 5.4 or 5.5rc kernel from Manjaro yet because I haven't got those to boot yet, and I don't have a working UART cable to see what's wrong.

In any case, it might be worth looking into.

q66 commented 4 years ago

Wayland won't work on 4.4, except weston fbdev. Sway needs drm, and for that you need libmali (with weston you might be able to get away with pixman), and libmali does not expose enough of libgbm to have weston-drm/sway working. Out of curiosity, I set up proprietary libmali and went to make a preload library to stub out the missing libgbm calls, and got far enough to launch weston and sway with drm, but EGL still does not work. In X11, you will not get acceleration either, since GLAMOR requires EGL, which does not work. So yeah, unaccelerated fbdev or at most drm with llvmpipe is best you will get with the 4.4 kernel. Use 5.5-rc7 or 5.4 from the manjaro tree and panfrost if you want accel of any kind.

houki0 commented 4 years ago

Ah, that probably explains why KDE was complaining about $DISPLAY not being set. I didn't know about fbdev. I'm learning new things by the minute.

In that case, I'll try to get a more recent kernel to run after I fix my UART cable.

jcgruenhage commented 4 years ago

I updated the top post with the WIP stuff that happened so far. I think going with a 4.4 kernel doesn't make sense, since mainline is so close to being feature complete. I'm using the manjaro build at the moment and it works definitely good enough for me.

CameronNemo commented 4 years ago

Firmware for the mainline kernel is here: https://gitlab.manjaro.org/tsys/pinebook-firmware/ .

I pushed 5.5 to the PR linked in the top comment, but have yet to test it.

q66 commented 4 years ago

I'm using 5.5-rc7-panfrost-fixes branch and it works ok - I have not checked which branch your PR is based on now but you should use that one

Btw, I talked to the pine64 folks at fosdem yesterday and showed off mine with void on it a little, turns out at least with the 5.5 kernel we have the best battery life of all distros, nothing else comes close :P (i get 16+ hrs with low brightness and wifi and some slight usage like irc and so)

renatoaguiar commented 4 years ago

I was checking the latest news and It turns out @q66 was right from the beginning :)

Mainline kernel support is progressing faster than I initially thought, so I'll be focusing now on verifying the existing kernel package from @CameronNemo and packaging whatever is still missing.

houki0 commented 4 years ago

I just finished compiling @CameronNemo 's kernel, and looking at the commit referenced in the template, it is the head of the v5.5 branch of manjaro's kernel.

That said, it boots just fine and sway seems to work, although scrolling in Wayland-native firefox is a bit laggy. Is there any way for Wayland to check if it's using software rendering? As far as I can tell glxinfo is only accurate for X11 and XWayland. XWayland firefox works just fine and mesa is installed.

I'll test some other DE's later this week.

renatoaguiar commented 4 years ago

I just added pinebookpro-uboot to https://github.com/renatoaguiar/void-packages/tree/pbp. It still needs some cleanup, but I was good enough to generate a bootable image from https://github.com/renatoaguiar/void-mklive/tree/pbp.

@CameronNemo could you rename your linux-pinebook-pro to pinebookpro-kernel, so it matches naming convention used on kernels for other platforms?

renatoaguiar commented 4 years ago

pinebookpro-uboot: https://github.com/void-linux/void-packages/pull/19196 pinebookpro-firmware: https://github.com/void-linux/void-packages/pull/19197

anjandev commented 4 years ago

I tried @renatoaguiar's build scripts. Just for anyone else that wants to try this:

clone https://github.com/renatoaguiar/void-packages and run git checkout pbp && ./xbps-src binary-bootstrap && ./xbps-src -a aarch64 pkg pinebookpro-base.

Run ./xbps-src -a aarch64 pkg wpa_supplicant cause the default rootfs doesnt come with a wireless...

Then, clone https://github.com/renatoaguiar/void-mklive and run git checkout pbp && make. The rootfs off void's website has an outdated xbps that won't let us run mkplatform.sh. It's ok because we can generate one with ./mkrootfs.sh -o aarch64latest aarch64.

Next, we run sudo ./mkplatformfs.sh -r ../void-packages/host binpkgs/pbp/ -p 'pinebookpro-base wpa_supplicant' pinebookpro aarch64latest.

Finally, to generate the img, I ran: sudo ./mkimage.sh void-pinebookpro-PLATFORMFS-20200216.tar.xz

I burned it to my eemc and it works! It's 4 am and I have been up since 7am so I will do further testing in the morning. Thanks for your work. =)

If anyone wants me to test anything, please let me know.

renatoaguiar commented 4 years ago

I tried @renatoaguiar's build scripts. Just for anyone else that wants to try this:

Thanks for trying that out and posting instructions :)

Run ./xbps-src -a aarch64 pkg wpa_supplicant cause the default rootfs doesnt come with a wireless...

wpa_supplicant for aarch64 is available in official repos. You don't need to build it locally.

Next, we run sudo ./mkplatformfs.sh -r ../void-packages/host binpkgs/pbp/ -p 'pinebookpro-base wpa_supplicant' pinebookpro aarch64latest.

I didn't have to specify any extra packages in mkplatformfs. At least pinebookpro-base and wpa_supplicant are being installed automatically as part of pinebookpro platform, so you shouldn't need to list them in '-p'.

I burned it to my eemc and it works! It's 4 am and I have been up since 7am so I will do further testing in the morning. Thanks for your work. =)

I haven't tried booting from emmc yet. Good to know that it works too :)

jcgruenhage commented 4 years ago

So, to summarize: We have WIP stuff for everything now, we can use that to actually build images that work too, we just need to get the stuff merged now. Some thing have already gotten PRs, for the rest that still needs to be done. I updated the issue description, have I missed something there? Do we have something that's merged already?

renatoaguiar commented 4 years ago

void-mklive: https://github.com/void-linux/void-mklive/pull/109

renatoaguiar commented 4 years ago

pinebookpro-base: https://github.com/void-linux/void-packages/pull/19216

anjandev commented 4 years ago

@renatoaguiar So I installed void on the emmc but I changed my fstab in a way that it void failed to boot. Unfortunately, this failure to boot is not visible to the user. I looked to flash manjaro to an sd card and boot from it to fix the issue. However, the uboot on void doesnt prioritize booting from the sdcard before emmc like on most distros for pinebook pro.

This is an important bug that needs to be fixed before these pull requests can be merged.

I fixed my issue by following the advice here: https://forum.pine64.org/showthread.php?tid=8790

anjandev commented 4 years ago

After further testing, it seems that the emmc does prioritize the sdcard if the system is in a working condition. However, if the pbp is not able to boot from the emmc, it does not even boot the sd card. Im not modifying /boot so I am confused as to what this could be.

I guess if the bug is not reproducible, ignore my original post.

jcgruenhage commented 4 years ago

I've built an image yesterday and I can't get it to boot from eMMC or from the sdcard.. I'll delete everything, rebase stuff on master and will try again. Maybe I missed something.

KeepBotting commented 4 years ago

I have attempted to create some bootable media for Void on the Pinebook Pro using the packages and instructions present in this issue. Near as I can tell, the image was created properly, but I have been unable to boot from SD card.

Here are my steps. I ran these commands on a 64-bit x86 server running Void glibc.

git clone https://github.com/renatoaguiar/void-packages void-packages-pbp && cd void-packages-pbp
git checkout pbp && ./xbps-src binary-bootstrap
./xbps-src -a aarch64 -j8 pkg pinebookpro-base

The build for pinebookpro-base (which includes the kernel) is using eight makejobs (-j8), so scale this according to your hardware.

cd ../
git clone https://github.com/renatoaguiar/void-mklive mklive-pbp && cd mklive-pbp
git checkout pbp && make
sudo ./mkrootfs.sh -o aarch64latest aarch64

This last command errored with FATAL: qemu-aarch64-static binary is missing in your system, exiting.

So I installed qemu-user-static and then attempted rebuilding the rootfs again. This time it was successful.

Continuing, the only extra package I can see myself wanting straight away is wifish as this is my preferred way to manage wireless network associations from the command-line.

sudo ./mkplatformfs.sh -r ../void-packages-pbp/hostdir/binpkgs/pbp/ -p 'wifish' pinebookpro aarch64latest
sudo ./mkimage.sh void-pinebookpro-PLATFORMFS-*.tar.xz

Finally, I decompressed the image and flashed it to a SD card.

unxz void-pinebookpro-*.img.xz
# be careful with dd, as always
sudo dd status=progress if=void-pinebookpro-*.img of=/dev/sdX

After flashing, I inserted the SD card into my Pinebook Pro, but it failed to boot. Instead, the default Debian (on eMMC) booted. I added the boot flag to the Void partition on the SD card and tried again, but this did not have any effect.

My Pinebook Pro still has the default Debian image present on eMMC, so the bootloader is (presumably?) untouched. I have not tried writing the Void image to eMMC just yet. I am not quite comfortable with u-boot (I have only used GRUB and rEFInd), and am hesitant to wipe out the eMMC, since that is where u-boot lives. I would rather not have to open the laptop to recover.

What should I do differently?

Here is the partition layout for my Manjaro ARM SD card (which boots properly): https://branon.me/files/NjVkM2E.png And here is Void's SD card: https://branon.me/files/NGJkNWR.png

jcgruenhage commented 4 years ago

I just rebuilt it and it still doesn't work. OOI, can we gather info on who here 1) had success and 2) what revision they have? Maybe all the people who had success have devices from the same batch and there's some weirdness going on with newer/older revisions. I had no success, from both eMMC and sdcard, on a device from the first ANSI batch

renatoaguiar commented 4 years ago

@jcgruenhage @KeepBotting could you try again using https://github.com/renatoaguiar/void-mklive/tree/pbp-local?

It reintroduces some local changes I had in pbp branch before opening the PR.

KeepBotting commented 4 years ago

I am using an ANSI model. I am unsure how to tell which batch it is from. It was ordered on 27th December and arrived on 20th January 2020.

No success booting from SD. I tried another SD card but no joy.

I notice there is no boot.txt/boot.scr present on the Void image, while Manjaro has some extra files like this. I do not fully understand how to operate u-boot but maybe that's all that is missing.

Edit: @renatoaguiar trying that now!

KeepBotting commented 4 years ago

Odd, using pbp-local branch fails with an error on this command: sudo ./mkrootfs.sh -o aarch64latest aarch64

Reconfiguring packages for aarch64 ...
Running xbps-reconfigure --rootdir /tmp/tmp.J90tU0vw5u base-files
base-files: configuring ...
ERROR: base-files: [configure] INSTALL script failed to execute the post ACTION: No such file or directory
Failed to reconfigure `base-files': No such file or directory
chroot: failed to run command ‘sh’: No such file or directory
chroot: failed to run command ‘sh’: No such file or directory
Setting the default root password ('voidlinux')
chroot: failed to run command ‘sh’: No such file or directory
chroot: failed to run command ‘sh’: No such file or directory
FATAL: Could not set default credentials

I do not understand why this could be, because sh is unpacked and installed prior to this reconfiguration:

dash-0.5.10.2_2: unpacking ...
dash-0.5.10.2_2: registered 'sh' alternatives group
Creating 'sh' alternatives group symlink: sh -> /usr/bin/dash
Creating 'sh' alternatives group symlink: sh.1 -> /usr/share/man/man1/dash.1
bash-5.0.016_1: unpacking ...
bash-5.0.016_1: registered 'sh' alternatives group
renatoaguiar commented 4 years ago

@KeepBotting you probably have stale entries on your binfmt.

Try running $ echo -1 | sudo tee /proc/sys/fs/binfmt_misc/status before the build to remove all entries.

Duncaen commented 4 years ago

Try with this patch https://patch-diff.githubusercontent.com/raw/void-linux/void-mklive/pull/110.patch

KeepBotting commented 4 years ago

@renatoaguiar Interesting, that did indeed solve the error. I have never interacted with binfmt_misc before, but I gather it's used because I am cross-compiling for aarch64 on an x86 host. The patch provided by @Duncaen should fix the configure scripts so manual intervention is not required.

I'm happy to say I was able to successfully boot from the Void SD card after flashing this new image. The process used was identical to my original comment above, with the exception of using pbp-local branch of void-mklive.

Wi-Fi works properly of course, and I was able to install X11 and Mesa to achieve hardware acceleration with the Panfrost driver.

Opening Firefox's filechooser dialog causes X to segfault and crash, however. Not sure what that's about.

Edit: Oh, and thanks to everyone who's contributed!

q66 commented 4 years ago

panfrost is rather unstable still and has issues with GLAMOR, you should run mesa from git for best experience

renatoaguiar commented 4 years ago

I pushed another PR https://github.com/void-linux/void-mklive/pull/111 to void-mklive fixing the execution of post install scripts on cross builds. That is also required to successfully create an image from https://github.com/void-linux/void-mklive/pull/109.

I cleaned https://github.com/renatoaguiar/void-mklive/tree/pbp-local up by keeping only changes from opened PRs, so people should still be able to build images from it.

anjandev commented 4 years ago

It may be worthwhile to start documenting the pinebook pro. I ran into keyboard mapping issues on my iso keyboard and documented it here: https://wiki.voidlinux.org/Pinebook_Pro. Please let me know if you would like me to add anything else to the wiki.

I am running the image from the original pull request without any issues for the last 24 hours. It's been great!

jcgruenhage commented 4 years ago

I've built an image using the pbp-local branch rebased on upstream master, this image boots (from eMMC), but once I install a bit of stuff and resize the partition, it doesn't boot anymore. I'll investigate a bit more what exactly causes it to not boot anymore, but without an external eMMC flasher and a uart adapter, this is a bit hard.

ZachIndigo commented 4 years ago

I have booted it once since I installed it, so far everything appears to be working perfectly on my pbp. Fwiw, I got the batch that shipped January 2020, which I believe is the second batch, and I flashed to SD, not to emmc. I installed Xorg and the MATE desktop. First thing I notice is that every time I start X, the mouse is jittery for a few seconds, then moves normally. Also, what method would we use to upgrade the pbp base image (I.e. kernel and uboot) from the installed computer? Do we clone https://github.com/renatoaguiar/void-packages and use that particular xbps source? I used the pbp-local branch as well for my build.

renatoaguiar commented 4 years ago

@BenEvolent333 since you already have it working, I'd just wait until packages are available in the official mirrors. pinebookpro-uboot and pinebookpro-firmware are already merged, others are coming soon.

renatoaguiar commented 4 years ago

pinebookpro-kernel: https://github.com/void-linux/void-packages/pull/19293

I also fixed musl builds, so now it is also possible to make images for pinebookpro-musl.

ZachIndigo commented 4 years ago

I ran into a problem with Xorg, after I installed panfrost and then logged out of mate (using lightdm), where xorg no longer loads properly. I uninstalled panfrost, but the issue persisted. I attempted to load mate, lightdm, KDE plasma, abiword, and MATE terminal using xinit, of which only mate-terminal loads successfully. Somehow I also deleted the services directory, so I have to re-flash the image anyways, but I will update if I can pinpoint a cause.

renatoaguiar commented 4 years ago

Now https://github.com/void-linux/void-mklive/pull/112 is also needed because older versions of some packages are already available in official repos. I updated the pbp-local branch with that PR.

jcgruenhage commented 4 years ago

can you confirm a void image for pinebookpro works now?

@xtraeme you mean when building from the master branch of void-mklive, without building any packages from source, right?