Skip to contentSkip to conversation

Enable a buildroot-based petitboot bootloader

RFC PATCH New Jeremy Kerr 6 participants 38 messages Jan 16, 2014 – Mar 4, 2014

lore
Share & tools
lore
#0 lore raw

cover Enable a buildroot-based petitboot bootloader

Hi all,

The following series allows us to build a petitboot-based bootloader using buildroot.

Petitboot is a kexec-based bootloader; by plumbing together a few linux utilities, we can implement a bootloader in userspace, using standard Linux drivers for hardware support. There's a bit of background of petitboot in my recent linux.conf.au talk:

http://mirror.linux.org.au/linux.conf.au/2014/Thursday/89-Petitboot_doing_interesting_things_in_your_bootloader_-_Jeremy_Kerr.mp4

And the project homepage:

https://www.kernel.org/pub/linux/kernel/people/geoff/petitboot/petitboot.html

My primary target here is powerpc machines (and this series adds a defconfig to do a powerpc petitboot build), but I've also been able to get most of petitboot working when built as an EFI stub on x86 machines (we still need some platform-specific bits in petitboot for proper configuration persistence).

While most of this series is fairly straightforward, there are a few items that might need a little more attention:

- At the moment, I'm using my local repo for petitboot sources; it may be better to wait until everything is merged upstream. Upstream is still active, and I don't think this should take long.

- We add wide-char support for ncurses; this seems to be working okay, but could do with a little review.

- I still need a couple of tweaks to the target system (/etc/locale and /etc/inittab). At the moment, I'm carrying a change that introduces an overlay for these two files, but that's not suitable for upstream use:

     http://git.ozlabs.org/?p=buildroot;a=commitdiff;h=d50bd74b

Is there any way I can provide updates to these files? The changes aren't board-specific; they're due to petitboot expecting to own the default consoles for UIs. Or is there a better way to do this?

This series is also available in my git tree, at:

git://git.ozlabs.org/~jk/buildroot/

- in the petitboot branch. Note that that branch includes the overlay too, which isn't intended for upstream.

Also, I'd like to give a big thanks to the buildroot developers; being able to re-roll an entire system with one command has made petitboot development *significantly* easier. Also, thanks to Thomas for the nudge to send these changes upstream!

Please let me know if you have questions/comments/etc.

Cheers,

Jeremy

---
Jeremy Kerr (8):
package/busybox: Add facility for DHCP hooks package/dropbear: Add separate configuration options for client and server package/ncurses: Allow building wide char support package/powerpc-utils: Add powerpc hardware utilities package/kexec-lite: Add a package for the kexec-lite tools package/petitboot: Add petitboot, the userspace bootloader package/iprutils: Add IBM Power RAID utilities
Add powerpc petitboot defconfig

#1 lore raw

RFC PATCH 1/8 package/busybox: Add facility for DHCP hooks

The (u)dhcpc hook installed by the busybox package configures the network and exits. If we want to do anything further with a DHCP lease, we'd have to replace the script entirely.

This change introduces a .d directory for hooks (based on the script filename), which are executed after the interface configuration. This allows packages to drop a script file in the .d directory to perform actions on DHCP events.

We'll use this in a later change to notify petitboot of DHCP boot information.

---
 package/busybox/busybox.mk    |    2 ++
 package/busybox/udhcpc.script |    9 +++++++++
 2 files changed, 11 insertions(+)
