Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update buildroot #401

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

AaronDewes
Copy link
Contributor

This is not tested yet. This updates the included buildroot to version 2018.11, the last version with QT4.
Differences to the default buildroot 2018.11:

  • Add kernel 4.19 support
  • Update ca-certificates
  • Include PINN packages
  • Fixes for the RPi kernel

@lurch
Copy link
Contributor

lurch commented Jul 4, 2020

11,000 changed files! 👀 Holy moly, that's going to be fun to try and review 😉

Top tip: When making several changes, as you've done in your list above, it's easiest if each of those changes is in a separate commit, rather than squashing everything into a single commit. That way it's easier to pick out exactly what changes e.g. "Fixes for the RPi kernel" involves.

EDIT: But that's just my opinion of course, @procount may see things differently.

@AaronDewes
Copy link
Contributor Author

AaronDewes commented Jul 4, 2020

I rebased it, I hope it is okay like this (I can also squash them again if that's too many commits).

@AaronDewes
Copy link
Contributor Author

I think I found a way to get QT5, I'm still testing it, and many things still need to be done, but I got a working window system:
grafik

@AaronDewes
Copy link
Contributor Author

AaronDewes commented Aug 21, 2020

I got QT5 working, there are still many tweaks needed, but I now got a working build system, and there is one issue:
It needs more resources, and can't use the cd (cut-down) firmware. As NOOBS and PINN use the name recovery, I'm not sure if this is okay for you. Also, the RAM usage increases, and PINN is about 20 MB bigger with QT5 (which also uses even more RAM).

@procount @lurch What are your opinions on this?

Note: This works in parts, but there are many things that still need to be done, but before putting even more work into this, I thought I should ask if you even accept these changes.

@procount
Copy link
Owner

What's the issue with the cutdown firmware? I've never really studied what the differences were between the different versions.

As I said before, I'd like to move PINN onto a later buildroot and QT5 so that I can use a more up to date version of Ubuntu to develop it on. It's a BIG job and I appreciate your work on this. Hopefully it won't be at the expense of too much bloating, because it is supposed to be small and nimble. Unfortunately, I've not had the time to put any effort into this, but at some point I need to, because I can't/won't integrate anything I don't understand or couldn't support. I therefore need to be able to follow along with what you've been doing when I can devote more time to it. So I would ask you to keep your PRs well documented and clear, with each one performing a specific change, and each change being integratable, so there is always a working version, as far as possible.

I can't guarantee when or if I can integrate these changes - it depends on my other commitments, and how well you progress. So if you want to continue, please do so primarily because YOU want to. I hope PINN continues to be useful, but with other advances like UEFI and devs wanting to use more of UBoot, etc, I do wonder how long it will last. Hopefully long enough to complete my roadmap of new features 😄

@AaronDewes
Copy link
Contributor Author

Okay, I'll push more changes soon, I currently have about 20 commits just named "Fix". I currently got a working Window system. Here's a list of all changes to PINN packages I did and I still have to do:

  • Use a custom arora with bugfixes like in Fix certificate errors #411 and QT5 support
  • Remove QWS from PINN
  • Replace some QT4 features with QT5 features (toAscii was replaced by toLatin1)
  • Add a custom compositor
  • Create a way for recovery to change compositor settings

Because the Compositor uses later QT features, but the buildroot currently used here has an older qt5 version, so I need to do the buildroot update & QT5 port in one PR. I can split this into multiple commits, but not create multiple PRs.

@procount
Copy link
Owner

Sorry, yes, I meant commits not PRs.

@AaronDewes
Copy link
Contributor Author

AaronDewes commented Aug 22, 2020

I uploaded the version I'm currently working on here.
The current version does not boot, there is still something needed, but I need to do a test build first.
Also, it currently starts a shell on boot, I will change that later, but this makes debugging easier.

The first commit is just what happens after deleting the buildroot folder and replacing it with buildroot 2020.08-rc1.
The commits after that are changes to buildroot which are already done here, and changes that needed to be done to get the latest QT working.

@AaronDewes AaronDewes force-pushed the buildroot-2018.11 branch 2 times, most recently from 48124dc to f9e6afa Compare August 22, 2020 10:49
Copy link
Contributor Author

@AaronDewes AaronDewes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm documenting the commits in more detail here.
I'll start with commit 137bca4

Update build script for latest buildroot

@@ -51,7 +51,7 @@ function update_github_package_version {

function get_kernel_version {
CONFIG_FILE=.config
CONFIG_VAR=BR2_LINUX_KERNEL_VERSION
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is no longer used for custom repos.

Comment on lines -79 to -80
CONFIG_VAR=BR2_LINUX_KERNEL_VERSION
sed -ri "s/(^$CONFIG_VAR=\")[0-9a-f]+(\")$/\1$GITREV\2/" "$CONFIG_FILE"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, This variable is no longer used for custom repos.

BUILDME.sh Outdated
Comment on lines 244 to 246
# Fix for modular kernel: Force recreation of rootfs image to include modules
rm "$IMAGES_DIR/rootfs.squashfs"
make
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build order changed in the latest buildroot. If this is not done, the image doesn't contain the kernel modules.

Copy link
Contributor Author

@AaronDewes AaronDewes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit 434ed06

Fix PINN for QT5 & latest buildroot

Use QT5 features, fix include paths, ...

@@ -31,7 +31,7 @@
#include <QSettings>
#include <QDesktopWidget>
#include <QScreen>
#include <QWSServer>
// #include <QWSServer>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove everything related to QWS later and replace it with a custom implementation that connects to the compositor and tells it to change its settings.

@@ -56,7 +56,7 @@ BootSelectionDialog::BootSelectionDialog(
_dsi(dsi),
ui(new Ui::BootSelectionDialog),
_inSelection(false),
_drive(drive.toAscii())
_drive(drive.toLatin1())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No functional change, ttoAscii was replaced with toLatin1 in 5.0.

@@ -15,7 +15,7 @@

#include <QDir>
#include <QFile>
#include <QtGui/QPlainTextEdit>
#include <QPlainTextEdit>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer part of the QtGui module, but still available.

Comment on lines 2 to 3
#include <qjson-qt5/parser.h>
#include <qjson-qt5/serializer.h>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QJson is now called qjson-qt5, but functionality stays the same.

@@ -4,11 +4,9 @@
#
#-------------------------------------------------

QT += core gui network dbus
QT += core gui network dbus widgets multimedia
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the qjson path change already broke QT4 support, I removed the QT5 check and added widgets directly here, some part also used the multimedia module, but I don't remember where this was needed.

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

RPI_USERLAND_DIR=../../staging/usr
RPI_USERLAND_DIR=../../host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Staging is not inbuildroot/output/staging anymore (Buildroot creates a symlink when creating the final image, but not earlier).

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="ca_ES">
<TS version="2.1" language="ca_ES">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done by default in qt5, all changes to translation files were done automatically.

@AaronDewes AaronDewes force-pushed the buildroot-2018.11 branch 4 times, most recently from d683900 to 662bb9a Compare August 22, 2020 17:52
@AaronDewes
Copy link
Contributor Author

AaronDewes commented Aug 23, 2020

@procount While trying to get this working, I found out that a complete change of the boot partition is needed, which would break the update system, so an update to prepare PINN for the next update would be needed if these changes are implemented (at least if I understand the update system correctly).
Alternatively, it would be possible to have the main PINN in a file with another name (like pinn.rfs instead of recovery.squashfs), and recovery.rfs has a custom init that performs all changes needed and reboots, so it can be done in one update.

The change is needed because having the firmware named recovery.elf prevents it from reading fixup.dat, which results in a lot of memory-related errors.

Old name New name
recovery.elf start.elf
recover4.elf start4.elf
recovery.cmdline cmdline.txt
(NEW FILE) config.txt
(NEW FILE) fixup.dat
(NEW FILE) fixup4.dat
recovery*.img (kernel) kernel*.img

@procount
Copy link
Owner

Is it not possible to run Qt5 without OpenGL(ES) and a compositor, e.g. just using a simple framebuffer like is used in Qt4?

@AaronDewes
Copy link
Contributor Author

Actually, only a single window can be used without compositor and OpenGL, which won't work for PINN (browser, language selection, config, ...)

@procount
Copy link
Owner

That is surprising. According to https://doc.qt.io/qt-5/qpaintengine.html#details

"Qt provides several premade implementations of QPaintEngine for the different painter backends we support. The primary paint engine provided is the raster paint engine, which contains a software rasterizer which supports the full feature set on all supported platforms. "

@AaronDewes
Copy link
Contributor Author

Haven't seen that yet. The compositor uses other OpenGL features, but maybe I can get it to work properly.

@procount
Copy link
Owner

It seems you are correct. Sounds like this is a backward step by qt in my opinion.
Oh well, I'll have to think about the update issue.

@procount
Copy link
Owner

@AaronDewes - I've heard reports that Qt5 does not work well with buildroot on the RPi as you have found, mostly probably due to the Rpi specifics themselves. Whilst it may be possible to fix all the issues, this does result in a major change to the PINN software and a lot of risk. Previous attempts to advance PINN in this manner have not been totally successful. It also requires changes to the firmware, buildroot and the PINN recovery program, and extra bloat that may be difficult to manage on a Pi0 or 1.

I wonder if a better approach would be to do this one step at a time. It might be better to concentrate on just evolving buildroot to a later version and reverting to the use of Qt4. This may mean backtracking a bit and porting Qt4 into the new buildroot environment, but it may allow a new development environment to be used a lot sooner. Once that is working properly, converting to qt5 could be reconsidered at a later stage. And maybe some of the issues with it will have been resolved by then.

@AaronDewes
Copy link
Contributor Author

I've heard reports that Qt5 does not work well with buildroot on the RPi as you have found, mostly probably due to the Rpi specifics themselves.

Most of these issues are fixed with a1ccdd1.

It also requires changes to the firmware,

No, with compositor 0.3 (will be pushed soon), the firmware doesn't require any changes.

buildroot

Only adding these patches (a1ccdd1), everything else is in 2020.08.

and the PINN recovery program

Only minor changes are needed there (remove some QWS code, and replace it with something else, I'm currently testing a solution for that)

and extra bloat that may be difficult to manage on a Pi0 or 1.

About 20 MB more RAM usage, I don't know if that''s an issue on the 256 MB models (I don't have one), but I don't think too many problems are caused there.

It might be better to concentrate on just evolving buildroot to a later version and reverting to the use of Qt4.

I've tried that, but haven't been successful. I'll try again if my QT5 attempt fails, but as I said before, compositor 0.3 is much better.

@AaronDewes
Copy link
Contributor Author

But you're right, QT5 is really broken on RPi, but I'm trying to change that: https://codereview.qt-project.org/c/qt/qtwayland/+/310822.

Normally, this is disallowed because build failures occured in some test builds.
I haven't experienced this, and parted is needed for PINN, so I changed this.
The path is different now, but the file was not changed.
Use QT5 features, fix include paths, ...
Build of qt5wayland fails on the Raspberry Pi for multiple reasons.
These patches are already merged or proposed in qt and probably won't be needed
when the next buildroot update is done.
@AaronDewes
Copy link
Contributor Author

Sorry for not working on this, I had some issues, because I didn't get fixup.dat to work, because I didn't know it had to be called fixup_rc.dat, but NOOBS 3.5 resolved that issue, I'll rebase and update this PR after you merged NOOBS 3.5 (I assume you'll do that, If not, please tell me), I'll wait with rebasing because otherwise I'd have to do the rebase again.

@procount
Copy link
Owner

No worries at all. I appreciate all your efforts and hope it will work out in the end. Timescales are all yours. 😉
Yes I intend to merge the noobs 3.5 changes. Hopefully soon, but not sure when.

@AaronDewes
Copy link
Contributor Author

I'll wait for Buildroot 2020.02 to release so I can directly update this to Qt 6, because QT 6 doesn't require any major changes from QT 5, but still needs some optimizations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants