* [Buildroot] Fwd: [PATCH] fs/user-initrd: add new method for building customizable INITRD
[not found] <CAEVrM6T=5vb98vVUr4AxNWf7xV6VSLyuNME1HpxW=KVJR1vvQw@mail.gmail.com>
@ 2023-09-13 4:41 ` Wit
2023-09-13 9:45 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Wit @ 2023-09-13 4:41 UTC (permalink / raw)
To: buildroot
Hello All!
As for now user has not much influence on creation of contents of an
INITRD image I've made some proof of concept of some wider idea of
creating customizable INITRD image.
This patch adds possibility of creating customizable INITRD image by
selecting some of packages to install. At the moment it supports only
glibc builds but I planned to add support for musl and uClibc as well.
I've got also some other plans regarding this patch.
This patch adds new submenu in "Filesystem images" main menu.
I'm sending this patch for evaluation. If the idea of this patch is ok
for you I could take care of developing it.
Signed-off-by: Witold Kowolik <linuxcdeveloper@gmail.com>
---
fs/Config.in | 1 +
fs/user-initrd/Config.in | 82 +++++++++
fs/user-initrd/deps.pl | 193 ++++++++++++++++++++
fs/user-initrd/skel/bin/.placeholder | 0
fs/user-initrd/skel/dev/mapper/.placeholder | 0
fs/user-initrd/skel/etc/init.d/rcS | 8 +
fs/user-initrd/skel/etc/ld.so.conf | 1 +
fs/user-initrd/skel/init | 1 +
fs/user-initrd/skel/lib/.placeholder | 0
fs/user-initrd/skel/lib64 | 1 +
fs/user-initrd/skel/mnt/.placeholder | 0
fs/user-initrd/skel/proc/.placeholder | 0
fs/user-initrd/skel/run/.placeholder | 0
fs/user-initrd/skel/sbin | 1 +
fs/user-initrd/skel/sys/.placeholder | 0
fs/user-initrd/skel/tmp/.placeholder | 0
fs/user-initrd/skel/usr/bin | 1 +
fs/user-initrd/skel/usr/lib | 1 +
fs/user-initrd/skel/usr/sbin | 1 +
fs/user-initrd/user-initrd-libc.mk | 12 ++
fs/user-initrd/user-initrd-packages.mk | 40 ++++
fs/user-initrd/user-initrd.mk | 41 +++++
22 files changed, 384 insertions(+)
create mode 100644 fs/user-initrd/Config.in
create mode 100755 fs/user-initrd/deps.pl
create mode 100644 fs/user-initrd/skel/bin/.placeholder
create mode 100644 fs/user-initrd/skel/dev/mapper/.placeholder
create mode 100755 fs/user-initrd/skel/etc/init.d/rcS
create mode 100644 fs/user-initrd/skel/etc/ld.so.conf
create mode 120000 fs/user-initrd/skel/init
create mode 100644 fs/user-initrd/skel/lib/.placeholder
create mode 120000 fs/user-initrd/skel/lib64
create mode 100644 fs/user-initrd/skel/mnt/.placeholder
create mode 100644 fs/user-initrd/skel/proc/.placeholder
create mode 100644 fs/user-initrd/skel/run/.placeholder
create mode 120000 fs/user-initrd/skel/sbin
create mode 100644 fs/user-initrd/skel/sys/.placeholder
create mode 100644 fs/user-initrd/skel/tmp/.placeholder
create mode 120000 fs/user-initrd/skel/usr/bin
create mode 120000 fs/user-initrd/skel/usr/lib
create mode 120000 fs/user-initrd/skel/usr/sbin
create mode 100644 fs/user-initrd/user-initrd-libc.mk
create mode 100644 fs/user-initrd/user-initrd-packages.mk
create mode 100644 fs/user-initrd/user-initrd.mk
diff --git a/fs/Config.in b/fs/Config.in
index eee5e26bb2..f115a8cfac 100644
--- a/fs/Config.in
+++ b/fs/Config.in
@@ -17,6 +17,7 @@ source "fs/squashfs/Config.in"
source "fs/tar/Config.in"
source "fs/ubi/Config.in"
source "fs/ubifs/Config.in"
+source "fs/user-initrd/Config.in"
source "fs/yaffs2/Config.in"
endmenu
diff --git a/fs/user-initrd/Config.in b/fs/user-initrd/Config.in
new file mode 100644
index 0000000000..668522fa3f
--- /dev/null
+++ b/fs/user-initrd/Config.in
@@ -0,0 +1,82 @@
+menuconfig BR2_PACKAGE_USER_INITRD
+ bool "customizable user INITRD"
+ default n
+ help
+ This option allows to create customizable user INITRD.
+ As a C library currently only glibc can be used.
+
+ Resulting initrd.gz file will be located in "output/images"
+ directory.
+
+if BR2_PACKAGE_USER_INITRD
+
+if BR2_TOOLCHAIN_BUILDROOT_UCLIBC
+comment "Currently only glibc can be used as a C library for INITRD."
+comment "But currently uClibc C library is selected in toolchain options."
+comment "Enable glibc to see options below."
+endif
+
+if BR2_TOOLCHAIN_BUILDROOT_GLIBC
+comment "glibc will be used as a C library"
+endif
+
+if BR2_TOOLCHAIN_BUILDROOT_MUSL
+comment "Currently only glibc can be used as a C library for INITRD."
+comment "But currently musl C library is selected in toolchain options."
+comment "Enable glibc to see options below."
+endif
+
+config BR2_PACKAGE_USER_INITRD_BASH
+ bool "bash"
+ default n
+ depends on BR2_PACKAGE_BASH
+ depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC
+
+config BR2_PACKAGE_USER_INITRD_CRYPTSETUP
+ bool "cryptsetup"
+ default n
+ depends on BR2_PACKAGE_CRYPTSETUP
+ depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC
+
+config BR2_PACKAGE_USER_INITRD_BUSYBOX
+ bool "busybox"
+ default n
+ depends on BR2_PACKAGE_BUSYBOX
+ depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC
+
+config BR2_PACKAGE_USER_INITRD_COREUTILS
+ bool "coreutils"
+ default n
+ depends on BR2_PACKAGE_COREUTILS
+ depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC
+
+config BR2_PACKAGE_USER_INITRD_PROCPS_NG
+ bool "procps-ng"
+ default n
+ depends on BR2_PACKAGE_PROCPS_NG
+ depends on BR2_TOOLCHAIN_BUILDROOT_GLIBC
+
+if BR2_TOOLCHAIN_BUILDROOT_GLIBC
+
+if !BR2_PACKAGE_BASH
+comment "bash must be enabled to be able to select it to INITRD"
+endif
+
+if !BR2_PACKAGE_CRYPTSETUP
+comment "cryptsetup must be enabled to be able to select it to INITRD"
+endif
+
+if !BR2_PACKAGE_BUSYBOX
+comment "busybox must be enabled to be able to select it to INITRD"
+endif
+
+if !BR2_PACKAGE_COREUTILS
+comment "coreutils must be enabled to be able to select it to INITRD"
+endif
+
+if !BR2_PACKAGE_PROCPS_NG
+comment "procps-ng must be enabled to be able to select it to INITRD"
+endif
+
+endif
+endif
diff --git a/fs/user-initrd/deps.pl b/fs/user-initrd/deps.pl
new file mode 100755
index 0000000000..a8591cafea
--- /dev/null
+++ b/fs/user-initrd/deps.pl
@@ -0,0 +1,193 @@
+#!/usr/bin/perl -w
+
+use Getopt::Long;
+use strict;
+
+my @deps;
+my $logh;
+my $argc = $#ARGV + 1;
+
+if ($argc < 7) {
+ printf("Dependency finder for initrd.");
+ printf("Error: not enough parameters. All the parameters below are
obligatory.\n");
+ printf("Usage:\n");
+ printf("\nInput parameters:\n");
+ printf("--ld-linux: Full path to host ld-linux.so dynamic linker\n");
+ printf(" example:
--ld-linux=/devel/buildroot/output/host/ld-linux-x86-64.so.2\n");
+ printf("--lib-dir: Full path to \"lib\" source directory with the
target libraries for resolving libraries dependencies\n");
+ printf(" example: --lib-dir=/devel/buildroot/output/target/lib\n");
+ printf("--bin-dir: Full path to \"bin\" source directory with binary
ELF executables that will be placed in initrd\n");
+ printf(" example: --bin-dir=/devel/buildroot/output/target/bin\n");
+ printf("--src-rootfs: Full path to rootfs source directory\n");
+ printf(" example: --src-rootfs=/devel/buildroot/output/target\n");
+ printf("--host-dir: Full path to \"host\" directory \n");
+ printf(" example: --host-dir=/devel/output/host\n");
+ printf("\nOutput parameters:\n");
+ printf("--output-dir: Full path to output directory with target
rootfs filesystem where \"lib\" directory will be filled with
libraries\n");
+ printf(" example:
--output-dir=/devel/buildroot/output/build/user-initrd/skel\n");
+ printf("--deps-file: Full path to file where information about all
the found dependencies will be stored\n");
+ printf(" example:
--deps-file=/devel/buildroot/output/build/user-initrd/deps.txt\n");
+ exit;
+}
+
+GetOptions(
+ 'ld-linux=s' => \my $ld_linux,
+ 'lib-dir=s' => \my $lib_dir,
+ 'bin-dir=s' => \my $bin_dir,
+ 'output-dir=s' => \my $output_dir,
+ 'deps-file=s' => \my $deps_file,
+ 'src-rootfs=s' => \my $src_rootfs,
+ 'host-dir=s' => \my $host_dir,
+);
+
+if (defined $deps_file) {
+ open($logh, ">", $deps_file);
+ syswrite($logh, "List of dependencies of binaries and libraries:\n\n");
+}
+
+# Check for duplicates and conditionally insert new dependency
(library) to @deps array.
+sub insert_dependency
+{
+ my $lib = shift;
+ my $i = 0;
+ my $end = $#deps + 1;
+ my $found = 0;
+
+ while ($i < $end) {
+ if ($deps[$i] eq $lib) {
+ $found = 1;
+ last;
+ }
+ $i++;
+ }
+
+ if (!$found) {
+ push(@deps, $lib);
+ }
+}
+
+# Check dependencies using ld-linux dynamic linker/loader, ldd and objdump.
+sub ld_linux
+{
+ my $n = shift;
+ my $objdump = "$host_dir/bin/objdump";
+ my $ldd = "$host_dir/sysroot/bin/ldd";
+
+ # Redirect stderrr to /dev/null
+ open STDERR, '>/dev/null';
+
+ my $ldlin_out = `$ld_linux --inhibit-cache --library-path $lib_dir --list $n`;
+
+ # Chop ending eol if exists.
+ if ($n =~ '[^\\n]+\\n') {
+ chop($n);
+ }
+
+ # Maintain the libexec corner case.
+ if ($ldlin_out eq '') {
+ # Run "objdump -p <lib>" and look for RUNPATH.
+ my $obj = `$objdump -p $n`;
+ (my $runpath) = ($obj =~ '.*RUNPATH\s+([^\\n]+)\n.*');
+
+ # Copy files from libexec directory.
+ if (defined $runpath && $runpath ne '') {
+ my $s = `ls -la $src_rootfs/$runpath`;
+ `mkdir -p $output_dir/$runpath`;
+ `cp -ar $src_rootfs/$runpath/* $output_dir/$runpath`;
+ }
+
+ # Run "ldd" on library and fetch rest of library's dependencies.
+ $ldd = `$ldd $n`;
+
+ # Paths from ldd have no target architecture prefix so add it here:
+ my $line = sprintf("\n%s:\n", $n);
+ syswrite($logh, $line);
+ my @list = split('\n', $ldd);
+
+ foreach my $i (@list) {
+ (my $lib, my $path) = ($i =~ "([^ ]+) +=> +([^ ]+).*");
+ if (defined $lib && defined $path && $path ne "not") {
+ insert_dependency("$src_rootfs/$path");
+ syswrite($logh, " $src_rootfs/$path\n");
+ }
+ }
+ } else {
+ # Standard way: use ld-linux.
+ # Print header line with the name of the ELF binary or library.
+ my $line = sprintf("\n%s:\n", $n);
+ syswrite($logh, $line);
+
+ my @list = split('\n', $ldlin_out);
+ foreach my $i (@list) {
+ (my $lib, my $path) = ($i =~ "([^ ]+) +=> +([^ ]+).*");
+ if (defined $lib && defined $path && $path ne "not") {
+ insert_dependency($path);
+ syswrite($logh, " $path\n");
+ }
+ }
+ }
+}
+
+
+# Main procedure.
+
+my @elfs = `find $bin_dir/ -type f`;
+foreach my $elf (@elfs) {
+ my $f = `file -bi $elf`;
+
+ # Only two executable type of files are taken into account:
+ # 1. application/x-executable; charset=binary
+ # 2. application/x-pie-executable; charset=binary
+ my $x_exe = "application/x-executable; charset=binary";
+ my $x_piexe = "application/x-pie-executable; charset=binary";
+ if ($f =~ /$x_exe/ || $f =~ /$x_piexe/) {
+ ld_linux($elf);
+ }
+}
+
+# Check libraries dependencies.
+my $start = 0;
+my $end = $#deps + 1;
+while (1) {
+ while ($start < $end) {
+ ld_linux($deps[$start]);
+ $start++;
+ }
+
+ # Check if after ld_linux() number of elements in @deps array increased.
+ # If yes then check dependencies of newly found libraries.
+ if ($end != $#deps + 1) {
+ $end = $#deps + 1;
+ }
+
+ # Exit main loop if all the dependencies already checked.
+ if ($start >= $end) {
+ last;
+ }
+}
+close($logh);
+
+# Remove ld-linux from @deps because it comes from host tools
+# and it is not needed in "lib" directory.
+for (my $i = 0; $i < $#deps + 1; $i++) {
+ if ($deps[$i] =~ '.*/ld-linux.*') {
+ splice(@deps, $i, 1);
+ }
+}
+
+# Copy libraries to initrd target "lib" directory.
+for (my $i = 0; $i < $#deps + 1; $i++) {
+ (my $dir, my $libname) = ($deps[$i] =~ '(.*\/)([^\.]+)\..*');
+ `cp -a $dir/$libname.*so* $output_dir/lib`;
+ `cp -a $dir/$libname-*so* $output_dir/lib >& /dev/null`;
+}
+
+# Copy ld-linux from target dir.
+`cp -a $lib_dir/ld-linux-* $output_dir/lib/`;
+`cp -a $lib_dir/ld-linux.* $output_dir/lib/ >& /dev/null`;
+`ln -sf ld-linux-x86-64.so.2 $output_dir/lib/ld-linux.so.2`;
+`ln -sf ../lib/ld-linux-x86-64.so.2 $output_dir/bin/ld.so`;
+
+
+# Make "/etc/ld.so.cache".
+`ldconfig $output_dir/lib -r $output_dir`;
diff --git a/fs/user-initrd/skel/bin/.placeholder
b/fs/user-initrd/skel/bin/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/dev/mapper/.placeholder
b/fs/user-initrd/skel/dev/mapper/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/etc/init.d/rcS
b/fs/user-initrd/skel/etc/init.d/rcS
new file mode 100755
index 0000000000..d369b84215
--- /dev/null
+++ b/fs/user-initrd/skel/etc/init.d/rcS
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+mount -t devtmpfs none /dev
+mount /dev/sda1 /mnt
+
+# Here is the place for some other actions.
+
+exec switch_root /mnt /usr/lib/systemd/systemd --system
diff --git a/fs/user-initrd/skel/etc/ld.so.conf
b/fs/user-initrd/skel/etc/ld.so.conf
new file mode 100644
index 0000000000..502167fa0b
--- /dev/null
+++ b/fs/user-initrd/skel/etc/ld.so.conf
@@ -0,0 +1 @@
+/lib
diff --git a/fs/user-initrd/skel/init b/fs/user-initrd/skel/init
new file mode 120000
index 0000000000..50d438c463
--- /dev/null
+++ b/fs/user-initrd/skel/init
@@ -0,0 +1 @@
+/etc/init.d/rcS
\ No newline at end of file
diff --git a/fs/user-initrd/skel/lib/.placeholder
b/fs/user-initrd/skel/lib/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/lib64 b/fs/user-initrd/skel/lib64
new file mode 120000
index 0000000000..7951405f85
--- /dev/null
+++ b/fs/user-initrd/skel/lib64
@@ -0,0 +1 @@
+lib
\ No newline at end of file
diff --git a/fs/user-initrd/skel/mnt/.placeholder
b/fs/user-initrd/skel/mnt/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/proc/.placeholder
b/fs/user-initrd/skel/proc/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/run/.placeholder
b/fs/user-initrd/skel/run/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/sbin b/fs/user-initrd/skel/sbin
new file mode 120000
index 0000000000..c5e82d7458
--- /dev/null
+++ b/fs/user-initrd/skel/sbin
@@ -0,0 +1 @@
+bin
\ No newline at end of file
diff --git a/fs/user-initrd/skel/sys/.placeholder
b/fs/user-initrd/skel/sys/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/tmp/.placeholder
b/fs/user-initrd/skel/tmp/.placeholder
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/fs/user-initrd/skel/usr/bin b/fs/user-initrd/skel/usr/bin
new file mode 120000
index 0000000000..19f285ac7c
--- /dev/null
+++ b/fs/user-initrd/skel/usr/bin
@@ -0,0 +1 @@
+../bin
\ No newline at end of file
diff --git a/fs/user-initrd/skel/usr/lib b/fs/user-initrd/skel/usr/lib
new file mode 120000
index 0000000000..dc598c56dc
--- /dev/null
+++ b/fs/user-initrd/skel/usr/lib
@@ -0,0 +1 @@
+../lib
\ No newline at end of file
diff --git a/fs/user-initrd/skel/usr/sbin b/fs/user-initrd/skel/usr/sbin
new file mode 120000
index 0000000000..19f285ac7c
--- /dev/null
+++ b/fs/user-initrd/skel/usr/sbin
@@ -0,0 +1 @@
+../bin
\ No newline at end of file
diff --git a/fs/user-initrd/user-initrd-libc.mk
b/fs/user-initrd/user-initrd-libc.mk
new file mode 100644
index 0000000000..19c888aa80
--- /dev/null
+++ b/fs/user-initrd/user-initrd-libc.mk
@@ -0,0 +1,12 @@
+################################################################################
+#
+# Select one of the allowed C library builds. Temporarily only glibc available.
+#
+################################################################################
+
+ifeq ($(BR2_TOOLCHAIN_BUILDROOT_GLIBC),y)
+define USER_INITRD_LIBC_GLIBC_INSTALL
+ make glibc-reinstall TARGET_DIR=$(USER_INITRD_OUTPUT_DIR)
+endef
+USER_INITRD_BUILD_HOOKS += $(USER_INITRD_LIBC_GLIBC_INSTALL)
+endif
diff --git a/fs/user-initrd/user-initrd-packages.mk
b/fs/user-initrd/user-initrd-packages.mk
new file mode 100644
index 0000000000..c0e10beefa
--- /dev/null
+++ b/fs/user-initrd/user-initrd-packages.mk
@@ -0,0 +1,40 @@
+################################################################################
+#
+# Select packages to be included in INITRD
+#
+################################################################################
+
+ifeq ($(BR2_PACKAGE_USER_INITRD_BASH),y)
+define USER_INITRD_PACKAGES_BASH_INSTALL
+ make bash-reinstall TARGET_DIR=$(USER_INITRD_OUTPUT_DIR)
+endef
+USER_INITRD_BUILD_HOOKS += $(USER_INITRD_PACKAGES_BASH_INSTALL)
+endif
+
+ifeq ($(BR2_PACKAGE_USER_INITRD_CRYPTSETUP),y)
+define USER_INITRD_PACKAGES_CRYPTSETUP_INSTALL
+ make cryptsetup-reinstall TARGET_DIR=$(USER_INITRD_OUTPUT_DIR)
+endef
+USER_INITRD_BUILD_HOOKS += $(USER_INITRD_PACKAGES_CRYPTSETUP_INSTALL)
+endif
+
+ifeq ($(BR2_PACKAGE_USER_INITRD_BUSYBOX),y)
+define USER_INITRD_PACKAGES_BUSYBOX_INSTALL
+ make busybox-reinstall TARGET_DIR=$(USER_INITRD_OUTPUT_DIR)
+endef
+USER_INITRD_BUILD_HOOKS += $(USER_INITRD_PACKAGES_BUSYBOX_INSTALL)
+endif
+
+ifeq ($(BR2_PACKAGE_USER_INITRD_COREUTILS),y)
+define USER_INITRD_PACKAGES_COREUTILS_INSTALL
+ make coreutils-reinstall TARGET_DIR=$(USER_INITRD_OUTPUT_DIR)
+endef
+USER_INITRD_BUILD_HOOKS += $(USER_INITRD_PACKAGES_COREUTILS_INSTALL)
+endif
+
+ifeq ($(BR2_PACKAGE_USER_INITRD_PROCPS_NG),y)
+define USER_INITRD_PACKAGES_PROCPS_NG_INSTALL
+ make procps-ng-reinstall TARGET_DIR=$(USER_INITRD_OUTPUT_DIR)
+endef
+USER_INITRD_BUILD_HOOKS += $(USER_INITRD_PACKAGES_PROCPS_NG_INSTALL)
+endif
diff --git a/fs/user-initrd/user-initrd.mk b/fs/user-initrd/user-initrd.mk
new file mode 100644
index 0000000000..344792e1b1
--- /dev/null
+++ b/fs/user-initrd/user-initrd.mk
@@ -0,0 +1,41 @@
+################################################################################
+#
+# Build customizable user initrd
+#
+################################################################################
+
+USER_INITRD_LD_LINUX = $(STAGING_DIR)/usr/lib/ld-linux-x86-64.so.2
+USER_INITRD_TARGET_LIB_DIR = $(TARGET_DIR)/lib
+USER_INITRD_TARGET_BIN_DIR = $(TARGET_DIR)/bin
+USER_INITRD_OUTPUT_DIR = $(@D)/skel
+USER_INITRD_DEPS_FILE = $(@D)/deps.txt
+
+include fs/user-initrd/user-initrd-packages.mk
+include fs/user-initrd/user-initrd-libc.mk
+
+define USER_INITRD_EXTRACT_CMDS
+ cp -r $(USER_INITRD_PKGDIR)/skel $(@D)
+ find $(@D)/skel -type f -name .placeholder -exec rm {} \;
+endef
+
+define USER_INITRD_BUILD_CMDS
+ $(USER_INITRD_BUILD_HOOKS)
+ $(USER_INITRD_PKGDIR)/deps.pl \
+ --ld-linux=$(USER_INITRD_LD_LINUX) \
+ --lib-dir=$(USER_INITRD_TARGET_LIB_DIR) \
+ --bin-dir=$(USER_INITRD_OUTPUT_DIR)/bin \
+ --output-dir=$(USER_INITRD_OUTPUT_DIR) \
+ --deps-file=$(USER_INITRD_DEPS_FILE) \
+ --src-rootfs=$(USER_INITRD_TARGET_DIR) \
+ --host-dir=$(HOST_DIR)/$(GNU_TARGET_NAME)
+ rm -rf $(USER_INITRD_OUTPUT_DIR)/usr/share/{doc,info,man}
+ rm -rf $(USER_INITRD_OUTPUT_DIR)/usr/include
+ find $(USER_INITRD_OUTPUT_DIR)/bin/ $(USER_INITRD_OUTPUT_DIR)/lib/
-type f -exec strip -d {} \;
+ cd $(USER_INITRD_OUTPUT_DIR) && find ./ -mindepth 1 | cpio -o -H
newc | gzip -9 -c > ../initrd.gz
+endef
+
+define USER_INITRD_INSTALL_TARGET_CMDS
+ $(INSTALL) -D -m 0444 $(@D)/initrd.gz $(BINARIES_DIR)/initrd.gz
+endef
+
+$(eval $(generic-package))
--
2.42.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] Fwd: [PATCH] fs/user-initrd: add new method for building customizable INITRD
2023-09-13 4:41 ` [Buildroot] Fwd: [PATCH] fs/user-initrd: add new method for building customizable INITRD Wit
@ 2023-09-13 9:45 ` Thomas Petazzoni via buildroot
2023-09-13 13:30 ` Yann E. MORIN
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-09-13 9:45 UTC (permalink / raw)
To: Wit; +Cc: buildroot
Hello Witold,
On Wed, 13 Sep 2023 06:41:48 +0200
Wit <linuxcdeveloper@gmail.com> wrote:
> Hello All!
>
> As for now user has not much influence on creation of contents of an
> INITRD image I've made some proof of concept of some wider idea of
> creating customizable INITRD image.
> This patch adds possibility of creating customizable INITRD image by
> selecting some of packages to install. At the moment it supports only
> glibc builds but I planned to add support for musl and uClibc as well.
> I've got also some other plans regarding this patch.
> This patch adds new submenu in "Filesystem images" main menu.
>
> I'm sending this patch for evaluation. If the idea of this patch is ok
> for you I could take care of developing it.
>
> Signed-off-by: Witold Kowolik <linuxcdeveloper@gmail.com>
Thanks for your proposal. A couple of comments:
(1) Your patch is line-wrapped, so difficult to review. Could you use
git send-email to send your patches?
(2) Have you looked at Dracut and its integration in Buildroot? Because
to me it does pretty much the same as what you're doing. We know
Dracut's integration in Buildroot has some shortcomings, but I'd
rather see them being resolved rather than introduce another new
mechanism.
(3) I see you're using a Perl script. We generally try to have most of
the Buildroot plumbing implemented either in shell or in Python.
However, it's true that having a Python interpreter on the host is
no longer required, while having a Perl interpreter is (which would
go in favor of keeping a Perl script).
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] Fwd: [PATCH] fs/user-initrd: add new method for building customizable INITRD
2023-09-13 9:45 ` Thomas Petazzoni via buildroot
@ 2023-09-13 13:30 ` Yann E. MORIN
2023-09-13 14:27 ` Wit
0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2023-09-13 13:30 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot, Adam Duskett, Thierry Bultel, Wit
Witold, All,
+Adam +Thierry for dracut
On 2023-09-13 11:45 +0200, Thomas Petazzoni via buildroot spake thusly:
> On Wed, 13 Sep 2023 06:41:48 +0200
> Wit <linuxcdeveloper@gmail.com> wrote:
> > As for now user has not much influence on creation of contents of an
> > INITRD image I've made some proof of concept of some wider idea of
> > creating customizable INITRD image.
> > This patch adds possibility of creating customizable INITRD image by
> > selecting some of packages to install. At the moment it supports only
> > glibc builds but I planned to add support for musl and uClibc as well.
> > I've got also some other plans regarding this patch.
> > This patch adds new submenu in "Filesystem images" main menu.
> >
> > I'm sending this patch for evaluation. If the idea of this patch is ok
> > for you I could take care of developing it.
> >
> > Signed-off-by: Witold Kowolik <linuxcdeveloper@gmail.com>
>
> Thanks for your proposal. A couple of comments:
>
> (1) Your patch is line-wrapped, so difficult to review. Could you use
> git send-email to send your patches?
While at the formatting:
- commit author (i.e. email sender) must match the SoB line
- commit title should be: fs/user-initrd: new filesystem (but see
below)
- commit log should motivat the patch, and provide explanations on how
the patch is "designed" (don't describe, but expalain); also, no
personal message (no "I am ..." "I do..." etc...)
> (2) Have you looked at Dracut and its integration in Buildroot? Because
> to me it does pretty much the same as what you're doing. We know
> Dracut's integration in Buildroot has some shortcomings, but I'd
> rather see them being resolved rather than introduce another new
> mechanism.
Exactly. We have an implementation of dracut, even if rickety, so I too
believe that, if anything, that should be fixed where it is broken,
rather than add a new tool with only a (very limited) subset of the
features that dracut already provides.
> (3) I see you're using a Perl script. We generally try to have most of
> the Buildroot plumbing implemented either in shell or in Python.
> However, it's true that having a Python interpreter on the host is
> no longer required, while having a Perl interpreter is (which would
> go in favor of keeping a Perl script).
We do require perl because some packages need perl as part of their
buildsystem:
- libxml-parser-perl, intltool (496078a0a053 dependencies: add perl as
a mandatory dependency)
- the linux kernel
In Buildroot, nothing requires perl: we have no tooling written in perl,
and I would prefer that stays that way. We however have a lot of python
tooling, so if at all, I'd rather we add python as a requirement (or at
least tht we check for it and disable whatever needs it, or that it
depends on host-python3).
So, let's try and keep perl out of Buildroot, and keep writing python
scripts. At the worst, shell scripts, but not perl.
Regards,
Yann E. MORIN.
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] Fwd: [PATCH] fs/user-initrd: add new method for building customizable INITRD
2023-09-13 13:30 ` Yann E. MORIN
@ 2023-09-13 14:27 ` Wit
0 siblings, 0 replies; 4+ messages in thread
From: Wit @ 2023-09-13 14:27 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: Adam Duskett, Thierry Bultel, Thomas Petazzoni, buildroot
śr., 13 wrz 2023 o 15:30 Yann E. MORIN <yann.morin.1998@free.fr> napisał(a):
>
> Witold, All,
>
> +Adam +Thierry for dracut
>
> On 2023-09-13 11:45 +0200, Thomas Petazzoni via buildroot spake thusly:
> > On Wed, 13 Sep 2023 06:41:48 +0200
> > Wit <linuxcdeveloper@gmail.com> wrote:
> > > As for now user has not much influence on creation of contents of an
> > > INITRD image I've made some proof of concept of some wider idea of
> > > creating customizable INITRD image.
> > > This patch adds possibility of creating customizable INITRD image by
> > > selecting some of packages to install. At the moment it supports only
> > > glibc builds but I planned to add support for musl and uClibc as well.
> > > I've got also some other plans regarding this patch.
> > > This patch adds new submenu in "Filesystem images" main menu.
> > >
> > > I'm sending this patch for evaluation. If the idea of this patch is ok
> > > for you I could take care of developing it.
> > >
> > > Signed-off-by: Witold Kowolik <linuxcdeveloper@gmail.com>
> >
> > Thanks for your proposal. A couple of comments:
> >
> > (1) Your patch is line-wrapped, so difficult to review. Could you use
> > git send-email to send your patches?
I tried yesterday to send this patch this way (git send-email) but
seems like finally it didn't arrive to mailing list.
Maybe because I didn't subscribe the mailing list yesterday yet? Don't know.
Today after subscribing I sent it from web mailer and seems like web
mailer wrapped the lines in the patch.
> While at the formatting:
> - commit author (i.e. email sender) must match the SoB line
> - commit title should be: fs/user-initrd: new filesystem (but see
> below)
> - commit log should motivat the patch, and provide explanations on how
> the patch is "designed" (don't describe, but expalain); also, no
> personal message (no "I am ..." "I do..." etc...)
Thanks for explanation.
> > (2) Have you looked at Dracut and its integration in Buildroot? Because
> > to me it does pretty much the same as what you're doing. We know
> > Dracut's integration in Buildroot has some shortcomings, but I'd
> > rather see them being resolved rather than introduce another new
> > mechanism.
Yes, I've seen dracut but I wanted to do something on my own :)
> Exactly. We have an implementation of dracut, even if rickety, so I too
> believe that, if anything, that should be fixed where it is broken,
> rather than add a new tool with only a (very limited) subset of the
> features that dracut already provides.
Ok, I see, np.
> > (3) I see you're using a Perl script. We generally try to have most of
> > the Buildroot plumbing implemented either in shell or in Python.
> > However, it's true that having a Python interpreter on the host is
> > no longer required, while having a Perl interpreter is (which would
> > go in favor of keeping a Perl script).
>
> We do require perl because some packages need perl as part of their
> buildsystem:
> - libxml-parser-perl, intltool (496078a0a053 dependencies: add perl as
> a mandatory dependency)
> - the linux kernel
>
> In Buildroot, nothing requires perl: we have no tooling written in perl,
> and I would prefer that stays that way. We however have a lot of python
> tooling, so if at all, I'd rather we add python as a requirement (or at
> least tht we check for it and disable whatever needs it, or that it
> depends on host-python3).
>
> So, let's try and keep perl out of Buildroot, and keep writing python
> scripts. At the worst, shell scripts, but not perl.
Ok, so the final conclusion for me is that it is not worth to spend
more time on developing this patch for buildroot.
Thanks for explanations Thomas and Yann.
Kind Regards,
WK
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-13 14:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAEVrM6T=5vb98vVUr4AxNWf7xV6VSLyuNME1HpxW=KVJR1vvQw@mail.gmail.com>
2023-09-13 4:41 ` [Buildroot] Fwd: [PATCH] fs/user-initrd: add new method for building customizable INITRD Wit
2023-09-13 9:45 ` Thomas Petazzoni via buildroot
2023-09-13 13:30 ` Yann E. MORIN
2023-09-13 14:27 ` Wit
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.