package/busybox/busybox.mk +2 -0
index f6f542e2..6ff5f3da 100644
@@ -200,6 +200,8 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	if [ ! -f $(TARGET_DIR)/usr/share/udhcpc/default.script ]; then \
 		$(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
 			$(TARGET_DIR)/usr/share/udhcpc/default.script; \
+		$(INSTALL) -m 755 -d \
+			$(TARGET_DIR)/usr/share/udhcpc/default.script.d; \
 	fi
 	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
 	$(BUSYBOX_INSTALL_MDEV_CONF)
package/busybox/udhcpc.script +9 -0
index 43742fbd..8930d4a8 100755
@@ -63,4 +63,13 @@ case "$1" in
 		;;
 esac
 
+HOOK_DIR="$0.d"
+if [ -d "$HOOK_DIR" ]
+then
+	for HOOK in $HOOK_DIR/*; do
+		$HOOK "$@"
+	done
+fi
+
+
 exit 0
#2 lore raw

RFC PATCH 1/8 package/busybox: Add facility for DHCP hooks

Jeremy, All,

On 2014-01-16 16:52 +0800, Jeremy Kerr spake thusly:

Quoted 9 lines

The (u)dhcpc hook installed by the busybox package configures the network and exits. If we want to do anything further with a DHCP lease, we'd have to replace the script entirely.

This change introduces a .d directory for hooks (based on the script filename), which are executed after the interface configuration. This allows packages to drop a script file in the .d directory to perform actions on DHCP events.

Quoted 4 lines

We'll use this in a later change to notify petitboot of DHCP boot information.

I'm not against such a change, but there is a gotcha, see below...

[--SNIP--]

package/busybox/udhcpc.script case "$1" in · line 70

Quoted 13 lines
package/busybox/udhcpc.script +5 -0
index 43742fbd..8930d4a8 100755
@@ -63,4 +63,13 @@ case "$1" in
 		;;
 esac
 
+HOOK_DIR="$0.d"
+if [ -d "$HOOK_DIR" ]
+then
+	for HOOK in $HOOK_DIR/*; do
+		$HOOK "$@"

If the directory exists, but there is no hook, then HOOK will have the value '${HOKK_DIR}/*', and this will result in a error.

You have to do something like:

    for hook in "${HOOK_DIR}/"*; do
        [ -f "${hook}" -a -x "${hook}" ] || continue
        "${hook}" "${@}"
    done

And then you do not need to protect with the if-block.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

In reply to Jeremy Kerr

Currently, the dropbear package installs both client and server components. For example, this means that when we only want the client binaries, we also get the server run from init.

Even though it's a multi-call binary (the client and server exist in the same executable), we'd like to selectively install the links and init scripts. This change introduces separate configuration options (both 'default y') for the client and server bits.

---
 package/dropbear/Config.in   |   12 ++++++++++++
 package/dropbear/dropbear.mk |    9 ++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
package/dropbear/Config.in +12 -0
index 68c3b71a..4a7327b7 100644
@@ -8,6 +8,18 @@ config BR2_PACKAGE_DROPBEAR
 
 if BR2_PACKAGE_DROPBEAR
 
+config BR2_PACKAGE_DROPBEAR_SERVER
+	bool "dropbear ssh server"
+	default y
+	help
+	  Enable the dropbear ssh server, run from init
+
+config BR2_PACKAGE_DROPBEAR_CLIENT
+	bool "dropbear ssh client"
+	default y
+	help
+	  Enable the dropbear ssh client, scp and utilities
+
 config BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS
 	bool "disable reverse DNS lookups"
 	help
package/dropbear/dropbear.mk +8 -1
index 3ef6c8da..a1cc5691 100644
@@ -7,7 +7,7 @@
 DROPBEAR_VERSION = 2013.62
 DROPBEAR_SITE = http://matt.ucc.asn.au/dropbear/releases
 DROPBEAR_SOURCE = dropbear-$(DROPBEAR_VERSION).tar.bz2
-DROPBEAR_TARGET_BINS = dbclient dropbearkey dropbearconvert scp ssh
+DROPBEAR_TARGET_BINS = dropbearkey dropbearconvert
 DROPBEAR_MAKE =	$(MAKE) MULTI=1 SCPPROGRESS=1 \
 		PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
 
@@ -43,6 +43,7 @@ define DROPBEAR_DISABLE_STANDALONE
 	$(SED) 's:\(#define NON_INETD_MODE\):/*\1 */:' $(@D)/options.h
 endef
 
+ifeq ($(BR2_PACKAGE_DROPBEAR_SERVER),y)
 define DROPBEAR_INSTALL_INIT_SYSTEMD
 	$(INSTALL) -D -m 644 package/dropbear/dropbear.service \
 		$(TARGET_DIR)/etc/systemd/system/dropbear.service
@@ -60,6 +61,12 @@ else
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_DISABLE_STANDALONE
 endif
 
+endif
+
+ifeq ($(BR2_PACKAGE_DROPBEAR_CLIENT),y)
+DROPBEAR_TARGET_BINS += dbclient scp ssh
+endif
+
 ifeq ($(BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS),)
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_ENABLE_REVERSE_DNS
 endif
#4 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

J?r?my, All,

On 2014-01-16 16:52 +0800, Jeremy Kerr spake thusly:
[--SNIP--]

Quoted 8 lines

index 68c3b71a..4a7327b7 100644

package/dropbear/Config.in +1 -0
@@ -8,6 +8,18 @@ config BR2_PACKAGE_DROPBEAR
 
 if BR2_PACKAGE_DROPBEAR
 
+config BR2_PACKAGE_DROPBEAR_SERVER

package/dropbear/Config.in config BR2_PACKAGE_DROPBEAR · line 21

Quoted 10 lines
package/dropbear/Config.in +10 -0
+	bool "dropbear ssh server"
+	default y
+	help
+	  Enable the dropbear ssh server, run from init
+
+config BR2_PACKAGE_DROPBEAR_CLIENT
+	bool "dropbear ssh client"
+	default y
+	help
+	  Enable the dropbear ssh client, scp and utilities

What if none is selected? What about:

config BR2_PACKAGE_DROPBEAR_HAS_CLIENT
def_bool y
depends on !BR2_PACKAGE_DROPBEAR_CLIENT
select BR2_PACKAGE_DROPBEAR_SERVER

config BR2_PACKAGE_DROPBEAR_SERVER
bool "dropbear ssh server"

config BR2_PACKAGE_DROPBEAR_CLIENT
bool "dropbear ssh client"

(with your help entries, of course).

package/dropbear/dropbear.mk line 12

Quoted 12 lines
package/dropbear/dropbear.mk +1 -1
index 3ef6c8da..a1cc5691 100644
@@ -7,7 +7,7 @@
 DROPBEAR_VERSION = 2013.62
 DROPBEAR_SITE = http://matt.ucc.asn.au/dropbear/releases
 DROPBEAR_SOURCE = dropbear-$(DROPBEAR_VERSION).tar.bz2
-DROPBEAR_TARGET_BINS = dbclient dropbearkey dropbearconvert scp ssh
+DROPBEAR_TARGET_BINS = dropbearkey dropbearconvert
 DROPBEAR_MAKE =	$(MAKE) MULTI=1 SCPPROGRESS=1 \
 		PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
		                   ^^^^^^^^

Should we not disable dbclient if it is not selected?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

Hi Yann,

Quoted 9 lines

On 2014-01-16 16:52 +0800, Jeremy Kerr spake thusly:
[--SNIP--]

Quoted 7 lines

index 68c3b71a..4a7327b7 100644

package/dropbear/Config.in +0 -0
@@ -8,6 +8,18 @@ config BR2_PACKAGE_DROPBEAR
 
 if BR2_PACKAGE_DROPBEAR
 
Quoted 13 lines

package/dropbear/Config.in config BR2_PACKAGE_DROPBEAR · line 21

Quoted 11 lines
package/dropbear/Config.in +11 -0
+config BR2_PACKAGE_DROPBEAR_SERVER
+	bool "dropbear ssh server"
+	default y
+	help
+	  Enable the dropbear ssh server, run from init
+
+config BR2_PACKAGE_DROPBEAR_CLIENT
+	bool "dropbear ssh client"
+	default y
+	help
+	  Enable the dropbear ssh client, scp and utilities

What if none is selected?

Then neither the client nor server is installed; is that an issue?

We could just have a comment (when !_CLIENT && !_SERVER) to notify the user that it's not a sensible configuration...

Quoted 13 lines

package/dropbear/dropbear.mk line 12

Quoted 12 lines
package/dropbear/dropbear.mk +1 -1
index 3ef6c8da..a1cc5691 100644
@@ -7,7 +7,7 @@
 DROPBEAR_VERSION = 2013.62
 DROPBEAR_SITE = http://matt.ucc.asn.au/dropbear/releases
 DROPBEAR_SOURCE = dropbear-$(DROPBEAR_VERSION).tar.bz2
-DROPBEAR_TARGET_BINS = dbclient dropbearkey dropbearconvert scp ssh
+DROPBEAR_TARGET_BINS = dropbearkey dropbearconvert
 DROPBEAR_MAKE =	$(MAKE) MULTI=1 SCPPROGRESS=1 \
 		PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
		                   ^^^^^^^^
Quoted 1 line

Should we not disable dbclient if it is not selected?

We should. I'll sort this out in my next series.

Thanks for the review!

Jeremy

#6 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

In reply to Jeremy Kerr
Quoted 8 lines · Jeremy Kerr

Currently, the dropbear package installs both client and server components. For example, this means that when we only want the client binaries, we also get the server run from init.

Even though it's a multi-call binary (the client and server exist in the same executable), we'd like to selectively install the links and init scripts. This change introduces separate configuration options (both 'default y') for the client and server bits.

Normally we don't make initscript installation an option and since the dropbear package options are essentially a no-op what's the point? (if you don't want sshd to startup on boot you can use a post build script to just remove the initscript from the target, that's the recommended way).
Regards.

#7 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

Hi Gustavo,

Quoted 1 line

Normally we don't make initscript installation an option

I think dropbear is a bit exceptional here, as both server and client are in the one package.

Quoted 2 lines

and since the
dropbear package options are essentially a no-op what's the point?

There are some scenarios where there's no point starting a SSH server (in my case, it's because there's no persistent storage, so no persistent host keys). However, I'd still like a ssh/scp client to be available.

Quoted 3 lines

(if you don't want sshd to startup on boot you can use a post build script to just remove the initscript from the target, that's the recommended way).

But isn't something that will go upstream and be available in a defconfig, right?

Regards,

Jeremy

#8 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

Quoted 1 line · Jeremy Kerr

Hi Gustavo,

Hi Jeremy.

Quoted 5 lines
Quoted 1 line

Normally we don't make initscript installation an option

I think dropbear is a bit exceptional here, as both server and client are in the one package.

Quoted 7 lines
Quoted 2 lines

and since the
dropbear package options are essentially a no-op what's the point?

There are some scenarios where there's no point starting a SSH server (in my case, it's because there's no persistent storage, so no persistent host keys). However, I'd still like a ssh/scp client to be available.

Well you'll want at least one of the options of dropbear, there's no point in excluding both.
My common sense tells me you'll always want the client anyway, it's no security threat or space-consuming menace, so why not add just a SERVER option maybe?
BR2_PACKAGE_DROPBEAR -> builds and install the client portion. BR2_PACKAGE_DROPBEAR_SERVER -> installs the server bits (default=y for compatibility reasons).
Let's see others chiming in though...

Quoted 6 lines
Quoted 3 lines

(if you don't want sshd to startup on boot you can use a post build script to just remove the initscript from the target, that's the recommended way).

But isn't something that will go upstream and be available in a defconfig, right?

That's still open to debate, until now all defconfigs were supposed to be minimal, but there's a growing consensus that featured or demo defconfigs are desired and useful.
It's just a matter of doing it right and documenting it at this point i think.
Regards.

#9 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

Hi Gustavo,

Quoted 5 lines
Quoted 4 lines

There are some scenarios where there's no point starting a SSH server (in my case, it's because there's no persistent storage, so no persistent host keys). However, I'd still like a ssh/scp client to be available.

Quoted 8 lines

Well you'll want at least one of the options of dropbear, there's no point in excluding both.
My common sense tells me you'll always want the client anyway, it's no security threat or space-consuming menace, so why not add just a SERVER option maybe?
BR2_PACKAGE_DROPBEAR -> builds and install the client portion. BR2_PACKAGE_DROPBEAR_SERVER -> installs the server bits (default=y for compatibility reasons).

That sounds pretty good to me too. I'd be happy to implement whatever the general consensus is :)

Quoted 6 lines
Quoted 2 lines

But isn't something that will go upstream and be available in a defconfig, right?

That's still open to debate, until now all defconfigs were supposed to be minimal, but there's a growing consensus that featured or demo defconfigs are desired and useful.

OK, understood.

If the defconfig isn't upstream, I'd need to provide both a config and a postinst script, and whoever is replicating the build needs to point the config to the postinst script correctly. Having the dropbear server available as a simple config option allows me to either use a defconfig, or provide a single defconfig file, to allow others to build a petitboot-compatible builtroot image, without having to mess around too much.

Cheers,

Jeremy

#10 lore raw

RFC PATCH 2/8 package/dropbear: Add separate configuration options for client and server

Jeremy, All,

On 2014-03-04 09:51 +0800, Jeremy Kerr spake thusly:

Quoted 14 lines
Quoted 5 lines
Quoted 4 lines

There are some scenarios where there's no point starting a SSH server (in my case, it's because there's no persistent storage, so no persistent host keys). However, I'd still like a ssh/scp client to be available.

Quoted 8 lines

Well you'll want at least one of the options of dropbear, there's no point in excluding both.
My common sense tells me you'll always want the client anyway, it's no security threat or space-consuming menace, so why not add just a SERVER option maybe?
BR2_PACKAGE_DROPBEAR -> builds and install the client portion. BR2_PACKAGE_DROPBEAR_SERVER -> installs the server bits (default=y for compatibility reasons).

Quoted 2 lines

That sounds pretty good to me too. I'd be happy to implement whatever the general consensus is :)

OK for me. But make sure the server is "default y", so old .config files still work.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

RFC PATCH 3/8 package/ncurses: Allow building wide char support

In reply to Jeremy Kerr

Allow ncurses to be configured with wide char support; this causes the libraries to be built with the 'w' suffix (eg libncursesw.so, libmenuw.so, etc), so we need to create a few symlinks.

---
 package/ncurses/Config.in  |    5 +++
 package/ncurses/ncurses.mk |   50 +++++++++++++++++++++++++++++++++----
 2 files changed, 50 insertions(+), 5 deletions(-)
package/ncurses/Config.in +5 -0
index e8ab7102..337b0160 100644
@@ -9,6 +9,11 @@ config BR2_PACKAGE_NCURSES
 	  http://www.gnu.org/software/ncurses/
 
 if BR2_PACKAGE_NCURSES
+config BR2_PACKAGE_NCURSES_WIDEC
+	bool "enable wide char support"
+	depends on BR2_PACKAGE_NCURSES
+	help
+	  Enable wide char & UTF-8 support in ncurses libraries
 
 config BR2_PACKAGE_NCURSES_TARGET_PANEL
 	bool "ncurses libpanel in target"
package/ncurses/ncurses.mk +45 -5

90 lines not on this page · raw message

#12 lore raw

RFC PATCH 3/8 package/ncurses: Allow building wide char support

Dear Jeremy Kerr,

Quoted 2 lines · Jeremy Kerr

if BR2_PACKAGE_NCURSES
+config BR2_PACKAGE_NCURSES_WIDEC

One empty line between the if line and the config line.

package/ncurses/Config.in config BR2_PACKAGE_NCURSES · line 14

Quoted 2 lines
package/ncurses/Config.in +2 -0
+	bool "enable wide char support"
+	depends on BR2_PACKAGE_NCURSES

dependency not needed since you're inside a if BR2_PACKAGE_NCURSES.

I believe this option most likely depends on BR2_USE_WCHAR.

Also, maybe name the option BR2_PACKAGE_NCURSES_WCHAR, to match the BR2_USE_WCHAR name we're already using in Buildroot to talk about wide char support.

Quoted 20 lines
package/ncurses/Config.in +2 -0
+	help
+	  Enable wide char & UTF-8 support in ncurses libraries
 
 config BR2_PACKAGE_NCURSES_TARGET_PANEL
 	bool "ncurses libpanel in target"
package/ncurses/ncurses.mk +1 -1
index f3319763..ba4cacd1 100644
@@ -12,7 +12,7 @@ HOST_NCURSES_DEPENDENCIES =
 NCURSES_PROGS = clear infocmp tabs tic toe tput tset
 NCURSES_LICENSE = MIT with advertising clause
 NCURSES_LICENSE_FILES = README
-NCURSES_CONFIG_SCRIPTS = ncurses5-config
+NCURSES_CONFIG_SCRIPTS = ncurses$(W)5-config
 
 NCURSES_CONF_OPT = \
 	$(if $(BR2_PREFER_STATIC_LIB),--without-shared,--with-shared) \
@@ -36,6 +36,15 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 	NCURSES_DEPENDENCIES += busybox

package/ncurses/ncurses.mk ifeq ($(BR2_PACKAGE_BUSYBOX),y) · line 46

Quoted 10 lines
package/ncurses/ncurses.mk +8 -0
 endif
 
+ifeq ($(BR2_PACKAGE_NCURSES_WIDEC),y)
+NCURSES_CONF_OPT += --enable-widec
+W=w
+W_LINK=ln -sf
+else
+W=
+W_LINK=:
+endif

We really don't want to have variables named W and W_LINK. The variable namespace in Buildroot is global. So if one package defines W, and another package uses it, we screwed. So all variables should be prefixed by the name of the package.

Quoted 59 lines
package/ncurses/ncurses.mk +24 -4
+
 ifneq ($(BR2_ENABLE_DEBUG),y)
 NCURSES_CONF_OPT += --without-debug
 endif
@@ -48,19 +57,22 @@ ifneq ($(BR2_PREFER_STATIC_LIB),y)
 
 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PANEL),y)
 define NCURSES_INSTALL_TARGET_PANEL
