summaryrefslogtreecommitdiffstats
path: root/meta-initramfs/recipes-devtools
diff options
context:
space:
mode:
authorKoen Kooi <koen.kooi@oss.qualcomm.com>2025-07-04 13:17:27 +0200
committerKhem Raj <raj.khem@gmail.com>2025-07-04 09:42:10 -0700
commit92ef23b0845f01c649b8a34033035fafbb749d34 (patch)
treee7f057b7692897823ffd93181a9875cd9c70e134 /meta-initramfs/recipes-devtools
parent1c3a75acc03aa31ca013e5e3f4341ddd9ee9e667 (diff)
downloadmeta-openembedded-92ef23b0845f01c649b8a34033035fafbb749d34.tar.gz
dracut: add 'git' recipe with DEFAULT_PREFERENCE = -1
This updates to a revision that has PR1260, which uses ELF entries to get dependencies instead of (cross-)ldd. This makes it useable as a tool to generate initramfses using cross tools, in e.g. do_rootfs. Since this is not using a tagged release and changes the base logic, add it as a non-default option using DEFAULT_PREFERENCE = -1. Extend to native(-sdk) to accomplish just that. The host-built initramfs (using a custom bbclass) as well as the on-target built initramfs have been tested on qrb2210-rb1-core-kit and qcs6490-rb3gen-core-kit machines and work as intented. Signed-off-by: Koen Kooi <koen.kooi@oss.qualcomm.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-initramfs/recipes-devtools')
-rw-r--r--meta-initramfs/recipes-devtools/dracut/dracut_git.bb106
1 files changed, 106 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-devtools/dracut/dracut_git.bb b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
new file mode 100644
index 0000000000..4a8e7e56aa
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
@@ -0,0 +1,106 @@
1SUMMARY = "Initramfs generator using udev"
2HOMEPAGE = "https://dracut.wiki.kernel.org/index.php/Main_Page"
3DESCRIPTION = "Dracut is an event driven initramfs infrastructure. dracut (the tool) is used to create an initramfs image by copying tools and files from an installed system and combining it with the dracut framework, usually found in /usr/lib/dracut/modules.d."
4
5LICENSE = "GPL-2.0-only"
6LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
7
8# Since this is not using a release tag *and* features a rewrite of the dependency logic:
9DEFAULT_PREFERENCE = "-1"
10
11PE = "1"
12
13# We want to drag in PR1260 to use ELF .note.dlopen entries instead of (cross-)ldd, but that was applied a week after the 107 tag
14PV = "107+git"
15SRCREV = "79ffbd28294818a36e515a441142125d70e3acbb"
16SRC_URI = "git://github.com/dracut-ng/dracut-ng.git;protocol=http;branch=main \
17 "
18
19DEPENDS += "kmod"
20DEPENDS:append:libc-musl = " fts"
21
22inherit bash-completion pkgconfig
23
24EXTRA_OECONF = "--prefix=${prefix} \
25 --libdir=${nonarch_libdir} \
26 --datadir=${datadir} \
27 --sysconfdir=${sysconfdir} \
28 --sbindir=${sbindir} \
29 --bindir=${bindir} \
30 --includedir=${includedir} \
31 --localstatedir=${localstatedir} \
32 --disable-documentation \
33 "
34
35# RDEPEND on systemd optionally
36PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
37PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,,,systemd"
38
39EXTRA_OEMAKE += 'libdir=${nonarch_libdir} LDLIBS="${LDLIBS}" enable_test=no DRACUT_FULL_VERSION=${PV}'
40
41CFLAGS:append = " -fPIC"
42LDLIBS:append:libc-musl = " -lfts"
43
44do_configure() {
45 ./configure ${EXTRA_OECONF}
46}
47
48do_install() {
49 oe_runmake install DESTDIR=${D}
50 # Its Makefile uses cp -arx to install modules.d, so fix the owner
51 # to root:root
52 chown -R root:root ${D}/${nonarch_libdir}/dracut/modules.d \
53 ${D}/${nonarch_libdir}/dracut/dracut.conf.d
54
55 if ! ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
56 rm -rf ${D}${nonarch_libdir}/systemd
57 fi
58}
59
60do_install:append:class-target () {
61 # Generate and install a config file listing where the DISTRO puts things, dracut
62 # is not always savvy enough to figure it out by itself
63 # Since this primarily fixes systemd issues, only install it when using systemd.
64 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
65 cat << EOF > ${B}/${DISTRO}.conf
66stdloglvl=3
67sysloglvl=5
68sysctlconfdir=${sysconfdir}/sysctl.d
69systemdutildir=${systemd_unitdir}
70systemdutilconfdir=${sysconfdir}/systemd
71systemdcatalog=${systemd_unitdir}catalog
72systemdntpunits=${systemd_unitdir}ntp-units.d
73systemdntpunitsconfdir=${sysconfdir}/systemd/ntp-units.d
74systemdportable=${systemd_unitdir}/portable
75systemdportableconfdir=${sysconfdir}/systemd/portable
76systemdsystemunitdir=${systemd_system_unitdir}
77systemdsystemconfdir=${sysconfdir}/systemd/system
78systemduser=${systemd_user_unitdir}
79systemduserconfdir=${sysconfdir}/systemd/user
80EOF
81 install -m 0644 ${B}/${DISTRO}.conf ${D}${libdir}/dracut/dracut.conf.d/
82 fi
83}
84
85
86FILES:${PN} += "${nonarch_libdir}/kernel \
87 ${nonarch_libdir}/dracut \
88 ${systemd_unitdir} \
89 "
90FILES:${PN}-dbg += "${nonarch_libdir}/dracut/.debug"
91
92CONFFILES:${PN} += "${sysconfdir}/dracut.conf"
93
94# The native variant uses a non-ldd based method of getting library
95# dependencies, so ldd is only needed on the target
96RDEPENDS:${PN} = "findutils cpio util-linux-blkid util-linux-getopt util-linux bash"
97RDEPENDS:${PN}:append:class-target = " ldd"
98
99# This could be optimized a bit, but let's avoid non-booting systems :)
100RRECOMMENDS:${PN}:class-target = "kernel-modules \
101 coreutils \
102 "
103
104BBCLASSEXTEND = "native nativesdk"
105
106CVE_STATUS[CVE-2010-4176] = "not-applicable-platform: Applies only to Fedora"