Skip to contentSkip to conversation

busybox: allow building when prefix is "", not "/usr".

PATCH In review Michael Smith 3 participants 23 messages May 26, 2009 – Jun 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 busybox: allow building when prefix is "", not "/usr".

There was code to handle this, but it needed a tweak to prevent copying a directory on top of itself. Other prefixes (besides /usr) may also work now, but this is untested.

busybox will also build when base_sbindir is "/bin" instead of "/sbin".

---

For insane backwards compatibility reasons (my own fault) I would like to be able to create packages with no /usr and /sbin == /bin. Most autoconf packages are happy about this; busybox just needs a little help.

btw, I have not yet figured out where ${layout_blah} vs. ${blah} should be used (e.g. ${layout_prefix} and ${prefix}). I've tried to be consistent, so I figure there's a 50% chance I guessed right.

 recipes/busybox/busybox.inc |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
recipes/busybox/busybox.inc +11 -6
index acf47f2..04f2cf4 100644
@@ -62,12 +62,15 @@ do_compile() {
 
 do_install () {
 	oe_runmake busybox.links
-	if [ "x${layout_prefix}" = "x" ]; then
-		sed 's:^/usr/:/:' < busybox.links >busybox.links.new
+	if [ "${prefix}" != "/usr" ]; then
+		sed "s:^/usr/:${prefix}/:" busybox.links > busybox.links.new
 		mv busybox.links.new busybox.links
-        elif [ "${layout_prefix}" != "/usr" ]; then
-		echo "warning, busybox.links will lose with this prefix"
 	fi
+	if [ "${base_sbindir}" != "/sbin" ]; then
+		sed "s:^/sbin/:${base_sbindir}/:" busybox.links > busybox.links.new
+		mv busybox.links.new busybox.links
+	fi
+
 	unset CFLAGS CPPFLAGS CXXFLAGS
 	install -d ${D}${sysconfdir}/init.d
 	oe_runmake "PREFIX=${D}" install
@@ -77,9 +80,11 @@ do_install () {
 	install -d ${D}/busybox
 	ls ${D} -R
 
-	for i in ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ; do
+	# Copy /bin and /sbin -- and /usr, if prefix is not "".
+	for i in ${D}${base_bindir} ${D}${base_sbindir} ${prefix:+${D}${prefix}}
+	do
 		if [ -d $i ]; then
-			cp -dPr $i ${D}/busybox/
+			cp -pPR $i ${D}/busybox/
 		fi
 	done
 	# Move the busybox binary back to /bin
Signature · 1 line
1.5.6.5
#1 lore raw

recipes/busybox/busybox.inc do_install () { · line 89

Quoted 7 lines · Michael Smith
recipes/busybox/busybox.inc +3 -1
+	for i in ${D}${base_bindir} ${D}${base_sbindir} ${prefix:+${D}${prefix}}
+	do
 		if [ -d $i ]; then
-			cp -dPr $i ${D}/busybox/
+			cp -pPR $i ${D}/busybox/
 		fi
 	done

I missed this in the commit message: I changed cp -dPr -> -pPR to match the options given a few lines above. -d implies -P, and -r/-R are equivalent, so I suspected a typo. I'll resend with a new description.

Mike

#2 lore raw

PATCH 1/1 busybox: allow building when prefix is "", not "/usr".

There was code to handle this, but it needed a tweak to prevent copying a directory on top of itself. Other prefixes (besides /usr) may also work now, but this is untested.

busybox will also build when base_sbindir is "/bin" instead of "/sbin".

Also correct possible typo: "cp -dPr" to "cp -pPR", to match the usage a few lines above. -d implies -P.

---
 recipes/busybox/busybox.inc |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
recipes/busybox/busybox.inc +11 -6
index acf47f2..04f2cf4 100644
@@ -62,12 +62,15 @@ do_compile() {
 
 do_install () {
 	oe_runmake busybox.links
-	if [ "x${layout_prefix}" = "x" ]; then
-		sed 's:^/usr/:/:' < busybox.links >busybox.links.new
+	if [ "${prefix}" != "/usr" ]; then
+		sed "s:^/usr/:${prefix}/:" busybox.links > busybox.links.new
 		mv busybox.links.new busybox.links
-        elif [ "${layout_prefix}" != "/usr" ]; then
-		echo "warning, busybox.links will lose with this prefix"
 	fi
+	if [ "${base_sbindir}" != "/sbin" ]; then
+		sed "s:^/sbin/:${base_sbindir}/:" busybox.links > busybox.links.new
+		mv busybox.links.new busybox.links
+	fi
+
 	unset CFLAGS CPPFLAGS CXXFLAGS
 	install -d ${D}${sysconfdir}/init.d
 	oe_runmake "PREFIX=${D}" install
@@ -77,9 +80,11 @@ do_install () {
 	install -d ${D}/busybox
 	ls ${D} -R
 
-	for i in ${D}${base_bindir} ${D}${base_sbindir} ${D}${prefix} ; do
+	# Copy /bin and /sbin -- and /usr, if prefix is not "".
+	for i in ${D}${base_bindir} ${D}${base_sbindir} ${prefix:+${D}${prefix}}
+	do
 		if [ -d $i ]; then
-			cp -dPr $i ${D}/busybox/
+			cp -pPR $i ${D}/busybox/
 		fi
 	done
 	# Move the busybox binary back to /bin
Signature · 1 line
1.5.6.5
#3 lore raw
Quoted 8 lines · Michael Smith

There was code to handle this, but it needed a tweak to prevent copying a directory on top of itself. Other prefixes (besides /usr) may also work now, but this is untested.

busybox will also build when base_sbindir is "/bin" instead of "/sbin".

Also correct possible typo: "cp -dPr" to "cp -pPR", to match the usage a few lines above. -d implies -P.

I've checked this in now. Thanks for the patch.

p.

#4 lore raw
Quoted 11 lines · Phil Blundell
Quoted 8 lines · Michael Smith

There was code to handle this, but it needed a tweak to prevent copying a directory on top of itself. Other prefixes (besides /usr) may also work now, but this is untested.

busybox will also build when base_sbindir is "/bin" instead of "/sbin".

Also correct possible typo: "cp -dPr" to "cp -pPR", to match the usage a few lines above. -d implies -P.

I've checked this in now. Thanks for the patch.

Heh... I actually did up a new series this morning with a simpler fix. Was going to send it in tonight. :)

I don't know if you want to revert it, or I can just rebase.

Mike

#5 lore raw
Quoted 11 lines · Michael Smith
Quoted 10 lines · Phil Blundell
Quoted 8 lines · Michael Smith

There was code to handle this, but it needed a tweak to prevent copying a directory on top of itself. Other prefixes (besides /usr) may also work now, but this is untested.

busybox will also build when base_sbindir is "/bin" instead of "/sbin".

Also correct possible typo: "cp -dPr" to "cp -pPR", to match the usage a few lines above. -d implies -P.

Quoted 6 lines
Quoted 1 line

I've checked this in now. Thanks for the patch.

Heh... I actually did up a new series this morning with a simpler fix. Was going to send it in tonight. :)

I don't know if you want to revert it, or I can just rebase.

Doh! Oh well, probably easiest for you to just rebase your tree and diff against what's there now.

p.

#6 lore raw

PATCH 1/2 busybox: let update-alternatives create all symlinks, and use INC_PR

Back in 2005, commit 5e01906b set this up; in f7f1ac27 the recipe was changed to keep all the links in the package.

This changes it back, and also removes special treatment of the links for crond, httpd, udhcpd, hwclock, and udhcpc.

---
 recipes/busybox/busybox-static_1.11.3.bb |    2 +-
 recipes/busybox/busybox.inc              |   46 ++++-------------------------
 recipes/busybox/busybox_1.11.3.bb        |    2 +-
 recipes/busybox/busybox_1.13.2.bb        |    2 +-
 recipes/busybox/busybox_1.2.1.bb         |    2 +-
 recipes/busybox/busybox_1.2.2.bb         |    2 +-
 recipes/busybox/busybox_1.3.1.bb         |    2 +-
 recipes/busybox/busybox_1.7.2.bb         |    2 +-
 recipes/busybox/busybox_1.9.2.bb         |    2 +-
 9 files changed, 15 insertions(+), 47 deletions(-)
recipes/busybox/busybox-static_1.11.3.bb +1 -1
index 9529ab7..6523fa9 100644
@@ -1,5 +1,5 @@
 require busybox_${PV}.bb
-PR = "r4"
+PR = "${INC_PR}.1"
 
 FILESPATH = "${FILE_DIRNAME}/busybox-${PV}:${FILE_DIRNAME}/files:${FILE_DIRNAME}"
 S = "${WORKDIR}/busybox-${PV}"
recipes/busybox/busybox.inc +6 -38

76 lines not on this page · raw message

recipes/busybox/busybox_1.11.3.bb +1 -1
index bd03aa8..673fe15 100644
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r15"
+PR = "${INC_PR}.1"
 
 SRC_URI = "\
   http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
recipes/busybox/busybox_1.13.2.bb +1 -1
index 96d0f0b..c1cc51b 100644
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r19"
+PR = "${INC_PR}.1"
 
 SRC_URI = "\
   http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
recipes/busybox/busybox_1.2.1.bb +1 -1
index 63a93df..3630a46 100644
@@ -1,6 +1,6 @@
 require busybox.inc
 
-PR = "r19"
+PR = "${INC_PR}.1"
 
 SRC_URI += "file://wget-long-options.patch;patch=1 \
 	   file://df_rootfs.patch;patch=1 \
recipes/busybox/busybox_1.2.2.bb +1 -1
index fe9d07e..43a15d0 100644
@@ -1,6 +1,6 @@
 require busybox.inc
 
-PR = "r5"
+PR = "${INC_PR}.1"
 
 DEFAULT_PREFERENCE = "-1"
 
recipes/busybox/busybox_1.3.1.bb +1 -1
index 2cdb81b..e0fd63b 100644
@@ -1,6 +1,6 @@
 require busybox.inc
 
-PR = "r5"
+PR = "${INC_PR}.1"
 
 DEFAULT_PREFERENCE = "-1"
 
recipes/busybox/busybox_1.7.2.bb +1 -1
index 87d336b..6af073f 100644
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r13"
+PR = "${INC_PR}.1"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
            file://busybox-cron \
recipes/busybox/busybox_1.9.2.bb +1 -1
index e9aa820..64f9c62 100644
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r6"
+PR = "${INC_PR}.1"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
            file://udhcpscript.patch;patch=1 \
Signature · 1 line
1.6.3
#7 lore raw

PATCH 2/2 busybox: Split syslog initscript into busybox-syslog

The same is already done for httpd and udhcpd.

This fixes Busybox deb upgrades: the prerm script was failing because the last command "/etc/init.d/syslog stop", added by the update-rc.d class, runs after the /bin/sh symlink has been removed.

Many images expect busybox to contain the syslog initscript, so busybox RRECOMMENDS busybox-syslog.

busybox-{syslog,httpd,udhcpd} now RDEPEND on busybox, for consistency with other packages in the recipe (e.g. busybox-mdev).

---
 recipes/busybox/busybox.inc |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)
recipes/busybox/busybox.inc +19 -7
index e312147..1f2731d 100644
@@ -33,24 +33,34 @@ SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1"
 
 export EXTRA_CFLAGS = "${CFLAGS}"
 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
-PACKAGES =+ "${PN}-httpd ${PN}-udhcpd"
+PACKAGES =+ "${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
+
 # We need this RRECOMMENDS because libc dlopens libgcc
 # and shlib mechanism can not detect it because its not
 # listed in the NEEDED field.
 RRECOMMENDS += "libgcc"
+
+# Make busybox recommend busybox-syslog for those images that expect it
+RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"
+
 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
+FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog ${sysconfdir}/syslog.conf"
 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
 
 FILES_${PN} += "${datadir}/udhcpc"
 
-INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
+INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
+INITSCRIPT_NAME_${PN}-syslog = "syslog"
 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" 
-INITSCRIPT_NAME_${PN} = "syslog"
-CONFFILES_${PN} = "${sysconfdir}/syslog.conf"
+CONFFILES_${PN}-syslog = "${sysconfdir}/syslog.conf"
 
 # This disables the syslog startup links in slugos (see slugos-init)
-INITSCRIPT_PARAMS_${PN}_slugos = "start 20 ."
+INITSCRIPT_PARAMS_${PN}-syslog_slugos = "start 20 ."
+
+RDEPENDS_${PN}-httpd += "${PN}"
+RDEPENDS_${PN}-syslog += "${PN}"
+RDEPENDS_${PN}-udhcpd += "${PN}"
 
 # Use gcc for linking so LDFLAGS actually makes sense
 LD = "${CC} -nostdlib"
@@ -81,8 +91,10 @@ do_install () {
 	install -m 0755 ${S}/busybox ${D}${base_bindir}
 	ln -sf busybox ${D}${base_bindir}/sh
 
-	install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
-	install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
+	if grep -q "CONFIG_SYSLOGD=y" ${WORKDIR}/defconfig; then
+		install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
+		install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
+	fi
 	if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
 		install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
 	fi
Signature · 1 line
1.6.3
#8 lore raw

Re: [PATCH 1/2] busybox: let update-alternatives create all symlinks, and use INC_PR

In reply to Michael Smith
Quoted 7 lines · Michael Smith

Back in 2005, commit 5e01906b set this up; in f7f1ac27 the recipe was changed to keep all the links in the package.

This changes it back, and also removes special treatment of the links for crond, httpd, udhcpd, hwclock, and udhcpc.

Thanks, looks good (and it works for me with the "micro" distro). I checked this in.

p.

#9 lore raw
In reply to Michael Smith
Quoted 13 lines · Michael Smith

recipes/busybox/busybox.inc do_install () { · line 89

Quoted 7 lines · Michael Smith
recipes/busybox/busybox.inc +3 -1
+	for i in ${D}${base_bindir} ${D}${base_sbindir} ${prefix:+${D}${prefix}}
+	do
 		if [ -d $i ]; then
-			cp -dPr $i ${D}/busybox/
+			cp -pPR $i ${D}/busybox/
 		fi
 	done

I missed this in the commit message: I changed cp -dPr -> -pPR to match the options given a few lines above. -d implies -P, and -r/-R are equivalent, so I suspected a typo. I'll resend with a new description.

Good spotting. There seems to be more wrong with this code than that,
though: the comment above says "Move everything to /busybox...", but the code (both before and after your change) seems to copy rather than moving which would appear to defeat the point of this whole block of code. We had a discussion about this on IRC a few weeks ago but I don't think there was any real conclusion to that.

It looks from the git history as though this stuff has been broken for a while (since busybox_1.9.1 at least) but I didn't have the patience to chase it back any further than that.

Anyway, if you felt like having a go at fixing this too, that'd be awesome.

p.

#10 lore raw
Quoted 6 lines · Phil Blundell

Good spotting. There seems to be more wrong with this code than that,
though: the comment above says "Move everything to /busybox...", but the code (both before and after your change) seems to copy rather than moving which would appear to defeat the point of this whole block of code. We had a discussion about this on IRC a few weeks ago but I don't think there was any real conclusion to that.

Oh yeah... heh... I guess that copy kind of defeats the purpose. The package ends up containing all the symlinks instead of letting update-alternatives take care of it in postinst.

I changed the "cp" back to "mv" and the package looks a bit lighter on symlinks, and the final rootfs is the same. I'd still want to play a bit with upgrades though, and that may be a while. If it looks OK, I'll send it up as a separate patch later.

This is where it changed from mv to cp:

commit f7f1ac27e90f042fa1c4322b193b5b6a27cd4c07

Author: Koen Kooi <[email protected]>
Date:   Sat Aug 26 14:02:37 2006 +0000

busybox 1.2.1: replace mv with a non-gnu-ish cp

Mike

#11 lore raw
Quoted 5 lines · Michael Smith

I changed the "cp" back to "mv" and the package looks a bit lighter on symlinks, and the final rootfs is the same. I'd still want to play a bit with upgrades though, and that may be a while. If it looks OK, I'll send it up as a separate patch later.

Quoted 7 lines

This is where it changed from mv to cp:

commit f7f1ac27e90f042fa1c4322b193b5b6a27cd4c07

Author: Koen Kooi <[email protected]>
Date:   Sat Aug 26 14:02:37 2006 +0000

busybox 1.2.1: replace mv with a non-gnu-ish cp

Okay, great. Yeah, that commit f7f1ac27e90f042fa1c4322b193b5b6a27cd4c07 looks fairly bogus: I don't know what the intent of it was, but it doesn't seem like it can be the right way to solve any problem.

Keep us posted once you've had a chance to test the upgrades.

p.

#12 lore raw
In reply to Michael Smith
Quoted 4 lines · Michael Smith

For insane backwards compatibility reasons (my own fault) I would like to be able to create packages with no /usr and /sbin == /bin. Most autoconf packages are happy about this; busybox just needs a little help.

This looks pretty cool. I've been thinking for a while that it would be nice to eliminate /usr for embedded distros such as micro (and maybe minimal). That separation is basically just a waste of time and space on those kinds of devices.

Quoted 3 lines

btw, I have not yet figured out where ${layout_blah} vs. ${blah} should be used (e.g. ${layout_prefix} and ${prefix}). I've tried to be consistent, so I figure there's a 50% chance I guessed right.

I'm not quite sure either but I think the recipes should probably always be using ${blah}, as you've done. I don't remember now why I introduced ${layout_blah} into busybox.bb in the first place but I suspect it was probably an attempt to work around some kind of Qt and/or MythTV-related path lossage.

p.

#13 lore raw
In reply to Michael Smith
Quoted 3 lines · Michael Smith

For insane backwards compatibility reasons (my own fault) I would like to be able to create packages with no /usr and /sbin == /bin. Most autoconf packages are happy about this; busybox just needs a little

I found one more issuette: busybox udhcpc still expects to find its scripts in /usr/share/udhcpc irrespective of where ${datadir} actually points to (/share in my case). Can I persuade you to take a look at that?

p.

#14 lore raw
Quoted 9 lines · Phil Blundell
Quoted 3 lines · Michael Smith

For insane backwards compatibility reasons (my own fault) I would like to be able to create packages with no /usr and /sbin == /bin. Most autoconf packages are happy about this; busybox just needs a little

I found one more issuette: busybox udhcpc still expects to find its scripts in /usr/share/udhcpc irrespective of where ${datadir} actually points to (/share in my case). Can I persuade you to take a look at that?

This is in the defconfig (CONFIG_UDHCPC_DEFAULT_SCRIPT). We might be able to get around it by passing -DCONFIG_UDHCPC_DEFAULT_SCRIPT=${datadir}/udhcpc/default.script as a CFLAG.

It would make it a bit harder for someone to change the script name for their distro. Should just leave it up to distros to fix the script name, or should I force it as a CFLAG? (BTW, in my distro I pass a flag to udhcpc to use an entirely different script path.)

I've also found it makes life easier to have symlinks for /usr pointing to ., and /sbin pointing to /bin. It means if I miss a hardcoded path in a binary like this, the package still works. But I have to chase down any packages that actually install files to /usr or /sbin -- otherwise when they're upgraded, dpkg removes the symlink and creates a /usr/bin or /sbin with one file in it :)

Mike

#15 lore raw
Quoted 3 lines · Michael Smith

This is in the defconfig (CONFIG_UDHCPC_DEFAULT_SCRIPT). We might be able to get around it by passing -DCONFIG_UDHCPC_DEFAULT_SCRIPT=${datadir}/udhcpc/default.script as a CFLAG.

Ah, so it is.

How about changing the defconfig file to read:

CONFIG_UDHCPC_DEFAULT_SCRIPT="!DATADIR!/udhcpc/default.script"

and then, in do_configure, replacing the straight "install" with something like:

sed 's#!DATADIR!#${datadir}#' < ${WORKDIR}/defconfig > ${S}/.config

Those folks with custom defconfigs shouldn't notice any difference unless they were unlucky enough to have written "!DATADIR!" somewhere in them. :-}

p.

#16 lore raw
Quoted 8 lines · Phil Blundell
Quoted 1 line · Michael Smith

This is in the defconfig (CONFIG_UDHCPC_DEFAULT_SCRIPT).

Ah, so it is.

How about changing the defconfig file to read:

CONFIG_UDHCPC_DEFAULT_SCRIPT="!DATADIR!/udhcpc/default.script"

OK, sounds good. I'll do that for busybox-1.13.2/defconfig, but I'll leave the defconfigs for distros (angstrom, slugos, kaeilos) as they were.

Mike

#17 lore raw

PATCH 1/1 busybox: Split syslog initscript into busybox-syslog

The same is already done for httpd and udhcpd.

This fixes Busybox deb upgrades: the prerm script was failing because the last command "/etc/init.d/syslog stop", added by the update-rc.d class, runs after the /bin/sh symlink has been removed.

Many images expect busybox to contain the syslog initscript, so busybox RRECOMMENDS busybox-syslog.

busybox-{syslog,httpd,udhcpd} now RDEPEND on busybox, for consistency with other packages in the recipe (e.g. busybox-mdev).

---

Resend, rebased after Koen's change to add busybox-mountall.

 recipes/busybox/busybox.inc |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)
recipes/busybox/busybox.inc +20 -7
index 106938e..19e49fa 100644
@@ -33,26 +33,37 @@ SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1"
 
 export EXTRA_CFLAGS = "${CFLAGS}"
 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
-PACKAGES =+ "${PN}-mountall ${PN}-httpd ${PN}-udhcpd"
+PACKAGES =+ "${PN}-mountall ${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
+
 # We need this RRECOMMENDS because libc dlopens libgcc
 # and shlib mechanism can not detect it because its not
 # listed in the NEEDED field.
 RRECOMMENDS += "libgcc"
+
 FILES_${PN}-mountall = "${sysconfdir}/default/mountall"
 RDEPENDS_${PN} += "${PN}-mountall"
+
+# Make busybox recommend busybox-syslog for those images that expect it
+RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"
+
 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
+FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog ${sysconfdir}/syslog.conf"
 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
 
 FILES_${PN} += "${datadir}/udhcpc"
 
-INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
+INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
+INITSCRIPT_NAME_${PN}-syslog = "syslog"
 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" 
-INITSCRIPT_NAME_${PN} = "syslog"
-CONFFILES_${PN} = "${sysconfdir}/syslog.conf"
+CONFFILES_${PN}-syslog = "${sysconfdir}/syslog.conf"
 
 # This disables the syslog startup links in slugos (see slugos-init)
-INITSCRIPT_PARAMS_${PN}_slugos = "start 20 ."
+INITSCRIPT_PARAMS_${PN}-syslog_slugos = "start 20 ."
+
+RDEPENDS_${PN}-httpd += "${PN}"
+RDEPENDS_${PN}-syslog += "${PN}"
+RDEPENDS_${PN}-udhcpd += "${PN}"
 
 # Use gcc for linking so LDFLAGS actually makes sense
 LD = "${CC} -nostdlib"
@@ -83,8 +94,10 @@ do_install () {
 	install -m 0755 ${S}/busybox ${D}${base_bindir}
 	ln -sf busybox ${D}${base_bindir}/sh
 
-	install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
-	install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
+	if grep -q "CONFIG_SYSLOGD=y" ${WORKDIR}/defconfig; then
+		install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
+		install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
+	fi
 	if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
 		install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
 	fi
Signature · 1 line
1.6.3
#18 lore raw

PATCH 1/1 busybox: fix udhcpc default script location when prefix is not "/usr"

---
 recipes/busybox/busybox-1.13.2/defconfig |    2 +-
 recipes/busybox/busybox.inc              |    8 +++++++-
 recipes/busybox/busybox_1.11.3.bb        |    5 -----
 recipes/busybox/busybox_1.13.2.bb        |    6 ++----
 4 files changed, 10 insertions(+), 11 deletions(-)
recipes/busybox/busybox-1.13.2/defconfig +1 -1
index 0db650f..ddbaa08 100644
@@ -720,7 +720,7 @@ CONFIG_FEATURE_UDHCPC_ARPING=y
 # CONFIG_FEATURE_UDHCP_PORT is not set
 # CONFIG_UDHCP_DEBUG is not set
 # CONFIG_FEATURE_UDHCP_RFC3397 is not set
-CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
+CONFIG_UDHCPC_DEFAULT_SCRIPT="@DATADIR@/udhcpc/default.script"
 CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
 # CONFIG_VCONFIG is not set
 CONFIG_WGET=y
recipes/busybox/busybox.inc +7 -1
index 19e49fa..7b9b929 100644
@@ -11,7 +11,7 @@ LICENSE = "GPL"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r20"
+INC_PR = "r21"
 
 SRC_URI = "\
   http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
@@ -70,6 +70,12 @@ LD = "${CC} -nostdlib"
 
 inherit cml1 update-rc.d
 
+do_configure () {
+	sed -e 's#@DATADIR@#${datadir}#g' \
+		< ${WORKDIR}/defconfig > ${S}/.config
+	cml1_do_configure
+}
+
 do_compile() {
 	unset CFLAGS CPPFLAGS CXXFLAGS
 	base_do_compile
recipes/busybox/busybox_1.11.3.bb +0 -5
index 673fe15..5518264 100644
@@ -25,11 +25,6 @@ SRC_URI = "\
 
 EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX}"
 
-do_configure () {
-	install -m 0644 ${WORKDIR}/defconfig ${S}/.config
-	cml1_do_configure
-}
-
 do_install_append() {
     install -m 0644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/
     install -d ${D}${sysconfdir}/init.d/
recipes/busybox/busybox_1.13.2.bb +2 -4
index c1cc51b..03a7208 100644
@@ -39,12 +39,10 @@ SRC_URI = "\
 
 EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX}"
 
-do_configure () {
-	install -m 0644 ${WORKDIR}/defconfig ${S}/.config
+do_configure_prepend () {
 	if [ "${TARGET_ARCH}" = "avr32" ] ; then
-		sed -i s:CONFIG_FEATURE_OSF_LABEL=y:CONFIG_FEATURE_OSF_LABEL=n: ${S}/.config
+		sed -i s:CONFIG_FEATURE_OSF_LABEL=y:CONFIG_FEATURE_OSF_LABEL=n: ${WORKDIR}/defconfig
 	fi
-	cml1_do_configure
 }
 
 do_install_append() {
Signature · 1 line
1.6.3
#19 lore raw

Re: [PATCH] busybox: fix udhcpc default script location when prefix is not "/usr"

recipes/busybox/busybox-1.13.2/defconfig CONFIG_FEATURE_UDHCPC_ARPING=y · line 723

Quoted 2 lines · Michael Smith
recipes/busybox/busybox-1.13.2/defconfig +1 -1
-CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
+CONFIG_UDHCPC_DEFAULT_SCRIPT="@DATADIR@/udhcpc/default.script"

Great, thanks. I tested this with a qemux86 build and it seems to work fine, so I checked it in.

p.

#20 lore raw

Re: [PATCH] busybox: Split syslog initscript into busybox-syslog

In reply to Michael Smith

recipes/busybox/busybox.inc SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1" · line 47

Quoted 2 lines · Michael Smith
recipes/busybox/busybox.inc +2 -0
+# Make busybox recommend busybox-syslog for those images that expect it
+RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"

I guess it'd be a good idea to make this conditional on CONFIG_SYSLOGD=y. Otherwise, folks who build with syslogd off will see a confusing "unsatisfied recommendation" diagnostic whenever they install busybox.

p.

#21 lore raw

Re: [PATCH] busybox: Split syslog initscript into busybox-syslog

Quoted 8 lines · Phil Blundell

recipes/busybox/busybox.inc SRC_URI_append_nylon = " file://xargs-double-size.patch;patch=1" · line 47

Quoted 2 lines · Michael Smith
recipes/busybox/busybox.inc +2 -0
+# Make busybox recommend busybox-syslog for those images that expect it
+RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"

I guess it'd be a good idea to make this conditional on CONFIG_SYSLOGD=y. Otherwise, folks who build with syslogd off will see a confusing "unsatisfied recommendation" diagnostic whenever they install busybox.

Hi Phil,

I think you had suggested using add_task to insert a Python block after do_fetch and before do_compile to modify RRECOMMENDS_${PN} conditionally based on ${WORKDIR}/defconfig.

What I'm wondering is how would that modification get persisted if, say, bitbake failed during do_compile, and then I restarted it? Would it think from the stamp that it's already done do_mangle_rrecommmends, and not bother running it again? Then RRECOMMENDS_${PN} would go back to whatever it was at parse time, i.e. no busybox-syslog. Is there a way around that?

Thanks,
Mike

#22 lore raw

Re: [PATCH] busybox: Split syslog initscript into busybox-syslog

Quoted 6 lines · Michael Smith

What I'm wondering is how would that modification get persisted if, say, bitbake failed during do_compile, and then I restarted it? Would it think from the stamp that it's already done do_mangle_rrecommmends, and not bother running it again? Then RRECOMMENDS_${PN} would go back to whatever it was at parse time, i.e. no busybox-syslog. Is there a way around that?

Ah, yes, right. The easiest way to deal with that would be to have the function that does the mangling be called during do_package (i.e. listed in PACKAGEFUNCS) rather than as a separate task. This is where things like the shared library dependencies are computed as well.

p.