-	cp -dpf $(NCURSES_DIR)/lib/libpanel.so* $(TARGET_DIR)/usr/lib/
+	cp -dpf $(NCURSES_DIR)/lib/libpanel$(W).so* $(TARGET_DIR)/usr/lib/
+	$(W_LINK) libpanelw.so $(TARGET_DIR)/usr/lib/libpanel.so
 endef
 endif
 
 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_FORM),y)
 define NCURSES_INSTALL_TARGET_FORM
-	cp -dpf $(NCURSES_DIR)/lib/libform.so* $(TARGET_DIR)/usr/lib/
+	cp -dpf $(NCURSES_DIR)/lib/libform$(W).so* $(TARGET_DIR)/usr/lib/
+	$(W_LINK) libformw.so $(TARGET_DIR)/usr/lib/libform.so
 endef
 endif
 
 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_MENU),y)
 define NCURSES_INSTALL_TARGET_MENU
-	cp -dpf $(NCURSES_DIR)/lib/libmenu.so* $(TARGET_DIR)/usr/lib/
+	cp -dpf $(NCURSES_DIR)/lib/libmenu$(W).so* $(TARGET_DIR)/usr/lib/
+	$(W_LINK) libmenuw.so $(TARGET_DIR)/usr/lib/libmenu.so
 endef
 endif
 
@@ -78,7 +90,8 @@ endif
 
 define NCURSES_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/usr/lib
-	$(if $(BR2_PREFER_STATIC_LIB),,cp -dpf $(NCURSES_DIR)/lib/libncurses.so* $(TARGET_DIR)/usr/lib/)
+	$(if $(BR2_PREFER_STATIC_LIB),,cp -dpf $(NCURSES_DIR)/lib/libncurses$(W).so* $(TARGET_DIR)/usr/lib/)
+	$(W_LINK) libncursesw.so $(TARGET_DIR)/usr/lib/libncurses.so
 	$(NCURSES_INSTALL_TARGET_PANEL)
 	$(NCURSES_INSTALL_TARGET_FORM)
 	$(NCURSES_INSTALL_TARGET_MENU)
@@ -101,6 +114,33 @@ define NCURSES_INSTALL_TARGET_CMDS
 	cp -dpf $(STAGING_DIR)/usr/share/terminfo/s/screen $(TARGET_DIR)/usr/share/terminfo/s
 endef # NCURSES_INSTALL_TARGET_CMDS
 
+define NCURSES_POST_INSTALL_SYMLINK
+	$(W_LINK) libncursesw.so $(STAGING_DIR)/usr/lib/libncurses.so
+endef
+NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_POST_INSTALL_SYMLINK
+
+ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PANEL),y)
+define NCURSES_POST_INSTALL_SYMLINK_PANEL
+	$(W_LINK) libpanelw.so $(STAGING_DIR)/usr/lib/libpanel.so
+endef
+NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_POST_INSTALL_SYMLINK_PANEL
+endif
+
+ifeq ($(BR2_PACKAGE_NCURSES_TARGET_FORM),y)
+define NCURSES_POST_INSTALL_SYMLINK_FORM
+	$(W_LINK) libformw.so $(STAGING_DIR)/usr/lib/libform.so

package/ncurses/ncurses.mk define NCURSES_INSTALL_TARGET_CMDS · line 141

Quoted 10 lines
package/ncurses/ncurses.mk +10 -0
+endef
+NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_POST_INSTALL_SYMLINK_FORM
+endif
+
+ifeq ($(BR2_PACKAGE_NCURSES_TARGET_MENU),y)
+define NCURSES_POST_INSTALL_SYMLINK_MENU
+	$(W_LINK) libmenuw.so $(STAGING_DIR)/usr/lib/libmenu.so
+endef
+NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_POST_INSTALL_SYMLINK_MENU
+endif

Pffiou, that's a lot of things. Maybe we could refactor this a little with the target installation to do something a bit smarter like:

NCURSES_LIBS-y += libncurses NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_MENU) += libmenu NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_PANEL) += libpanel NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += libform

and then use $(NCURSES_LIBS-y) and some loops in target installation and in a staging post installation hook to create the appropriate symbolic links.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#13 lore raw

RFC PATCH 3/8 package/ncurses: Allow building wide char support

Hi Thomas,

Quoted 10 lines

package/ncurses/Config.in config BR2_PACKAGE_NCURSES · line 14

Quoted 2 lines
package/ncurses/Config.in +2 -0
+	bool "enable wide char support"
+	depends on BR2_PACKAGE_NCURSES

dependency not needed since you're inside a if BR2_PACKAGE_NCURSES.

I believe this option most likely depends on BR2_USE_WCHAR.

Also, maybe name the option BR2_PACKAGE_NCURSES_WCHAR, to match the BR2_USE_WCHAR name we're already using in Buildroot to talk about wide char support.

OK, makes sense, fixed.

Quoted 11 lines

Pffiou, that's a lot of things. Maybe we could refactor this a little with the target installation to do something a bit smarter like:

NCURSES_LIBS-y += libncurses NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_MENU) += libmenu NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_PANEL) += libpanel NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += libform

and then use $(NCURSES_LIBS-y) and some loops in target installation and in a staging post installation hook to create the appropriate symbolic links.

That looks much better. I'll split this change into two stages: one to implement NCURSES_LIBS-y, and one to add BR2_PACKAGE_NCURSES_WCHAR.

Cheers,

jeremy

#14 lore raw

RFC PATCH 4/8 package/powerpc-utils: Add powerpc hardware utilities

In reply to Jeremy Kerr

This change adds a package definition for the powerpc-utils project, containing a set of powerpc-specific hardware management utilities.

We're using a git tag from upstream, which contains a few build-system fixes. We also add a patch to use reboot instead of shutdown -r, allowing compatibility with busybox.

---
 package/Config.in                                                                             |    1 
 package/powerpc-utils/Config.in                                                               |    5 +
 package/powerpc-utils/powerpc-utils-scripts-update_flash-Use-reboot-instead-of-shutdown.patch |   42 ++++++++++
 package/powerpc-utils/powerpc-utils.mk                                                        |   14 +++
 4 files changed, 62 insertions(+)
package/Config.in +1 -0
index 78c0e066..61f4c9e0 100644
@@ -1006,6 +1006,7 @@ source "package/monit/Config.in"
 source "package/ncdu/Config.in"
 source "package/numactl/Config.in"
 source "package/nut/Config.in"
+source "package/powerpc-utils/Config.in"
 source "package/polkit/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 source "package/procps/Config.in"
