temp/kexec-tools: fork from alpine to support devicetree on x86 (MR 3880)
This commit is contained in:
parent
5915d1630b
commit
2b16e5837a
3 changed files with 277 additions and 0 deletions
41
temp/kexec-tools/APKBUILD
Normal file
41
temp/kexec-tools/APKBUILD
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Forked from Alpine with patch to support devicetree on x86
|
||||
|
||||
pkgname=kexec-tools
|
||||
_pkgver=2.0.26
|
||||
pkgver=9999
|
||||
pkgrel=0
|
||||
pkgdesc="Directly boot into a new kernel over a currently running one"
|
||||
url="https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/"
|
||||
arch="x86" # others can use package from alpine
|
||||
license="GPL-2.0-only"
|
||||
makedepends="zlib-dev xz-dev linux-headers"
|
||||
subpackages="$pkgname-doc"
|
||||
source="https://www.kernel.org/pub/linux/utils/kernel/kexec/kexec-tools-$_pkgver.tar.xz
|
||||
fix-build-on-Alpine-linux.patch
|
||||
add-devicetree-support-on-x86.patch
|
||||
"
|
||||
options="!check"
|
||||
builddir="$srcdir/$pkgname-$_pkgver"
|
||||
|
||||
build() {
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--prefix=/usr \
|
||||
--sysconfdir=/etc \
|
||||
--mandir=/usr/share/man \
|
||||
--localstatedir=/var \
|
||||
--with-zlib \
|
||||
--with-lzma
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
make DESTDIR="$pkgdir" install
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
afecb64f50a0a2e553712d7e6e4d48e0dc745e4140983a33a10cce931e6aeddaff9c4a3385fbaf7ab9ff7b3b905d932fbce1e0e37aa2c35d5c1e61277140dee9 kexec-tools-2.0.26.tar.xz
|
||||
228166102bfc48f81c04f3b13fbf29d6edf2e66918a967f243c8d2652f40c27af565f1db6b1a58783bd12d67184a70e6b00b1ab82e0f0d195dd51009260c3329 fix-build-on-Alpine-linux.patch
|
||||
2de609f06e7b626c9032c4e51195a4d303c0ee4820b1d66e7ddc95951c02fa97b900f22db7f9d991f9fcc9a1928f1b7167b4634919c439ef0e05c9bd62ba426f add-devicetree-support-on-x86.patch
|
||||
"
|
208
temp/kexec-tools/add-devicetree-support-on-x86.patch
Normal file
208
temp/kexec-tools/add-devicetree-support-on-x86.patch
Normal file
|
@ -0,0 +1,208 @@
|
|||
From 4d08e9803fe68d2b1f26e310fd7aa479affddc48 Mon Sep 17 00:00:00 2001
|
||||
From: Julian Winkler <julian.winkler1@web.de>
|
||||
Date: Sat, 18 Feb 2023 21:48:51 +0100
|
||||
Subject: [PATCH] add devicetree support on x86
|
||||
|
||||
Since linux kernel has dropped support for simple firmware interface
|
||||
(SFI), the only way of boot newer versions on intel MID platform is
|
||||
using devicetree
|
||||
---
|
||||
kexec/arch/i386/include/arch/options.h | 4 +++-
|
||||
kexec/arch/i386/kexec-beoboot-x86.c | 2 +-
|
||||
kexec/arch/i386/kexec-bzImage.c | 21 ++++++++++++++++++++-
|
||||
kexec/arch/i386/kexec-x86.h | 1 +
|
||||
kexec/arch/i386/x86-linux-setup.c | 15 +++++++++++++++
|
||||
kexec/arch/i386/x86-linux-setup.h | 2 ++
|
||||
kexec/arch/x86_64/kexec-bzImage64.c | 2 +-
|
||||
7 files changed, 43 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/i386/include/arch/options.h b/kexec/arch/i386/include/arch/options.h
|
||||
index 0e57951..89e0a95 100644
|
||||
--- a/kexec/arch/i386/include/arch/options.h
|
||||
+++ b/kexec/arch/i386/include/arch/options.h
|
||||
@@ -33,6 +33,7 @@
|
||||
#define OPT_PASS_MEMMAP_CMDLINE (OPT_ARCH_MAX+11)
|
||||
#define OPT_NOEFI (OPT_ARCH_MAX+12)
|
||||
#define OPT_REUSE_VIDEO_TYPE (OPT_ARCH_MAX+13)
|
||||
+#define OPT_DTB (OPT_ARCH_MAX+14)
|
||||
|
||||
/* Options relevant to the architecture (excluding loader-specific ones): */
|
||||
#define KEXEC_ARCH_OPTIONS \
|
||||
@@ -76,7 +77,8 @@
|
||||
{ "args-none", 0, NULL, OPT_ARGS_NONE }, \
|
||||
{ "module", 1, 0, OPT_MOD }, \
|
||||
{ "real-mode", 0, NULL, OPT_REAL_MODE }, \
|
||||
- { "entry-32bit", 0, NULL, OPT_ENTRY_32BIT },
|
||||
+ { "entry-32bit", 0, NULL, OPT_ENTRY_32BIT }, \
|
||||
+ { "dtb", 1, NULL, OPT_DTB },
|
||||
|
||||
#define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR
|
||||
|
||||
diff --git a/kexec/arch/i386/kexec-beoboot-x86.c b/kexec/arch/i386/kexec-beoboot-x86.c
|
||||
index b121834..d949ab8 100644
|
||||
--- a/kexec/arch/i386/kexec-beoboot-x86.c
|
||||
+++ b/kexec/arch/i386/kexec-beoboot-x86.c
|
||||
@@ -125,7 +125,7 @@ int beoboot_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
|
||||
kernel, bb_header.kernel_size,
|
||||
command_line, bb_header.cmdline_size,
|
||||
initrd, bb_header.initrd_size,
|
||||
- real_mode_entry);
|
||||
+ 0, 0, real_mode_entry);
|
||||
|
||||
return result;
|
||||
}
|
||||
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
|
||||
index df8985d..1b8f20c 100644
|
||||
--- a/kexec/arch/i386/kexec-bzImage.c
|
||||
+++ b/kexec/arch/i386/kexec-bzImage.c
|
||||
@@ -95,6 +95,7 @@ void bzImage_usage(void)
|
||||
" --reuse-cmdline Use kernel command line from running system.\n"
|
||||
" --initrd=FILE Use FILE as the kernel's initial ramdisk.\n"
|
||||
" --ramdisk=FILE Use FILE as the kernel's initial ramdisk.\n"
|
||||
+ " --dtb=FILE Use FILE as devicetree.\n"
|
||||
);
|
||||
|
||||
}
|
||||
@@ -103,6 +104,7 @@ int do_bzImage_load(struct kexec_info *info,
|
||||
const char *kernel, off_t kernel_len,
|
||||
const char *command_line, off_t command_line_len,
|
||||
const char *initrd, off_t initrd_len,
|
||||
+ const char *dtb, off_t dtb_len,
|
||||
int real_mode_entry)
|
||||
{
|
||||
struct x86_linux_header setup_header;
|
||||
@@ -373,6 +375,10 @@ int do_bzImage_load(struct kexec_info *info,
|
||||
setup_linux_system_parameters(info, real_mode);
|
||||
}
|
||||
|
||||
+ if (dtb) {
|
||||
+ setup_linux_dtb(info, real_mode, dtb, dtb_len);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -381,13 +387,15 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||
{
|
||||
char *command_line = NULL;
|
||||
char *tmp_cmdline = NULL;
|
||||
- const char *ramdisk, *append = NULL;
|
||||
+ const char *ramdisk, *append = NULL, *dtb;
|
||||
char *ramdisk_buf;
|
||||
off_t ramdisk_length;
|
||||
int command_line_len;
|
||||
int real_mode_entry;
|
||||
int opt;
|
||||
int result;
|
||||
+ char *dtb_buf;
|
||||
+ off_t dtb_length;
|
||||
|
||||
/* See options.h -- add any more there, too. */
|
||||
static const struct option options[] = {
|
||||
@@ -398,6 +406,7 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||
{ "initrd", 1, 0, OPT_RAMDISK },
|
||||
{ "ramdisk", 1, 0, OPT_RAMDISK },
|
||||
{ "real-mode", 0, 0, OPT_REAL_MODE },
|
||||
+ { "dtb", 1, 0, OPT_DTB },
|
||||
{ 0, 0, 0, 0 },
|
||||
};
|
||||
static const char short_options[] = KEXEC_ARCH_OPT_STR "d";
|
||||
@@ -405,6 +414,8 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||
real_mode_entry = 0;
|
||||
ramdisk = 0;
|
||||
ramdisk_length = 0;
|
||||
+ dtb = 0;
|
||||
+ dtb_length = 0;
|
||||
while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
|
||||
switch(opt) {
|
||||
default:
|
||||
@@ -424,6 +435,9 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||
case OPT_REAL_MODE:
|
||||
real_mode_entry = 1;
|
||||
break;
|
||||
+ case OPT_DTB:
|
||||
+ dtb = optarg;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
command_line = concat_cmdline(tmp_cmdline, append);
|
||||
@@ -441,10 +455,15 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len,
|
||||
if (ramdisk) {
|
||||
ramdisk_buf = slurp_file(ramdisk, &ramdisk_length);
|
||||
}
|
||||
+ dtb_buf = 0;
|
||||
+ if (dtb) {
|
||||
+ dtb_buf = slurp_file(dtb, &dtb_length);
|
||||
+ }
|
||||
result = do_bzImage_load(info,
|
||||
buf, len,
|
||||
command_line, command_line_len,
|
||||
ramdisk_buf, ramdisk_length,
|
||||
+ dtb_buf, dtb_length,
|
||||
real_mode_entry);
|
||||
|
||||
free(command_line);
|
||||
diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
|
||||
index 71e4329..46e2898 100644
|
||||
--- a/kexec/arch/i386/kexec-x86.h
|
||||
+++ b/kexec/arch/i386/kexec-x86.h
|
||||
@@ -79,6 +79,7 @@ int do_bzImage_load(struct kexec_info *info,
|
||||
const char *kernel, off_t kernel_len,
|
||||
const char *command_line, off_t command_line_len,
|
||||
const char *initrd, off_t initrd_len,
|
||||
+ const char *dtb, off_t dtb_len,
|
||||
int real_mode_entry);
|
||||
|
||||
int beoboot_probe(const char *buf, off_t len);
|
||||
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
|
||||
index 14263b0..9a281dc 100644
|
||||
--- a/kexec/arch/i386/x86-linux-setup.c
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.c
|
||||
@@ -954,3 +954,18 @@ void setup_linux_system_parameters(struct kexec_info *info,
|
||||
/* Always try to fill acpi_rsdp_addr */
|
||||
real_mode->acpi_rsdp_addr = get_acpi_rsdp();
|
||||
}
|
||||
+
|
||||
+void setup_linux_dtb(struct kexec_info *info, struct x86_linux_param_header *real_mode,
|
||||
+ const char *dtb_buf, int dtb_len)
|
||||
+{
|
||||
+ struct setup_data *sd;
|
||||
+
|
||||
+ sd = xmalloc(sizeof(struct setup_data) + dtb_len);
|
||||
+ sd->next = 0;
|
||||
+ sd->len = dtb_len;
|
||||
+ sd->type = SETUP_DTB;
|
||||
+ memcpy(sd->data, dtb_buf, dtb_len);
|
||||
+
|
||||
+
|
||||
+ add_setup_data(info, real_mode, sd);
|
||||
+}
|
||||
diff --git a/kexec/arch/i386/x86-linux-setup.h b/kexec/arch/i386/x86-linux-setup.h
|
||||
index 0c651e5..b5e1ad5 100644
|
||||
--- a/kexec/arch/i386/x86-linux-setup.h
|
||||
+++ b/kexec/arch/i386/x86-linux-setup.h
|
||||
@@ -21,6 +21,8 @@ static inline void setup_linux_bootloader_parameters(
|
||||
}
|
||||
void setup_linux_system_parameters(struct kexec_info *info,
|
||||
struct x86_linux_param_header *real_mode);
|
||||
+void setup_linux_dtb(struct kexec_info *info, struct x86_linux_param_header *real_mode,
|
||||
+ const char *dtb_buf, int dtb_len);
|
||||
int get_bootparam(void *buf, off_t offset, size_t size);
|
||||
|
||||
|
||||
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
index ba8dc48..aba4e3b 100644
|
||||
--- a/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
|
||||
@@ -386,7 +386,7 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len,
|
||||
if (entry_16bit || entry_32bit)
|
||||
result = do_bzImage_load(info, buf, len, command_line,
|
||||
command_line_len, ramdisk_buf,
|
||||
- ramdisk_length, entry_16bit);
|
||||
+ ramdisk_length, 0, 0, entry_16bit);
|
||||
else
|
||||
result = do_bzImage64_load(info, buf, len, command_line,
|
||||
command_line_len, ramdisk_buf,
|
||||
--
|
||||
2.39.1
|
||||
|
28
temp/kexec-tools/fix-build-on-Alpine-linux.patch
Normal file
28
temp/kexec-tools/fix-build-on-Alpine-linux.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
From d390f1f873fa42fa5791ba48f9acf0f41da33632 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Milan=20P=2E=20Stani=C4=87?= <mps@arvanta.net>
|
||||
Date: Sat, 19 Oct 2019 17:10:16 +0000
|
||||
Subject: [PATCH] kexec/arch/i386/kexec-x86.c: fix build on Alpine linux x86
|
||||
arch
|
||||
|
||||
---
|
||||
kexec/arch/i386/kexec-x86.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/kexec/arch/i386/kexec-x86.c b/kexec/arch/i386/kexec-x86.c
|
||||
index 444cb69..6001e76 100644
|
||||
--- a/kexec/arch/i386/kexec-x86.c
|
||||
+++ b/kexec/arch/i386/kexec-x86.c
|
||||
@@ -36,8 +36,8 @@
|
||||
struct file_type file_type[] = {
|
||||
{ "multiboot-x86", multiboot_x86_probe, multiboot_x86_load,
|
||||
multiboot_x86_usage },
|
||||
- { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
|
||||
- multiboot2_x86_usage },
|
||||
+ { "multiboot2-x86", multiboot_x86_probe, multiboot_x86_load,
|
||||
+ multiboot_x86_usage },
|
||||
{ "elf-x86", elf_x86_probe, elf_x86_load, elf_x86_usage },
|
||||
{ "bzImage", bzImage_probe, bzImage_load, bzImage_usage },
|
||||
{ "beoboot-x86", beoboot_probe, beoboot_load, beoboot_usage },
|
||||
--
|
||||
2.23.0
|
||||
|
Loading…
Reference in a new issue