diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-11-03 17:19:19 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-11-05 22:26:54 -0800 |
commit | 2e7666002780e8e4b75092f20a7216d5ef989e5f (patch) | |
tree | a6ce585afdc1afdf1c204e653e14711f8f163cc0 /meta-oe/recipes-core/toybox/toybox_0.8.10.bb | |
parent | e849f51ea99a8441c89634339ce89114bd5df521 (diff) | |
download | meta-openembedded-2e7666002780e8e4b75092f20a7216d5ef989e5f.tar.gz |
toybox: upgrade 0.8.8 -> 0.8.10
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-core/toybox/toybox_0.8.10.bb')
-rw-r--r-- | meta-oe/recipes-core/toybox/toybox_0.8.10.bb | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/toybox/toybox_0.8.10.bb b/meta-oe/recipes-core/toybox/toybox_0.8.10.bb new file mode 100644 index 000000000..d747ebf36 --- /dev/null +++ b/meta-oe/recipes-core/toybox/toybox_0.8.10.bb | |||
@@ -0,0 +1,113 @@ | |||
1 | SUMMARY = "Toybox combines common utilities together into a single executable." | ||
2 | HOMEPAGE = "http://www.landley.net/toybox/" | ||
3 | DEPENDS = "attr virtual/crypt" | ||
4 | |||
5 | LICENSE = "0BSD" | ||
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=78659a599b9325da368f2f1eb88f19c7" | ||
7 | |||
8 | inherit cml1 update-alternatives | ||
9 | |||
10 | SRC_URI = "http://www.landley.net/toybox/downloads/${BPN}-${PV}.tar.gz" | ||
11 | SRC_URI[sha256sum] = "d3afee05ca90bf425ced73f527e418fecd626c5340b5f58711a14531f8d7d108" | ||
12 | |||
13 | SECTION = "base" | ||
14 | |||
15 | RDEPENDS:${PN} = "${@["", "toybox-inittab"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'toybox')]}" | ||
16 | |||
17 | TOYBOX_BIN = "generated/unstripped/toybox" | ||
18 | |||
19 | # Toybox is strict on what CC, CFLAGS and CROSS_COMPILE variables should contain. | ||
20 | # Fix CC, CFLAGS, CROSS_COMPILE to match expectations. | ||
21 | # CC = compiler name | ||
22 | # CFLAGS = only compiler flags | ||
23 | # CROSS_COMPILE = compiler prefix | ||
24 | CFLAGS += "${TOOLCHAIN_OPTIONS} ${TUNE_CCARGS}" | ||
25 | |||
26 | COMPILER:toolchain-clang = "clang" | ||
27 | COMPILER ?= "gcc" | ||
28 | |||
29 | PACKAGECONFIG ??= "no-iconv no-getconf" | ||
30 | |||
31 | PACKAGECONFIG[no-iconv] = ",," | ||
32 | PACKAGECONFIG[no-getconf] = ",," | ||
33 | |||
34 | EXTRA_OEMAKE = 'CROSS_COMPILE="${HOST_PREFIX}" \ | ||
35 | CC="${COMPILER}" \ | ||
36 | STRIP="strip" \ | ||
37 | CFLAGS="${CFLAGS}" \ | ||
38 | HOSTCC="${BUILD_CC}" CPUS=${@oe.utils.cpu_count()} V=1' | ||
39 | |||
40 | do_configure() { | ||
41 | # allow user to define their own defconfig in bbappend, taken from kernel.bbclass | ||
42 | if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then | ||
43 | mv "${S}/.config" "${B}/.config" | ||
44 | fi | ||
45 | |||
46 | # Copy defconfig to .config if .config does not exist. This allows | ||
47 | # recipes to manage the .config themselves in do_configure:prepend(). | ||
48 | if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then | ||
49 | cp "${WORKDIR}/defconfig" "${B}/.config" | ||
50 | fi | ||
51 | |||
52 | oe_runmake oldconfig || oe_runmake defconfig | ||
53 | |||
54 | # Disable killall5 as it isn't managed by update-alternatives | ||
55 | sed -e 's/CONFIG_KILLALL5=y/# CONFIG_KILLALL5 is not set/' -i .config | ||
56 | |||
57 | # Disable swapon as it doesn't handle the '-a' argument used during boot | ||
58 | sed -e 's/CONFIG_SWAPON=y/# CONFIG_SWAPON is not set/' -i .config | ||
59 | |||
60 | # Enable init if toybox was set as init manager | ||
61 | if ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','toybox','true','false',d)}; then | ||
62 | sed -e 's/# CONFIG_INIT is not set/CONFIG_INIT=y/' -i .config | ||
63 | fi | ||
64 | } | ||
65 | |||
66 | do_compile() { | ||
67 | oe_runmake ${TOYBOX_BIN} | ||
68 | |||
69 | # Create a list of links needed | ||
70 | ${BUILD_CC} -I . scripts/install.c -o generated/instlist | ||
71 | ./generated/instlist long | sed -e 's#^#/#' > toybox.links | ||
72 | if ${@bb.utils.contains('PACKAGECONFIG','no-iconv','true','false',d)}; then | ||
73 | sed -i -e '/iconv$/d' toybox.links | ||
74 | fi | ||
75 | if ${@bb.utils.contains('PACKAGECONFIG','no-getconf','true','false',d)}; then | ||
76 | sed -i -e '/getconf$/d' toybox.links | ||
77 | fi | ||
78 | } | ||
79 | |||
80 | do_install() { | ||
81 | # Install manually instead of using 'make install' | ||
82 | install -d ${D}${base_bindir} | ||
83 | if grep -q "CONFIG_TOYBOX_SUID=y" ${B}/.config; then | ||
84 | install -m 4755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox | ||
85 | else | ||
86 | install -m 0755 ${B}/${TOYBOX_BIN} ${D}${base_bindir}/toybox | ||
87 | fi | ||
88 | |||
89 | install -d ${D}${sysconfdir} | ||
90 | install -m 0644 ${B}/toybox.links ${D}${sysconfdir} | ||
91 | } | ||
92 | |||
93 | # If you've chosen to install toybox you probably want it to take precedence | ||
94 | # over busybox where possible but not over other packages | ||
95 | ALTERNATIVE_PRIORITY = "60" | ||
96 | |||
97 | python do_package:prepend () { | ||
98 | # Read links from /etc/toybox.links and create appropriate | ||
99 | # update-alternatives variables | ||
100 | |||
101 | dvar = d.getVar('D') | ||
102 | pn = d.getVar('PN') | ||
103 | target = d.expand("${base_bindir}/toybox") | ||
104 | |||
105 | f = open('%s/etc/toybox.links' % (dvar), 'r') | ||
106 | for alt_link_name in f: | ||
107 | alt_link_name = alt_link_name.strip() | ||
108 | alt_name = os.path.basename(alt_link_name) | ||
109 | d.appendVar('ALTERNATIVE:%s' % (pn), ' ' + alt_name) | ||
110 | d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name) | ||
111 | d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target) | ||
112 | f.close() | ||
113 | } | ||