package/powerpc-utils/Config.in new file +5 -0
new file mode 100644
index 00000000..c919094a
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_POWERPC_UTILS
+	bool "powerpc-utils"
+	select BR2_PACKAGE_ZLIB
+	help
+	  System utilities for powerpc machines
package/powerpc-utils/powerpc-utils-scripts-update_flash-Use-reboot-instead-of-shutdown.patch new file +42 -0

42 lines not on this page · raw message

package/powerpc-utils/powerpc-utils.mk new file +14 -0
new file mode 100644
index 00000000..15deb2e9
@@ -0,0 +1,14 @@
+#############################################################
+#
+# powerpc-utils
+#
+#############################################################
+
+POWERPC_UTILS_VERSION = aeb32757
+POWERPC_UTILS_SITE = git://git.code.sf.net/p/powerpc-utils/powerpc-utils
+POWERPC_UTILS_AUTORECONF = YES
+POWERPC_UTILS_DEPENDENCIES = zlib
+
+POWERPC_UTILS_CONF_OPT += --without-librtas
+
+$(eval $(autotools-package))
#15 lore raw

RFC PATCH 4/8 package/powerpc-utils: Add powerpc hardware utilities

Hi Jeremy,

Quoted 8 lines · Jeremy Kerr

This change adds a package definition for the powerpc-utils project, containing a set of powerpc-specific hardware management utilities.

We're using a git tag from upstream, which contains a few build-system fixes. We also add a patch to use reboot instead of shutdown -r, allowing compatibility with busybox.

[...]

Quoted 7 lines
package/powerpc-utils/powerpc-utils.mk new file +0 -0
new file mode 100644
index 00000000..15deb2e9

package/powerpc-utils/powerpc-utils.mk line 7

Quoted 7 lines
package/powerpc-utils/powerpc-utils.mk new file +7 -0
@@ -0,0 +1,14 @@
+#############################################################
+#
+# powerpc-utils
+#
+#############################################################
+
+POWERPC_UTILS_VERSION = aeb32757

Please use the full 40-char commit id.

package/powerpc-utils/powerpc-utils.mk line 14

Quoted 7 lines
package/powerpc-utils/powerpc-utils.mk new file +7 -0
+POWERPC_UTILS_SITE = git://git.code.sf.net/p/powerpc-utils/powerpc-utils
+POWERPC_UTILS_AUTORECONF = YES
+POWERPC_UTILS_DEPENDENCIES = zlib
+
+POWERPC_UTILS_CONF_OPT += --without-librtas
+
+$(eval $(autotools-package))

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#16 lore raw

RFC PATCH 4/8 package/powerpc-utils: Add powerpc hardware utilities

In reply to Jeremy Kerr

Hi Jeremy,

Quoted 7 lines

This change adds a package definition for the powerpc-utils project, containing a set of powerpc-specific hardware management utilities.

We're using a git tag from upstream, which contains a few build-system fixes. We also add a patch to use reboot instead of shutdown -r, allowing compatibility with busybox.

Quoted 6 lines
---
  package/Config.in                                                                             |    1
  package/powerpc-utils/Config.in                                                               |    5 +
  package/powerpc-utils/powerpc-utils-scripts-update_flash-Use-reboot-instead-of-shutdown.patch |   42 ++++++++++

powerpc-utils-01-scripts-update_flash-Use-reboot-instead-of-shutdown.patch

Quoted 2 lines
  package/powerpc-utils/powerpc-utils.mk                                                        |   14 +++
  4 files changed, 62 insertions(+)

[...]

package/powerpc-utils/powerpc-utils.mk line 1

Quoted 7 lines
package/powerpc-utils/powerpc-utils.mk new file +1 -0
new file mode 100644
index 00000000..15deb2e9
@@ -0,0 +1,14 @@
+#############################################################

80 of # signs

package/powerpc-utils/powerpc-utils.mk line 5

Quoted 4 lines
package/powerpc-utils/powerpc-utils.mk new file +4 -0
+#
+# powerpc-utils
+#
+#############################################################

ditto

Regards,
Jerzy

Quoted 14 lines
package/powerpc-utils/powerpc-utils.mk new file +9 -0
+
+POWERPC_UTILS_VERSION = aeb32757
+POWERPC_UTILS_SITE = git://git.code.sf.net/p/powerpc-utils/powerpc-utils
+POWERPC_UTILS_AUTORECONF = YES
+POWERPC_UTILS_DEPENDENCIES = zlib
+
+POWERPC_UTILS_CONF_OPT += --without-librtas
+
+$(eval $(autotools-package))

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#17 lore raw

RFC PATCH 4/8 package/powerpc-utils: Add powerpc hardware utilities

In reply to Jeremy Kerr

Dear Jeremy Kerr,

Hey, thanks for posting this! Nice to see that our short discussion at LCA after your talk was useful :-)

Quoted 6 lines · Jeremy Kerr
package/powerpc-utils/powerpc-utils.mk new file +0 -0
new file mode 100644
index 00000000..15deb2e9

package/powerpc-utils/powerpc-utils.mk line 10

Quoted 10 lines
package/powerpc-utils/powerpc-utils.mk new file +10 -0
@@ -0,0 +1,14 @@
+#############################################################
+#
+# powerpc-utils
+#
+#############################################################
+
+POWERPC_UTILS_VERSION = aeb32757
+POWERPC_UTILS_SITE = git://git.code.sf.net/p/powerpc-utils/powerpc-utils
+POWERPC_UTILS_AUTORECONF = YES
+POWERPC_UTILS_DEPENDENCIES = zlib

In addition to the comments that were made by others, it would be good to add POWERPC_UTILS_LICENSE and POWERPC_UTILS_LICENSE_FILES.

package/powerpc-utils/powerpc-utils.mk line 12

Quoted 1 line
package/powerpc-utils/powerpc-utils.mk new file +1 -0
+POWERPC_UTILS_CONF_OPT += --without-librtas

Nitpick: a = is sufficient here.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#18 lore raw

RFC PATCH 4/8 package/powerpc-utils: Add powerpc hardware utilities

Hi Thomas,

Quoted 20 lines
Quoted 6 lines
package/powerpc-utils/powerpc-utils.mk new file +0 -0
new file mode 100644
index 00000000..15deb2e9

package/powerpc-utils/powerpc-utils.mk line 10

Quoted 10 lines
package/powerpc-utils/powerpc-utils.mk new file +10 -0
@@ -0,0 +1,14 @@
+#############################################################
+#
+# powerpc-utils
+#
+#############################################################
+
+POWERPC_UTILS_VERSION = aeb32757
+POWERPC_UTILS_SITE = git://git.code.sf.net/p/powerpc-utils/powerpc-utils
+POWERPC_UTILS_AUTORECONF = YES
+POWERPC_UTILS_DEPENDENCIES = zlib

In addition to the comments that were made by others, it would be good to add POWERPC_UTILS_LICENSE and POWERPC_UTILS_LICENSE_FILES.

Quoted 3 lines

package/powerpc-utils/powerpc-utils.mk line 12

Quoted 1 line
package/powerpc-utils/powerpc-utils.mk new file +1 -0
+POWERPC_UTILS_CONF_OPT += --without-librtas

Nitpick: a = is sufficient here.

Both sound good; I've implemented both changes.

Thanks for the review - I'll post a new series shortly.

Jeremy

#19 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

In reply to Jeremy Kerr

Kexec-lite is a tiny impementation of kexec for devicetree-based platforms.

---
 package/Config.in                                 |    1 
 package/kexec-lite/Config.in                      |    9 +++
 package/kexec-lite/kexec-lite-clean-restart.patch |   34 ++++++++++++++
 package/kexec-lite/kexec-lite.mk                  |   20 ++++++++
 4 files changed, 64 insertions(+)
package/Config.in +1 -0
index 61f4c9e0..f5161475 100644
@@ -52,6 +52,7 @@ source "package/fio/Config.in"
 source "package/gdb/Config.in"
 source "package/iozone/Config.in"
 source "package/kexec/Config.in"
+source "package/kexec-lite/Config.in"
 source "package/ktap/Config.in"
 source "package/latencytop/Config.in"
 source "package/lmbench/Config.in"
package/kexec-lite/Config.in new file +9 -0
new file mode 100644
index 00000000..0dc05155
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_KEXEC_LITE
+	bool "kexec-lite"
+	depends on BR2_powerpc
+	select BR2_PACKAGE_LIBELF
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_DTC_PROGRAMS
+	help
+	  Kexec is a user space utiltity for loading another kernel
+	  and asking the currently running kernel to do something with it.
package/kexec-lite/kexec-lite-clean-restart.patch new file +34 -0
new file mode 100644
index 00000000..faaa93a0
@@ -0,0 +1,34 @@
+From 0a654c20e1b9324c57ba4116b52fb6ab33847e1d Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <[email protected]>
+Date: Thu, 8 Aug 2013 17:16:31 +0800
+Subject: [PATCH] kexec: Implement clean restart for busybox init
+
+Signed-off-by: Jeremy Kerr <[email protected]>
+---
+ kexec.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/kexec.c b/kexec.c
+index 2edb7df..b2a0c42 100644
+--- a/kexec.c
++++ b/kexec.c
+@@ -27,6 +27,7 @@
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <syscall.h>
++#include <signal.h>
+ #include <libfdt.h>
+ #include <getopt.h>
+ #include <sys/types.h>
+@@ -818,7 +819,7 @@ int main(int argc, char *argv[])
+ 			sync();
+ 			exec_kexec();
+ 		} else {
+-			execlp("shutdown", "shutdown", "-r", "now", NULL);
++			kill(1, SIGQUIT);
+ 		}
+ 
+ 		return -1;
+-- 
+1.7.10.4
+
package/kexec-lite/kexec-lite.mk new file +20 -0
new file mode 100644
index 00000000..4d844f43
@@ -0,0 +1,20 @@
+################################################################################
+#
+# kexec
+#
+################################################################################
+
+KEXEC_LITE_VERSION = 6c762a7
+KEXEC_LITE_SITE = git://github.com/antonblanchard/kexec-lite
+KEXEC_LITE_LICENSE = GPL
+KEXEC_LITE_DEPENDENCIES = libelf dtc
+
+define KEXEC_LITE_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) all
+endef
+
+define KEXEC_LITE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/kexec $(TARGET_DIR)/usr/sbin/
+endef
+
+$(eval $(generic-package))
#20 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

