temp/petitboot: new package petitboot (MR 3880)

This commit is contained in:
Julian Winkler 2023-02-13 22:42:26 +01:00 committed by Newbyte
parent 2b16e5837a
commit f567cebd8f
No known key found for this signature in database
GPG key ID: 990600ED1DB95E02
4 changed files with 153 additions and 0 deletions

36
temp/petitboot/APKBUILD Normal file
View file

@ -0,0 +1,36 @@
pkgname=petitboot
pkgver=1.13
pkgrel=0
pkgdesc="Petitboot is an operating system bootloader based on Linux kexec"
url="https://github.com/open-power/petitboot"
arch="all"
license="GPL-2.0-only"
makedepends="eudev-dev lvm2-dev musl-libintl elfutils-dev ncurses-dev flex bison"
source="
https://github.com/open-power/petitboot/releases/download/v$pkgver/petitboot-v$pkgver.tar.gz
discover-grub2-implement-devicetree-command.patch
Prevent-the-UI-from-locking-up-while-the-countdown-r.patch
udev-check-idpath-for-nullptr-before-calling-strcmp.patch
"
subpackages="
$pkgname-doc
$pkgname-dbg
"
builddir="$srcdir/$pkgname-v$pkgver"
build() {
HOST_PROG_KEXEC=/usr/sbin/kexec ./configure --prefix=/usr
make
}
package() {
make DESTDIR="$pkgdir" install
}
sha512sums="
5dd8e605a8ceb8a8165db52f660e25aa3e88e53f26a5dc5e715a17e7fb3f36dd43c2c284c0fd6a2dc8da4eaf72e132ebe4c2b13df4e46a341b7146c38c7810bb petitboot-v1.13.tar.gz
44b32d3cd760bd06417bdee3f4165b72783f5790763233b07222ac98d5ac99f5f63afd32587259cc25d0cb1db0e0695c692fdced9e5c1e9d214ce277ceb45229 discover-grub2-implement-devicetree-command.patch
330b88c1922f1e6a9b2e77114056c6fa4b66aa6a0655d273911acadc778cd9d1a102d2c4fd61c59096c06f7f231159db961aa39401b421b049e05dc39d3437a9 Prevent-the-UI-from-locking-up-while-the-countdown-r.patch
c05e2769660ab95f9380b2233d81cad78ef82637dfed46c4b094e8e30d9f865a6c949e6c9ed1928c47b519f81bb2ed5c8fc8355c793a61db34b33838d212f8a9 udev-check-idpath-for-nullptr-before-calling-strcmp.patch
"

View file

@ -0,0 +1,31 @@
From d9191994688b04b04e14e8395e6a3e0473dba643 Mon Sep 17 00:00:00 2001
From: Lincoln Ramsay <lincoln.ramsay@opengear.com>
Date: Mon, 19 Jul 2021 19:23:06 +1000
Subject: [PATCH] Prevent the UI from locking up while the countdown runs
struct status has 4 parameters. Provide values for all of them
so that random values are not used instead.
Visible on an ARMv7 device as a "hang" (ignoring input) when the
countdown starts, after things have been probed.
Signed-off-by: Lincoln Ramsay <lincoln.ramsay@opengear.com>
---
discover/device-handler.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/discover/device-handler.c b/discover/device-handler.c
index d85f1af..3d6c47d 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -775,6 +775,7 @@ static void countdown_status(struct device_handler *handler,
_("Booting in %d sec: [%s] %s"), sec,
opt->device->device->id, opt->option->name);
status.backlog = false;
+ status.boot_active = false;
device_handler_status(handler, &status);
--
2.39.1

View file

@ -0,0 +1,59 @@
From aa89157d137ee6d63ff41a72a5744ef5ebba112d Mon Sep 17 00:00:00 2001
From: Julian Winkler <julian.winkler1@web.de>
Date: Sat, 18 Feb 2023 22:31:04 +0100
Subject: [PATCH 1/2] discover/grub2: implement 'devicetree' command
This change adds support for the grub2 'devicetree' command, loading a
dtb file from filesystem.
---
discover/grub2/builtins.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/discover/grub2/builtins.c b/discover/grub2/builtins.c
index ff28586..c96b181 100644
--- a/discover/grub2/builtins.c
+++ b/discover/grub2/builtins.c
@@ -102,6 +102,29 @@ static int builtin_initrd(struct grub2_script *script,
return 0;
}
+static int builtin_devicetree(struct grub2_script *script,
+ void *data __attribute__((unused)),
+ int argc, char *argv[])
+{
+ struct discover_boot_option *opt = script->opt;
+
+ if (!opt) {
+ pb_log("grub2 syntax error: 'devicetree' statement outside "
+ "a menuentry.\n");
+ return -1;
+ }
+
+ if (argc < 2) {
+ pb_log("grub2 syntax error: no filename provided to "
+ "devicetree statement\n");
+ return -1;
+ }
+
+ opt->dtb = create_grub2_resource(script, opt, argv[1]);
+
+ return 0;
+}
+
static const struct option search_options[] = {
{
.name = "set",
@@ -511,6 +534,10 @@ static struct {
.name = "initrd16",
.fn = builtin_initrd,
},
+ {
+ .name = "devicetree",
+ .fn = builtin_devicetree,
+ },
{
.name = "search",
.fn = builtin_search,
--
2.39.1

View file

@ -0,0 +1,27 @@
From 3ae8b7b28757a4af3e3fcd9e7380d7dfbb6b295d Mon Sep 17 00:00:00 2001
From: Julian Winkler <julian.winkler1@web.de>
Date: Sat, 18 Feb 2023 22:55:01 +0100
Subject: [PATCH 2/2] udev: check idpath for nullptr before calling strcmp
Apparently the ID_PATH property can be null, which resulted in segfaults
without this patch. Fallback to empty string instead.
---
discover/udev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/discover/udev.c b/discover/udev.c
index c81f3c4..b078dd7 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -181,7 +181,7 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev,
/* We may see multipath devices; they'll have the same uuid as an
* existing device, so only parse the first. */
uuid = udev_device_get_property_value(dev, "ID_FS_UUID");
- idpath = udev_device_get_property_value(dev, "ID_PATH");
+ idpath = udev_device_get_property_value(dev, "ID_PATH") ?: "";
if (uuid) {
ddev = device_lookup_by_uuid(udev->handler, uuid);
if (ddev) {
--
2.39.1