Hi Jeremy,

Quoted 4 lines · Jeremy Kerr

Kexec-lite is a tiny impementation of kexec for devicetree-based platforms.

[...]

Quoted 6 lines
package/kexec-lite/Config.in new file +0 -0
new file mode 100644
index 00000000..0dc05155

package/kexec-lite/Config.in line 9

Quoted 9 lines
package/kexec-lite/Config.in new file +9 -0
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_KEXEC_LITE
+	bool "kexec-lite"
+	depends on BR2_powerpc
+	select BR2_PACKAGE_LIBELF
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_DTC_PROGRAMS
+	help
+	  Kexec is a user space utiltity for loading another kernel
+	  and asking the currently running kernel to do something with it.

This looks like a description of the generic kexec. You should mention that this is a special version as the commit log says.

[...]

Quoted 7 lines
package/kexec-lite/kexec-lite.mk new file +0 -0
new file mode 100644
index 00000000..4d844f43

package/kexec-lite/kexec-lite.mk line 7

Quoted 7 lines
package/kexec-lite/kexec-lite.mk new file +7 -0
@@ -0,0 +1,20 @@
+################################################################################
+#
+# kexec
+#
+################################################################################
+
+KEXEC_LITE_VERSION = 6c762a7

Full commit id.

package/kexec-lite/kexec-lite.mk line 8

Quoted 1 line
package/kexec-lite/kexec-lite.mk new file +1 -0
+KEXEC_LITE_SITE = git://github.com/antonblanchard/kexec-lite

Please use the github helper. See docs/manual/adding-packages-tips.txt.

package/kexec-lite/kexec-lite.mk line 20

Quoted 12 lines
package/kexec-lite/kexec-lite.mk new file +12 -0
+KEXEC_LITE_LICENSE = GPL
+KEXEC_LITE_DEPENDENCIES = libelf dtc
+
+define KEXEC_LITE_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) all
+endef
+
+define KEXEC_LITE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/kexec $(TARGET_DIR)/usr/sbin/
+endef
+
+$(eval $(generic-package))

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#21 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

Hi Baruch,

Thanks for taking a look at the patches.

Quoted 6 lines
Quoted 6 lines

+++ b/package/kexec-lite/Config.in

package/kexec-lite/Config.in new file +4 -0
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_KEXEC_LITE
+	bool "kexec-lite"
+	depends on BR2_powerpc
+	select BR2_PACKAGE_LIBELF
Quoted 8 lines

package/kexec-lite/Config.in line 9

Quoted 5 lines
package/kexec-lite/Config.in new file +5 -0
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_DTC_PROGRAMS
+	help
+	  Kexec is a user space utiltity for loading another kernel
+	  and asking the currently running kernel to do something with it.

This looks like a description of the generic kexec. You should mention that this is a special version as the commit log says.

Yep, shamelessly stolen from kexec.mk. :) I've updated this with a description similar to the changelog.

Quoted 4 lines
Quoted 4 lines
package/kexec-lite/kexec-lite.mk new file +1 -0
@@ -0,0 +1,20 @@
+################################################################################
Quoted 8 lines

package/kexec-lite/kexec-lite.mk line 7

Quoted 6 lines
package/kexec-lite/kexec-lite.mk new file +6 -0
+#
+# kexec
+#
+################################################################################
+
+KEXEC_LITE_VERSION = 6c762a7

Full commit id.

Fixed, along with the other git version strings you've mentioned in this series.

Quoted 3 lines

package/kexec-lite/kexec-lite.mk line 8

Quoted 1 line
package/kexec-lite/kexec-lite.mk new file +1 -0
+KEXEC_LITE_SITE = git://github.com/antonblanchard/kexec-lite

Please use the github helper. See docs/manual/adding-packages-tips.txt.

Ah, that's pretty neat. Updated to use $(call github ...).

I've updated my series with these changes, but will see if there's any more feedback before reposting.

Cheers,

Jeremy

#22 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

In reply to Jeremy Kerr

Hi Jeremy,

Quoted 9 lines

Kexec-lite is a tiny impementation of kexec for devicetree-based platforms.

---
  package/Config.in                                 |    1
  package/kexec-lite/Config.in                      |    9 +++
  package/kexec-lite/kexec-lite-clean-restart.patch |   34 ++++++++++++++

kexec-lite-01-clean-restart.patch

Quoted 2 lines
  package/kexec-lite/kexec-lite.mk                  |   20 ++++++++
  4 files changed, 64 insertions(+)

[...]

package/kexec-lite/kexec-lite.mk line 3

Quoted 9 lines
package/kexec-lite/kexec-lite.mk new file +3 -0
new file mode 100644
index 00000000..4d844f43
@@ -0,0 +1,20 @@
+################################################################################
+#
+# kexec
# kexec-lite

Regards,
Jerzy

Quoted 22 lines
package/kexec-lite/kexec-lite.mk new file +17 -0
+#
+################################################################################
+
+KEXEC_LITE_VERSION = 6c762a7
+KEXEC_LITE_SITE = git://github.com/antonblanchard/kexec-lite
+KEXEC_LITE_LICENSE = GPL
+KEXEC_LITE_DEPENDENCIES = libelf dtc
+
+define KEXEC_LITE_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) all
+endef
+
+define KEXEC_LITE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/kexec $(TARGET_DIR)/usr/sbin/
+endef
+
+$(eval $(generic-package))

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#23 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

In reply to Jeremy Kerr

Dear Jeremy Kerr,

package/kexec-lite/Config.in line 6

Quoted 3 lines · Jeremy Kerr
package/kexec-lite/Config.in new file +3 -0
+	select BR2_PACKAGE_LIBELF
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_DTC_PROGRAMS

I have no idea how kexec-lite works, but I'm a bit surprised by the dependency on dtc. Does it builds the Device Tree source at runtime on the target?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#24 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

Hi Thomas,

Quoted 7 lines

package/kexec-lite/Config.in line 6

Quoted 3 lines
package/kexec-lite/Config.in new file +3 -0
+	select BR2_PACKAGE_LIBELF
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_DTC_PROGRAMS

I have no idea how kexec-lite works, but I'm a bit surprised by the dependency on dtc. Does it builds the Device Tree source at runtime on the target?

Yes; if no device-tree blob is provided on the command-line, it will invoke dtc to generate one from the current system (ie, from /proc/device-tree).

Cheers,

Jeremy

#25 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

Dear Jeremy Kerr,

Quoted 11 lines · Jeremy Kerr
Quoted 7 lines

package/kexec-lite/Config.in line 6

Quoted 3 lines
package/kexec-lite/Config.in new file +3 -0
+	select BR2_PACKAGE_LIBELF
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_DTC_PROGRAMS

I have no idea how kexec-lite works, but I'm a bit surprised by the dependency on dtc. Does it builds the Device Tree source at runtime on the target?

Yes; if no device-tree blob is provided on the command-line, it will invoke dtc to generate one from the current system (ie, from /proc/device-tree).

Ok, then in this kind of case, we like to do:

	# run-time dependency only
	select BR2_PACKAGE_DTC
	select BR2_PACKAGE_DTC_PROGRAMS

so that we remember why this dependency is expressed in the Config.in, but not in the package .mk file.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#26 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

In reply to Jeremy Kerr

Hi Thomas,

Quoted 11 lines
Quoted 7 lines

package/kexec-lite/Config.in line 6

Quoted 3 lines
package/kexec-lite/Config.in new file +3 -0
+	select BR2_PACKAGE_LIBELF
+	select BR2_PACKAGE_DTC
+	select BR2_PACKAGE_DTC_PROGRAMS

I have no idea how kexec-lite works, but I'm a bit surprised by the dependency on dtc. Does it builds the Device Tree source at runtime on the target?

Yes; if no device-tree blob is provided on the command-line, it will invoke dtc to generate one from the current system (ie, from /proc/device-tree).

OK, I'm slightly incorrect here - kexec-lite requires the dtc libraries at build-time (we need to manipulate the device tree to update the reserved memory map), and may also call dtc at runtime too.

So, I'd propose a:

select BR2_PACKAGE_DTC
# run-time dependency only
select BR2_PACKAGE_DTC_PROGRAMS

- is that sensible?

Cheers,

Jeremy

#27 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

Dear Jeremy Kerr,

Quoted 11 lines · Jeremy Kerr

OK, I'm slightly incorrect here - kexec-lite requires the dtc libraries at build-time (we need to manipulate the device tree to update the reserved memory map), and may also call dtc at runtime too.

So, I'd propose a:

select BR2_PACKAGE_DTC
# run-time dependency only
select BR2_PACKAGE_DTC_PROGRAMS

- is that sensible?

In theory, yes. In practice, since you need BR2_PACKAGE_DTC at build time, it means that you will have "dtc" in the <pkg>_DEPENDENCIES variable of your package, which means that the dtc package (both the library and programs) will be built before your package. So practically speaking, BR2_PACKAGE_DTC_PROGRAMS will not really be treated as a run-time dependency only, because it's not provided by a separate package than dtc.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#28 lore raw

RFC PATCH 5/8 package/kexec-lite: Add a package for the kexec-lite tools

In reply to Jeremy Kerr

Dear Jeremy Kerr,

package/kexec-lite/kexec-lite.mk line 9

Quoted 3 lines · Jeremy Kerr
package/kexec-lite/kexec-lite.mk new file +3 -0
+KEXEC_LITE_VERSION = 6c762a7
+KEXEC_LITE_SITE = git://github.com/antonblanchard/kexec-lite
+KEXEC_LITE_LICENSE = GPL

This should be GPLv2+

It would be nice if the license text was added to the upstream project. Maybe something that you can suggest to Anton :-)

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#29 lore raw

RFC PATCH 6/8 package/petitboot: Add petitboot, the userspace bootloader

In reply to Jeremy Kerr

This change adds the petitboot package, a bootloader that exists in userspace, and uses the kexec facility to boot into a new kernel.

We add a little extra infrastructure to get things integrated into a buildroot environment:

- scripts to make kexec work with busybox init, for a clean shutdown

- udev rules to get removable event notifications, and start the petitboot UI processes

- startup scripts for the device-discovery process

---
 package/Config.in                            |    1 
 package/petitboot/Config.in                  |   10 +++
 package/petitboot/S14silence-console         |    9 +++
 package/petitboot/S15pb-discover             |   23 +++++++
 package/petitboot/kexec-restart              |    8 ++
 package/petitboot/petitboot-console-ui.rules |    5 +
 package/petitboot/petitboot.mk               |   57 +++++++++++++++++++
 package/petitboot/removable-event-poll.rules |    4 +
 8 files changed, 117 insertions(+)
package/Config.in +1 -0
index f5161475..f650476c 100644
@@ -1007,6 +1007,7 @@ source "package/monit/Config.in"
 source "package/ncdu/Config.in"
 source "package/numactl/Config.in"
 source "package/nut/Config.in"
+source "package/petitboot/Config.in"
 source "package/powerpc-utils/Config.in"
 source "package/polkit/Config.in"
 if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
package/petitboot/Config.in new file +10 -0
new file mode 100644
index 00000000..2f587c06
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_PETITBOOT
+	bool "petitboot"
+	depends on BR2_PACKAGE_KEXEC || BR2_PACKAGE_KEXEC_LITE
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_UDEV
+	select BR2_PACKAGE_POWERPC_UTILS if BR2_powerpc
+	help
+	  Petitboot is a small kexec-based bootloader
+
+	  http://www.kernel.org/pub/linux/kernel/people/geoff/petitboot/petitboot.html
package/petitboot/S14silence-console new file +9 -0
new file mode 100755
index 00000000..65702005
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case "$1" in
+    start)
+        echo 0 0 7 0 > /proc/sys/kernel/printk
+        ;;
+esac
+
+exit 0
package/petitboot/S15pb-discover new file +23 -0
new file mode 100755
index 00000000..ebdf9449
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+LOGFILE=/var/log/petitboot/pb-discover.log
+PIDFILE=/var/run/petitboot.pid
+
+case "$1" in
+    start)
+        ulimit -c unlimited
+        mkdir -p $(dirname $LOGFILE)
+        PATH=/usr/bin:/usr/sbin:/bin:/sbin pb-discover -l $LOGFILE &
+        echo $! > $PIDFILE
+        ;;
+    stop)
+        pid=$(cat $PIDFILE)
+        [ -n "$pid" ] && kill -TERM $pid
+        ;;
+    *)
+        echo "Usage: $0 {start|stop}"
+        exit 1
+        ;;
+esac
+
+exit 0
package/petitboot/kexec-restart new file +8 -0
new file mode 100755
index 00000000..0175e76d
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+/usr/sbin/kexec -f -e
+
+while :
+do
+    sleep 1
+done
package/petitboot/petitboot-console-ui.rules new file +5 -0
new file mode 100644
index 00000000..74648562
@@ -0,0 +1,5 @@
+
+# spawn a petitboot UI on common user-visible interface devices
+SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name vt100"
+SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name vt100"
+SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name vt100"
package/petitboot/petitboot.mk new file +57 -0

57 lines not on this page · raw message

package/petitboot/removable-event-poll.rules new file +4 -0
new file mode 100644
index 00000000..b736aef6
@@ -0,0 +1,4 @@
+
+# petitboot needs notification for media change events on removable devices,
+# which we only get if we've set the poll_msecs sysfs attribute.
+ACTION!="remove", ATTR{removable}=="1", ATTR{events_poll_msecs}="2000"
#30 lore raw

RFC PATCH 6/8 package/petitboot: Add petitboot, the userspace bootloader

Dear Jeremy Kerr,

package/petitboot/Config.in line 3

Quoted 9 lines · Jeremy Kerr
package/petitboot/Config.in new file +3 -0
new file mode 100644
index 00000000..2f587c06
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_PETITBOOT
+	bool "petitboot"
+	depends on BR2_PACKAGE_KEXEC || BR2_PACKAGE_KEXEC_LITE

I don't think we want a dependency here, as it's not necessarily obvious that this needs a kexec implementation. Therefore, I think we should have something like:

select BR2_PACKAGE_KEXEC_LITE if !BR2_PACKAGE_KEXEC

So that at least one implementation is guaranteed to be selected.

package/petitboot/Config.in line 5

Quoted 2 lines
package/petitboot/Config.in new file +2 -0
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_UDEV

This has to be a "depends on", and actually should depend on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV. See
http://git.buildroot.net/buildroot/tree/package/modem-manager/Config.in
for an example of a package that requires udev support to be available.

Quoted 80 lines
package/petitboot/Config.in new file +5 -0
+	select BR2_PACKAGE_POWERPC_UTILS if BR2_powerpc
+	help
+	  Petitboot is a small kexec-based bootloader
+
+	  http://www.kernel.org/pub/linux/kernel/people/geoff/petitboot/petitboot.html
package/petitboot/S14silence-console new file +9 -0
new file mode 100755
index 00000000..65702005
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case "$1" in
+    start)
+        echo 0 0 7 0 > /proc/sys/kernel/printk
+        ;;
+esac
+
+exit 0
package/petitboot/S15pb-discover new file +23 -0
new file mode 100755
index 00000000..ebdf9449
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+LOGFILE=/var/log/petitboot/pb-discover.log
+PIDFILE=/var/run/petitboot.pid
+
+case "$1" in
+    start)
+        ulimit -c unlimited
+        mkdir -p $(dirname $LOGFILE)
+        PATH=/usr/bin:/usr/sbin:/bin:/sbin pb-discover -l $LOGFILE &
+        echo $! > $PIDFILE
+        ;;
+    stop)
+        pid=$(cat $PIDFILE)
+        [ -n "$pid" ] && kill -TERM $pid
+        ;;
+    *)
+        echo "Usage: $0 {start|stop}"
+        exit 1
+        ;;
+esac
+
+exit 0
package/petitboot/kexec-restart new file +8 -0
new file mode 100755
index 00000000..0175e76d
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+/usr/sbin/kexec -f -e
+
+while :
+do
+    sleep 1
+done
package/petitboot/petitboot-console-ui.rules new file +5 -0
new file mode 100644
index 00000000..74648562
@@ -0,0 +1,5 @@
+
+# spawn a petitboot UI on common user-visible interface devices
+SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name vt100"
+SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name vt100"
+SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name vt100"
package/petitboot/petitboot.mk new file +0 -0
new file mode 100644
index 00000000..b8a2179d

package/petitboot/petitboot.mk line 5

Quoted 5 lines
package/petitboot/petitboot.mk new file +5 -0
@@ -0,0 +1,57 @@
+#############################################################
+#
+# petitboot
+#
+#############################################################

80 # signs.

Empty new line needed after comment header.

package/petitboot/petitboot.mk line 6

Quoted 1 line
package/petitboot/petitboot.mk new file +1 -0
+PETITBOOT_VERSION = af805399

We want full git hashes.

package/petitboot/petitboot.mk line 8

Quoted 2 lines
package/petitboot/petitboot.mk new file +2 -0
+PETITBOOT_SITE = git://git.ozlabs.org/home/jk/git/petitboot
+PETITBOOT_DEPENDENCIES = ncurses udev

If kexec is only a runtime dependency (and not a build dependency), then there should be a comment above the "select" of kexec in the Config.in that says it's only a runtime dependency.

Same thing for powerpc-utils.

package/petitboot/petitboot.mk line 13

Quoted 5 lines
package/petitboot/petitboot.mk new file +5 -0
+PETITBOOT_LICENSE = GPLv2
+PETITBOOT_LICENSE_FILES = COPYING
+
+PETITBOOT_CONF_OPT += --with-ncurses --without-twin-x11 --without-twin-fbdev \
+		      --localstatedir=/var --with-tftp=busybox \

The --with-tftp=busybox seems to implies that Busybox is used. Technically speaking, Buildroot allows to build a root filesystem without Busybox. So either you should support both Busybox-based and non-Busybox based filesystems, or depend/select Busybox.

package/petitboot/petitboot.mk line 17

Quoted 4 lines
package/petitboot/petitboot.mk new file +4 -0
+		      HOST_PROG_KEXEC=/usr/sbin/kexec \
+		      HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot
+
+ifdef PETITBOOT_DEBUG

Where is PETITBOOT_DEBUG defined?

package/petitboot/petitboot.mk line 29

Quoted 12 lines
package/petitboot/petitboot.mk new file +12 -0
+PETITBOOT_CONF_OPT += --enable-debug
+endif
+
+ifeq ($(BR2_PACKAGE_NCURSES_WIDEC),y)
+PETITBOOT_CONF_OPT += --with-ncursesw MENU_LIB=-lmenuw FORM_LIB=-lformw
+endif
+
+define PETITBOOT_PRE_CONFIGURE_BOOTSTRAP
+	(cd $(@D) && ./bootstrap $(PETITBOOT_VERSION))
+endef
+
+PETITBOOT_PRE_CONFIGURE_HOOKS += PETITBOOT_PRE_CONFIGURE_BOOTSTRAP

It's unfortunate that we can't use the normal <pkg>_AUTORECONF = YES logic, due to how configure.ac is generated from configure.ac.in. Anyway, if you do want to call the bootstrap script, you need to make this package depend on host-autoconf, host-automake and maybe host-libtool if you're using libtool.

Also, I see in your configure.ac.in that you use Lex and Yacc. Therefore, your package should depend on host-bison and host-flex. These are not mandatory dependencies of Buildroot.

Quoted 34 lines
package/petitboot/petitboot.mk new file +28 -0
+
+define PETITBOOT_POST_INSTALL
+	$(INSTALL) -D -m 0755 $(@D)/utils/bb-kexec-reboot \
+		$(TARGET_DIR)/usr/libexec/petitboot
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/petitboot/boot.d
+	$(INSTALL) -D -m 0755 $(@D)/utils/hooks/01-create-default-dtb \
+		$(TARGET_DIR)/etc/petitboot/boot.d/
+	$(INSTALL) -D -m 0755 $(@D)/utils/hooks/20-set-stdout \
+		$(TARGET_DIR)/etc/petitboot/boot.d/
+
+	$(INSTALL) -D -m 0755 package/petitboot/S14silence-console \
+		$(TARGET_DIR)/etc/init.d/
+	$(INSTALL) -D -m 0755 package/petitboot/S15pb-discover \
+		$(TARGET_DIR)/etc/init.d/
+	$(INSTALL) -D -m 0755 package/petitboot/kexec-restart \
+		$(TARGET_DIR)/usr/sbin/
+	$(INSTALL) -D -m 0755 package/petitboot/petitboot-console-ui.rules \
+		$(TARGET_DIR)/etc/udev/rules.d/
+	$(INSTALL) -D -m 0755 package/petitboot/removable-event-poll.rules \
+		$(TARGET_DIR)/etc/udev/rules.d/
+
+	ln -sf /usr/sbin/pb-udhcpc \
+		$(TARGET_DIR)/usr/share/udhcpc/default.script.d/
+endef
+
+PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL
+
+$(eval $(autotools-package))
package/petitboot/removable-event-poll.rules new file +0 -0
new file mode 100644
index 00000000..b736aef6

package/petitboot/removable-event-poll.rules line 4

Quoted 4 lines
package/petitboot/removable-event-poll.rules new file +4 -0
@@ -0,0 +1,4 @@
+
+# petitboot needs notification for media change events on removable devices,
+# which we only get if we've set the poll_msecs sysfs attribute.
+ACTION!="remove", ATTR{removable}=="1", ATTR{events_poll_msecs}="2000"

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#31 lore raw

RFC PATCH 6/8 package/petitboot: Add petitboot, the userspace bootloader

Hi Thomas,

Quoted 7 lines

I don't think we want a dependency here, as it's not necessarily obvious that this needs a kexec implementation. Therefore, I think we should have something like:

select BR2_PACKAGE_KEXEC_LITE if !BR2_PACKAGE_KEXEC

So that at least one implementation is guaranteed to be selected.

OK, done.

Quoted 8 lines

package/petitboot/petitboot.mk line 8

Quoted 2 lines
package/petitboot/petitboot.mk new file +2 -0
+PETITBOOT_SITE = git://git.ozlabs.org/home/jk/git/petitboot
+PETITBOOT_DEPENDENCIES = ncurses udev

If kexec is only a runtime dependency (and not a build dependency), then there should be a comment above the "select" of kexec in the Config.in that says it's only a runtime dependency.

Same thing for powerpc-utils.

I've noted this in the Config.in file now.

Quoted 10 lines

package/petitboot/petitboot.mk line 13

Quoted 5 lines
package/petitboot/petitboot.mk new file +5 -0
+PETITBOOT_LICENSE = GPLv2
+PETITBOOT_LICENSE_FILES = COPYING
+
+PETITBOOT_CONF_OPT += --with-ncurses --without-twin-x11 --without-twin-fbdev \
+		      --localstatedir=/var --with-tftp=busybox \

The --with-tftp=busybox seems to implies that Busybox is used. Technically speaking, Buildroot allows to build a root filesystem without Busybox. So either you should support both Busybox-based and non-Busybox based filesystems, or depend/select Busybox.

Petitboot supports both busybox tftp and tftp-hpa, but by specifying this to configure allows petitboot to skip a check at runtime. It's just a little optimisation, and I'll make it conditional on BR2_PACKAGE_BUSYBOX.

Quoted 6 lines

package/petitboot/petitboot.mk line 17

Quoted 4 lines
package/petitboot/petitboot.mk new file +4 -0
+		      HOST_PROG_KEXEC=/usr/sbin/kexec \
+		      HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot
+
+ifdef PETITBOOT_DEBUG

Where is PETITBOOT_DEBUG defined?

This is a little hack I use to build petitboot with debug enabled (so we get more verbose log output), by specifying PETITBOOT_DEBUG=1 on the make invocation. If this isn't acceptable, I can work around it :)

Quoted 19 lines

package/petitboot/petitboot.mk line 29

Quoted 12 lines
package/petitboot/petitboot.mk new file +12 -0
+PETITBOOT_CONF_OPT += --enable-debug
+endif
+
+ifeq ($(BR2_PACKAGE_NCURSES_WIDEC),y)
+PETITBOOT_CONF_OPT += --with-ncursesw MENU_LIB=-lmenuw FORM_LIB=-lformw
+endif
+
+define PETITBOOT_PRE_CONFIGURE_BOOTSTRAP
+	(cd $(@D) && ./bootstrap $(PETITBOOT_VERSION))
+endef
+
+PETITBOOT_PRE_CONFIGURE_HOOKS += PETITBOOT_PRE_CONFIGURE_BOOTSTRAP

It's unfortunate that we can't use the normal <pkg>_AUTORECONF = YES logic, due to how configure.ac is generated from configure.ac.in. Anyway, if you do want to call the bootstrap script, you need to make this package depend on host-autoconf, host-automake and maybe host-libtool if you're using libtool.

Quoted 3 lines

Also, I see in your configure.ac.in that you use Lex and Yacc. Therefore, your package should depend on host-bison and host-flex. These are not mandatory dependencies of Buildroot.

OK, updated.

I'm planning to fix the autoreconf bits in a future petitboot change, so this should get a little simpler later.

Thanks for the review, I'll post a new series soon.

Cheers,

Jeremy

#32 lore raw

RFC PATCH 7/8 package/iprutils: Add IBM Power RAID utilities

In reply to Jeremy Kerr
---
 package/Config.in                                |    1 
 package/iprutils/Config.in                       |   10 +++++
 package/iprutils/iprutils-dont-use-gettext.patch |   30 +++++++++++++++
 package/iprutils/iprutils.mk                     |   27 +++++++++++++
 4 files changed, 68 insertions(+)
package/Config.in +1 -0
index f650476c..a9fc035f 100644
@@ -1000,6 +1000,7 @@ endif
 source "package/cpuload/Config.in"
 source "package/dsp-tools/Config.in"
 source "package/htop/Config.in"
+source "package/iprutils/Config.in"
 source "package/keyutils/Config.in"
 source "package/kmod/Config.in"
 source "package/lxc/Config.in"
package/iprutils/Config.in new file +10 -0
new file mode 100644
index 00000000..d72688f2
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_IPRUTILS
+	bool "iprutils"
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NCURSES_TARGET_PANEL
+	select BR2_PACKAGE_NCURSES_TARGET_FORM
+	select BR2_PACKAGE_NCURSES_TARGET_MENU
+	select BR2_PACKAGE_LIBSYSFS
+	select BR2_PACKAGE_PCIUTILS
+	help
+	  System utilities for IBM Power RAID devices
package/iprutils/iprutils-dont-use-gettext.patch new file +30 -0
new file mode 100644
index 00000000..8d3d5dd9
@@ -0,0 +1,30 @@
+From 0aa3952890e14f5447147ae4d0d37c515e4fefea Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <[email protected]>
+Date: Fri, 26 Jul 2013 13:07:22 +0800
+Subject: [PATCH] iprconfig: Don't use gettext
+
+... since we don't have any translations.
+
+Signed-off-by: Jeremy Kerr <[email protected]>
+---
+ iprconfig.h |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/iprconfig.h b/iprconfig.h
+index 867b5ac..a9cdf5e 100644
+--- a/iprconfig.h
++++ b/iprconfig.h
+@@ -11,9 +11,7 @@
+  *
+  **/
+ 
+-#include <libintl.h>
+-
+-#define _(string) gettext(string)
++#define _(string) (string)
+ #define __(string) (string)
+ #define EXIT_FLAG		0x8000	/* stops at given screen on exit call */
+ #define CANCEL_FLAG		0x4000	/* stops at given screen on quit call */
+-- 
+1.7.10.4
+
package/iprutils/iprutils.mk new file +27 -0
new file mode 100644
index 00000000..0aa94f38
@@ -0,0 +1,27 @@
+#############################################################
+#
+# iprutils
+#
+#############################################################
+
+IPRUTILS_VERSION = 2.3.15
+IPRUTILS_SITE = http://downloads.sourceforge.net/project/iprdd/iprutils%20for%202.6%20kernels/$(IPRUTILS_VERSION)
+IPRUTILS_SOURCE=iprutils-$(IPRUTILS_VERSION)-src.tgz
+IPRUTILS_DEPENDENCIES = ncurses libsysfs pciutils
+IPRUTILS_LICENSE = Common Public License Version 1.0
+IPRUTILS_LICENSE_FILES = LICENSE
+
+define IPRUTILS_BUILD_CMDS
+	$(MAKE) CC=$(TARGET_CC) LD=$(TARGET_LD) -C $(@D) all
+endef
+
+define IPRUTILS_INSTALL_TARGET_CMDS
+        $(INSTALL) -d $(TARGET_DIR)/sbin
+        $(INSTALL) -D --mode=755 $(@D)/iprconfig $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprupdate $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprdump $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprinit $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=700 $(@D)/iprdbg $(TARGET_DIR)/sbin/
+endef
+
+$(eval $(generic-package))
#33 lore raw

RFC PATCH 7/8 package/iprutils: Add IBM Power RAID utilities

Hi Jeremy,

Quoted 6 lines
---
  package/Config.in                                |    1
  package/iprutils/Config.in                       |   10 +++++
  package/iprutils/iprutils-dont-use-gettext.patch |   30 +++++++++++++++

iprutils-01-dont-use-gettext.patch

Quoted 2 lines
  package/iprutils/iprutils.mk                     |   27 +++++++++++++
  4 files changed, 68 insertions(+)

[...]

package/iprutils/iprutils.mk line 1

Quoted 7 lines
package/iprutils/iprutils.mk new file +1 -0
new file mode 100644
index 00000000..0aa94f38
@@ -0,0 +1,27 @@
+#############################################################

80 of # signs

package/iprutils/iprutils.mk line 5

Quoted 4 lines
package/iprutils/iprutils.mk new file +4 -0
+#
+# iprutils
+#
+#############################################################

ditto

package/iprutils/iprutils.mk line 9

Quoted 4 lines
package/iprutils/iprutils.mk new file +4 -0
+
+IPRUTILS_VERSION = 2.3.15
+IPRUTILS_SITE = http://downloads.sourceforge.net/project/iprdd/iprutils%20for%202.6%20kernels/$(IPRUTILS_VERSION)
+IPRUTILS_SOURCE=iprutils-$(IPRUTILS_VERSION)-src.tgz

IPRUTILS_SOURCE = iprutils-$(IPRUTILS_VERSION)-src.tgz

Regards,
Jerzy

Quoted 23 lines
package/iprutils/iprutils.mk new file +18 -0
+IPRUTILS_DEPENDENCIES = ncurses libsysfs pciutils
+IPRUTILS_LICENSE = Common Public License Version 1.0
+IPRUTILS_LICENSE_FILES = LICENSE
+
+define IPRUTILS_BUILD_CMDS
+	$(MAKE) CC=$(TARGET_CC) LD=$(TARGET_LD) -C $(@D) all
+endef
+
+define IPRUTILS_INSTALL_TARGET_CMDS
+        $(INSTALL) -d $(TARGET_DIR)/sbin
+        $(INSTALL) -D --mode=755 $(@D)/iprconfig $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprupdate $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprdump $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprinit $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=700 $(@D)/iprdbg $(TARGET_DIR)/sbin/
+endef
+
+$(eval $(generic-package))

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#34 lore raw

RFC PATCH 7/8 package/iprutils: Add IBM Power RAID utilities

Hi Jerzy,

Thanks for the review. Comments inline:

Quoted 5 lines
Quoted 3 lines
  package/Config.in                                |    1
  package/iprutils/Config.in                       |   10 +++++
  package/iprutils/iprutils-dont-use-gettext.patch |   30 +++++++++++++++

iprutils-01-dont-use-gettext.patch

Makes sense. Fixed, along with the other patches introduced in this series.

Quoted 9 lines

package/iprutils/iprutils.mk line 1

Quoted 7 lines
package/iprutils/iprutils.mk new file +1 -0
new file mode 100644
index 00000000..0aa94f38
@@ -0,0 +1,27 @@
+#############################################################

80 of # signs

Fixed, including other new .mk files in this series

Quoted 8 lines
Quoted 6 lines
package/iprutils/iprutils.mk new file +3 -0
+
+IPRUTILS_VERSION = 2.3.15
+IPRUTILS_SITE =

http://downloads.sourceforge.net/project/iprdd/iprutils%20for%202.6%20kernels/$(IPRUTILS_VERSION)

+IPRUTILS_SOURCE=iprutils-$(IPRUTILS_VERSION)-src.tgz

IPRUTILS_SOURCE = iprutils-$(IPRUTILS_VERSION)-src.tgz

Fixed.

I've updated my git tree based on your feedback, I'll repost after a little while, in case there are any more changes requested.

Cheers,

Jeremy

#35 lore raw

RFC PATCH 7/8 package/iprutils: Add IBM Power RAID utilities

In reply to Jeremy Kerr

Dear Jeremy Kerr,

package/iprutils/iprutils.mk line 24

Quoted 7 lines · Jeremy Kerr
package/iprutils/iprutils.mk new file +7 -0
+define IPRUTILS_INSTALL_TARGET_CMDS
+        $(INSTALL) -d $(TARGET_DIR)/sbin
+        $(INSTALL) -D --mode=755 $(@D)/iprconfig $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprupdate $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprdump $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=755 $(@D)/iprinit $(TARGET_DIR)/sbin/
+        $(INSTALL) -D --mode=700 $(@D)/iprdbg $(TARGET_DIR)/sbin/

We generally do:

	$(INSTALL) -D -m 0755 $(@D)/iprconfig $(TARGET_DIR)/sbin/iprconfig

this also avoids the need to create $(TARGET_DIR)/sbin in the first line.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#36 lore raw

RFC PATCH 8/8 Add powerpc petitboot defconfig

In reply to Jeremy Kerr

A simple defconfig for building a petitboot-based bootloader for powerpc machines.

---
 configs/powerpc_petitboot_defconfig |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
configs/powerpc_petitboot_defconfig new file +22 -0
new file mode 100644
index 00000000..8470c2f9
@@ -0,0 +1,22 @@
+BR2_powerpc=y
+BR2_TOOLCHAIN_BUILDROOT_LARGEFILE=y
+BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
+BR2_GENERATE_LOCALE="en_US.utf8"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV=y
+BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_KEXEC_LITE=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
+BR2_PACKAGE_LINUX_FIRMWARE_CXGB4=y
+BR2_PACKAGE_NCURSES_WIDEC=y
+BR2_PACKAGE_NCURSES_TARGET_FORM=y
+BR2_PACKAGE_NCURSES_TARGET_MENU=y
+BR2_PACKAGE_DROPBEAR=y
+# BR2_PACKAGE_DROPBEAR_SERVER is not set
+BR2_PACKAGE_ETHTOOL=y
+BR2_PACKAGE_NETCAT=y
+BR2_PACKAGE_RSYNC=y
+BR2_PACKAGE_PETITBOOT=y
+BR2_TARGET_ROOTFS_CPIO=y
+BR2_TARGET_ROOTFS_CPIO_GZIP=y
#37 lore raw

cover Enable a buildroot-based petitboot bootloader

In reply to Jeremy Kerr

Hi all,

Quoted 2 lines

While most of this series is fairly straightforward, there are a few items that might need a little more attention:

Also, the way I'm doing the kexec could use a sanity check. Currently, it goes like this:

- we configure busybox init (permanently through inittab) to use /usr/sbin/kexec-restart as the "restart" handler.

- when petitboot is told to boot a new kernel, it loads it (along with optional initrd and device-tree blob) into the running kernel with the kexec command. This only loads the new kernel through the kexec_load syscall, it doesn't initiate any boot process.

- next, petitboot runs its shutdown command, which we've configured as /usr/libexec/petitboot/bb-kexec-reboot. This is a busybox- init-specific script that simply sends a SIGQUIT to bb init to invoke the restart.

- bb init starts the shutdown procedure, and terminates running processes, then finally executes the restart handler (which we configured earlier to /usr/sbin/kexec-restart).

- /usr/sbin/kexec-restart simply calls the reboot() syscall, with the correct magic value to execute the kernel we loaded earlier.

The reason we're using the restart handler here is that busybox init doesn't know about the reboot()'s magic value to perform a kexec, and the busybox folks would rather that this *isn't* handled by init (which makes sense).

Feedback welcome!

Cheers,

Jeremy