Skip to contentSkip to conversation

Enable a buildroot-based petitboot bootloader

PATCH New Jeremy Kerr 6 participants 25 messages Jun 17, 2014 – Jan 2, 2015

lore
Share & tools
lore
#0 lore raw

v3 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=582c47a4

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.

Changes since v2:

- petitboot: is now autoreconfable, so drop the custom autoconf tomfoolery

- powerpc-utils, kexec-lite: Update upstream versions

- petitboot: use updated UDEV configuration options

- resync with package/Config.in changes

- drop already-merged changes

Changes since v1, based on feedback:

- drobbear: we only want a config option to disable the server, instead of both client and server

- ncurses: use NCURSES_LIBS-y

- busybox: fix HOOK_DIR glob expansion

- powerpc-utils, kexec-lite, petitboot: update upstream versions

- petitboot: add dependencies

- all: unified headers, now using full git SHAs

- dtc: Added patch to update to 1.4.0

Cheers,

Jeremy

---
Jeremy Kerr (7):
package/busybox: Add facility for DHCP hooks package/dropbear: Add separate configuration option for dropbear 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 Add powerpc64 petitboot defconfig

#1 lore raw

PATCH v3 1/7 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 |    6 ++++++
 2 files changed, 8 insertions(+)
package/busybox/busybox.mk +2 -0
index c368b80..bddeb63 100644
@@ -222,6 +222,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 +6 -0
index e23d1f1..50c52e6 100755
@@ -64,4 +64,10 @@ case "$1" in
 		;;
 esac
 
+HOOK_DIR="$0.d"
+for hook in "${HOOK_DIR}/"*; do
+    [ -f "${hook}" -a -x "${hook}" ] || continue
+    "${hook}" "${@}"
+done
+
 exit 0
#2 lore raw

PATCH v3 1/7 package/busybox: Add facility for DHCP hooks

Jeremy, All,

On 2014-06-17 13:21 +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.

Regards,
Yann E. MORIN.

Quoted 37 lines
---
 package/busybox/busybox.mk    |    2 ++
 package/busybox/udhcpc.script |    6 ++++++
 2 files changed, 8 insertions(+)
package/busybox/busybox.mk +2 -0
index c368b80..bddeb63 100644
@@ -222,6 +222,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 +6 -0
index e23d1f1..50c52e6 100755
@@ -64,4 +64,10 @@ case "$1" in
 		;;
 esac
 
+HOOK_DIR="$0.d"
+for hook in "${HOOK_DIR}/"*; do
+    [ -f "${hook}" -a -x "${hook}" ] || continue
+    "${hook}" "${@}"
+done
+
 exit 0

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

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

PATCH v3 1/7 package/busybox: Add facility for DHCP hooks

In reply to Jeremy Kerr
Quoted 9 lines · Jeremy Kerr

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 could do some nitpicking but it's good enough as it is.

Regards,
Arnout

Quoted 39 lines
---
 package/busybox/busybox.mk    |    2 ++
 package/busybox/udhcpc.script |    6 ++++++
 2 files changed, 8 insertions(+)
package/busybox/busybox.mk +2 -0
index c368b80..bddeb63 100644
@@ -222,6 +222,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 +6 -0
index e23d1f1..50c52e6 100755
@@ -64,4 +64,10 @@ case "$1" in
 		;;
 esac
 
+HOOK_DIR="$0.d"
+for hook in "${HOOK_DIR}/"*; do
+    [ -f "${hook}" -a -x "${hook}" ] || continue
+    "${hook}" "${@}"
+done
+
 exit 0

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

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#4 lore raw

PATCH v3 1/7 package/busybox: Add facility for DHCP hooks

In reply to Jeremy Kerr

Dear Jeremy Kerr,

Quoted 9 lines · Jeremy Kerr

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.

Thanks, applied after reworking on top of the latest Buildroot.

Thomas

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

PATCH v3 2/7 package/dropbear: Add separate configuration option for dropbear server

In reply to Jeremy Kerr

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

Even though it's a multi-call binary (the client and server exist in the same executable), we can define which parts are compiled-in. We'd also like to selectively install the links and init scripts.

This change introduces a separate configuration for the dropbear server.

---
 package/dropbear/Config.in   |    6 ++++++
 package/dropbear/dropbear.mk |   11 +++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
package/dropbear/Config.in +6 -0
index 68c3b71..9ff5f47 100644
@@ -8,6 +8,12 @@ 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_DISABLE_REVERSEDNS
 	bool "disable reverse DNS lookups"
 	help
package/dropbear/dropbear.mk +9 -2
index 3a39169..4fa26da 100644
@@ -8,8 +8,9 @@ DROPBEAR_VERSION = 2014.63
 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_MAKE_PROGRAMS = $(filter-out ssh, $(DROPBEAR_TARGET_BINS))
 DROPBEAR_MAKE =	$(MAKE) MULTI=1 SCPPROGRESS=1 \
-		PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
+		PROGRAMS="$(DROPBEAR_MAKE_PROGRAMS)"
 
 DROPBEAR_LICENSE = MIT, BSD-2c-like, BSD-2c
 DROPBEAR_LICENSE_FILES = LICENSE
@@ -18,6 +19,10 @@ ifeq ($(BR2_PREFER_STATIC_LIB),y)
 DROPBEAR_MAKE += STATIC=1
 endif
 
+ifeq ($(BR2_PACKAGE_DROPBEAR_SERVER),y)
+DROPBEAR_TARGET_BINS += dropbear
+endif
+
 define DROPBEAR_FIX_XAUTH
 	$(SED) 's,^#define XAUTH_COMMAND.*/xauth,#define XAUTH_COMMAND "/usr/bin/xauth,g' $(@D)/options.h
 endef
@@ -43,6 +48,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
@@ -59,6 +65,7 @@ endef
 else
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_DISABLE_STANDALONE
 endif
+endif
 
 ifeq ($(BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS),)
 DROPBEAR_POST_EXTRACT_HOOKS += DROPBEAR_ENABLE_REVERSE_DNS
@@ -82,7 +89,7 @@ endif
 
 define DROPBEAR_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 755 $(@D)/dropbearmulti $(TARGET_DIR)/usr/sbin/dropbear
-	for f in $(DROPBEAR_TARGET_BINS); do \
+	for f in $(filter-out dropbear,$(DROPBEAR_TARGET_BINS)); do \
 		ln -snf ../sbin/dropbear $(TARGET_DIR)/usr/bin/$$f ; \
 	done
 	mkdir -p $(TARGET_DIR)/etc/dropbear
#6 lore raw

PATCH v3 2/7 package/dropbear: Add separate configuration option for dropbear server

Quoted 10 lines · Jeremy Kerr

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

Even though it's a multi-call binary (the client and server exist in the same executable), we can define which parts are compiled-in. We'd also like to selectively install the links and init scripts.

This change introduces a separate configuration for the dropbear server.

Hi.
This can be disabled in a post build script by removing the initscript directly.
If it were a build option that saves space in the target i'd say yay, but it's not.
And it's a slippery rope since the same could be said/done to countless other packages that have client-server functionality like openssh, netsnmp, openvpn and so on.
Others might disagree with me of course.
Regards.

#7 lore raw

PATCH v3 2/7 package/dropbear: Add separate configuration option for dropbear server

Dear Gustavo Zacarias,

Quoted 8 lines · Gustavo Zacarias

This can be disabled in a post build script by removing the initscript directly.
If it were a build option that saves space in the target i'd say yay, but it's not.
And it's a slippery rope since the same could be said/done to countless other packages that have client-server functionality like openssh, netsnmp, openvpn and so on.
Others might disagree with me of course.

Agreed. Therefore, I've marked the patch as rejected in patchwork.

Thanks,

Thomas

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

PATCH v3 3/7 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  |    6 ++++++
 package/ncurses/ncurses.mk |   24 ++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)
package/ncurses/Config.in +6 -0
index e8ab710..b90ec9e 100644
@@ -10,6 +10,12 @@ config BR2_PACKAGE_NCURSES
 
 if BR2_PACKAGE_NCURSES
 
+config BR2_PACKAGE_NCURSES_WCHAR
+	bool "enable wide char support"
+	depends on BR2_USE_WCHAR
+	help
+	  Enable wide char & UTF-8 support in ncurses libraries
+
 config BR2_PACKAGE_NCURSES_TARGET_PANEL
 	bool "ncurses libpanel in target"
 	help
package/ncurses/ncurses.mk +22 -2
index 4bba8f1..bd2aac0 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$(NCURSES_LIB_SUFFIX)5-config
 
 NCURSES_CONF_OPT = \
 	$(if $(BR2_PREFER_STATIC_LIB),--without-shared,--with-shared) \
@@ -36,6 +36,24 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 	NCURSES_DEPENDENCIES += busybox
 endif
 
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
+NCURSES_CONF_OPT += --enable-widec
+NCURSES_LIB_SUFFIX = w
+
+define NCURSES_LINK_LIBS
+	for lib in $(NCURSES_LIBS-y); do \
+		ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
+			$(1)/usr/lib/$${lib}.so; \
+	done
+endef
+
+NCURSES_LINK_TARGET_LIBS =  $(call NCURSES_LINK_LIBS, $(TARGET_DIR))
+NCURSES_LINK_STAGING_LIBS =  $(call NCURSES_LINK_LIBS, $(STAGING_DIR))
+
+NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
+
+endif
+
 NCURSES_LIBS-y = libncurses
 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_MENU) += libmenu
 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_PANEL) += libpanel
@@ -56,7 +74,8 @@ endef
 ifneq ($(BR2_PREFER_STATIC_LIB),y)
 define NCURSES_INSTALL_TARGET_LIBS
 	for lib in $(NCURSES_LIBS-y); do \
-		cp -dpf $(NCURSES_DIR)/lib/$${lib}.so* $(TARGET_DIR)/usr/lib/; \
+		cp -dpf $(NCURSES_DIR)/lib/$${lib}$(NCURSES_LIB_SUFFIX).so* \
+			$(TARGET_DIR)/usr/lib/; \
 	done
 endef
 endif
@@ -74,6 +93,7 @@ endif
 define NCURSES_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/usr/lib
 	$(NCURSES_INSTALL_TARGET_LIBS)
+	$(NCURSES_LINK_TARGET_LIBS)
 	$(NCURSES_INSTALL_TARGET_PROGS)
 	ln -snf /usr/share/terminfo $(TARGET_DIR)/usr/lib/terminfo
 	mkdir -p $(TARGET_DIR)/usr/share/terminfo/x
#9 lore raw

PATCH v3 3/7 package/ncurses: Allow building wide char support

Quoted 5 lines · 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.

Hi.
I'm testing this patch for bug #6950 goodness.
In principle what you do seems fine rather than going the split approach like it's mentioned in the bug.
However the patch needs a little tweak:

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

Quoted 10 lines
package/ncurses/ncurses.mk +10 -0
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
+NCURSES_CONF_OPT += --enable-widec
+NCURSES_LIB_SUFFIX = w
+
+define NCURSES_LINK_LIBS
+	for lib in $(NCURSES_LIBS-y); do \
+		ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
+			$(1)/usr/lib/$${lib}.so; \
+	done
+endef

You're basically not dealing with the static version of the libraries here, this breaks at least tmux (it statically links in ncurses), and i'm sure many other BR2_PREFER_STATIC_LIB=y scenarios.

A big allyespackageconfig run revealed a couple of packages breaking, namely nano and statserial, i've already cooked patches for them and send them shortly to the list.

Otherwise it seems all is great.
Thanks.
Regards.

#10 lore raw

PATCH v3 3/7 package/ncurses: Allow building wide char support

Hi Jeremy, Gustavo,

Quoted 29 lines · Gustavo Zacarias
Quoted 5 lines · 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.

Hi.
I'm testing this patch for bug #6950 goodness.
In principle what you do seems fine rather than going the split approach like it's mentioned in the bug.
However the patch needs a little tweak:

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

Quoted 10 lines
package/ncurses/ncurses.mk +10 -0
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
+NCURSES_CONF_OPT += --enable-widec
+NCURSES_LIB_SUFFIX = w
+
+define NCURSES_LINK_LIBS
+     for lib in $(NCURSES_LIBS-y); do \
+             ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
+                     $(1)/usr/lib/$${lib}.so; \
+     done
+endef

You're basically not dealing with the static version of the libraries here, this breaks at least tmux (it statically links in ncurses), and i'm sure many other BR2_PREFER_STATIC_LIB=y scenarios.

Quoted 5 lines

A big allyespackageconfig run revealed a couple of packages breaking, namely nano and statserial, i've already cooked patches for them and send them shortly to the list.

Otherwise it seems all is great.

Could any of you respin and repost the patch with this comment taken into account?

Thanks a lot,
Thomas

#11 lore raw

PATCH v3 3/7 package/ncurses: Allow building wide char support

Hi Thomas,

Quoted 2 lines

Could any of you respin and repost the patch with this comment taken into account?

Sure, will do.

Gustavo - is this breakage simply with BR2_PREFER_STATIC_LIB? or is there some better way to reproduce this issue, so I can ensure my new patch fixes this?

Thanks,

Jeremy

#12 lore raw

PATCH v3 3/7 package/ncurses: Allow building wide char support

Quoted 7 lines · Jeremy Kerr

Sure, will do.

Gustavo - is this breakage simply with BR2_PREFER_STATIC_LIB? or is there some better way to reproduce this issue, so I can ensure my new patch fixes this?

Thanks,

Hi Jeremy, thanks for getting back.
A quick fix would be:

----
ifeq ($(BR2_PREFER_STATIC_LIB),y)
define NCURSES_LINK_LIBS

        for lib in $(NCURSES_LIBS-y); do \
                ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
                        $(1)/usr/lib/$${lib}.a; \
        done
endef
else
define NCURSES_LINK_LIBS
        for lib in $(NCURSES_LIBS-y); do \
                ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
                        $(1)/usr/lib/$${lib}.so; \
        done

endef
endif
----

The only scenario that i could fail with static builds is blackfin with flat targets, the ncurses widechar build breaks in a very odd way, which i exclude via:

----
config BR2_PACKAGE_NCURSES_WCHAR
bool "enable wide char support"
depends on BR2_USE_WCHAR
# Build broken @ curses.priv.h with bad declarations depends on !(BR2_bfin && BR2_BINFMT_FLAT) help
Enable wide char & UTF-8 support in ncurses libraries
----

Unless someone wants to dig deep into that breakage and fix it i guess it's fine to exclude that combination.
Regards.

#13 lore raw

PATCH v3 4/7 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.

---
 package/Config.in                      |    1 +
 package/powerpc-utils/Config.in        |    5 +++++
 package/powerpc-utils/powerpc-utils.mk |   16 ++++++++++++++++
 3 files changed, 22 insertions(+)
package/Config.in +1 -0
index f43e985..125f3f0 100644
@@ -1115,6 +1115,7 @@ endif
 	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-ng/Config.in"
package/powerpc-utils/Config.in new file +5 -0
new file mode 100644
index 0000000..c919094
@@ -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.mk new file +16 -0
new file mode 100644
index 0000000..c9cc096
@@ -0,0 +1,16 @@
+################################################################################
+#
+# powerpc-utils
+#
+################################################################################
+
+POWERPC_UTILS_VERSION = v1.4
+POWERPC_UTILS_SITE = git://git.code.sf.net/p/powerpc-utils/powerpc-utils
+POWERPC_UTILS_AUTORECONF = YES
+POWERPC_UTILS_DEPENDENCIES = zlib
+POWERPC_UTILS_LICENSE = Common Public License Version 1.0
+POWERPC_UTILS_LICENSE_FILES = COPYRIGHT
+
+POWERPC_UTILS_CONF_OPT = --without-librtas
+
+$(eval $(autotools-package))
#14 lore raw

PATCH v3 4/7 package/powerpc-utils: Add powerpc hardware utilities

Dear Jeremy Kerr,

Quoted 7 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.

Thanks, applied with minor changes, as outlined in the commit log:

[Thomas:
- Add dependency on PowerPC architecture in Config.in.
- Add homepage in Config.in help text.]

Thanks,

Thomas

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

PATCH v3 5/7 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                         |   12 +++
 package/kexec-lite/kexec-lite-01-clean-restart.patch |   34 +++++++++++
 package/kexec-lite/kexec-lite.mk                     |   22 +++++++
 4 files changed, 69 insertions(+)
package/Config.in +1 -0
index 125f3f0..b0d4d47 100644
@@ -56,6 +56,7 @@ menu "Debugging, profiling and benchmark"
 	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 +12 -0
new file mode 100644
index 0000000..b5bd58f
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_KEXEC_LITE
+	bool "kexec-lite"
+	depends on BR2_powerpc || BR2_powerpc64
+	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 package is a tiny implementation of the kexec userspace
+	  components, for devicetree-based platforms.
package/kexec-lite/kexec-lite-01-clean-restart.patch new file +34 -0
new file mode 100644
index 0000000..faaa93a
@@ -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 +22 -0
new file mode 100644
index 0000000..e47edc6
@@ -0,0 +1,22 @@
+################################################################################
+#
+# kexec-lite
+#
+################################################################################
+
+KEXEC_LITE_VERSION = fb8543fea3beb0522b5a63a74ea1a845dbd7b954
+KEXEC_LITE_SITE = $(call github,antonblanchard,kexec-lite,$(KEXEC_LITE_VERSION))
+KEXEC_LITE_LICENSE = GPL
+KEXEC_LITE_DEPENDENCIES = libelf dtc
+
+define KEXEC_LITE_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" \
+		    CFLAGS="$(TARGET_CFLAGS)" \
+		    -C $(@D) all
+endef
+
+define KEXEC_LITE_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/kexec $(TARGET_DIR)/usr/sbin/
+endef
+
+$(eval $(generic-package))
#16 lore raw

PATCH v3 5/7 package/kexec-lite: Add a package for the kexec-lite tools

Dear Jeremy Kerr,

Quoted 4 lines · Jeremy Kerr

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

Thanks, applied, with a bunch of minor changes. From the commit log:

[Thomas:
- Add !BR2_PREFER_STATIC_LIB dependency, inherited from the dtc package
- Fix license to be GPLv2+, and not just GPL.
- Use $(TARGET_CONFIGURE_OPTS) instead of manually passing CC, LD, CFLAGS.
- Use a full path as the target of $(INSTALL)]

Thanks!

Thomas

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

PATCH v3 6/7 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                  |   21 +++++++
 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, 128 insertions(+)
package/Config.in +1 -0
index b0d4d47..a769d33 100644
@@ -1116,6 +1116,7 @@ endif
 	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 +21 -0
new file mode 100644
index 0000000..d1e1783
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_PETITBOOT
+	bool "petitboot"
+	# petitboot needs udev /dev management
+	depends on BR2_PACKAGE_HAS_UDEV
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NCURSES_TARGET_PANEL
+	select BR2_PACKAGE_NCURSES_TARGET_FORM
+	select BR2_PACKAGE_NCURSES_TARGET_MENU
+	# run-time dependency only
+	select BR2_PACKAGE_KEXEC_LITE if !BR2_PACKAGE_KEXEC
+	# run-time dependency only
+	select BR2_PACKAGE_POWERPC_UTILS if BR2_powerpc || BR2_powerpc64
+	# run-time dependency only
+	select BR2_PACKAGE_IPRUTILS if BR2_powerpc || BR2_powerpc64
+	help
+	  Petitboot is a small kexec-based bootloader
+
+	  http://www.kernel.org/pub/linux/kernel/people/geoff/petitboot/petitboot.html
+
+comment "petitboot requires udev to be enabled"
+	depends on !BR2_PACKAGE_HAS_UDEV
package/petitboot/S14silence-console new file +9 -0
new file mode 100755
index 0000000..6570200
@@ -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 0000000..ebdf944
@@ -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 0000000..0175e76
@@ -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 0000000..7464856
@@ -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 0000000..b736aef
@@ -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"
#18 lore raw

PATCH v3 6/7 package/petitboot: Add petitboot, the userspace bootloader

Hi Jeremy,

Quoted 44 lines · 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                  |   21 +++++++
 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, 128 insertions(+)
package/Config.in +1 -0
index b0d4d47..a769d33 100644
@@ -1116,6 +1116,7 @@ endif
 	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 +0 -0
new file mode 100644
index 0000000..d1e1783

package/petitboot/Config.in line 4

Quoted 4 lines
package/petitboot/Config.in new file +4 -0
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_PETITBOOT
+	bool "petitboot"
+	# petitboot needs udev /dev management
+	depends on BR2_PACKAGE_HAS_UDEV

It looks to me that it also relies on udhcpc, which would mean you need to
depend on BUSYBOX. But of course, the thing still works even without udhcpc, it would just not react to dhcp/bootp, right?

package/petitboot/Config.in line 16

Quoted 12 lines
package/petitboot/Config.in new file +12 -0
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NCURSES_TARGET_PANEL
+	select BR2_PACKAGE_NCURSES_TARGET_FORM
+	select BR2_PACKAGE_NCURSES_TARGET_MENU
+	# run-time dependency only
+	select BR2_PACKAGE_KEXEC_LITE if !BR2_PACKAGE_KEXEC
+	# run-time dependency only
+	select BR2_PACKAGE_POWERPC_UTILS if BR2_powerpc || BR2_powerpc64
+	# run-time dependency only
+	select BR2_PACKAGE_IPRUTILS if BR2_powerpc || BR2_powerpc64
+	help
+	  Petitboot is a small kexec-based bootloader

We probably want a little more explanation about how you can use petitboot,
i.e. make a very small buildroot config with just petitboot and an initramfs filesystem, and use that to boot a full-fledged system which doesn't even need to be buildroot-based.

Quoted 11 lines
package/petitboot/Config.in new file +5 -0
+
+	  http://www.kernel.org/pub/linux/kernel/people/geoff/petitboot/petitboot.html
+
+comment "petitboot requires udev to be enabled"
+	depends on !BR2_PACKAGE_HAS_UDEV
package/petitboot/S14silence-console new file +0 -0
new file mode 100755
index 0000000..6570200

package/petitboot/S14silence-console line 7

Quoted 7 lines
package/petitboot/S14silence-console new file +7 -0
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case "$1" in
+    start)
+        echo 0 0 7 0 > /proc/sys/kernel/printk
+        ;;
+esac

Why is this needed? I mean, we could do this in general in buildroot but do we
really want it?

Quoted 13 lines
package/petitboot/S14silence-console new file +2 -0
+
+exit 0
package/petitboot/S15pb-discover new file +5 -0
new file mode 100755
index 0000000..ebdf944
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+LOGFILE=/var/log/petitboot/pb-discover.log
+PIDFILE=/var/run/petitboot.pid
+

package/petitboot/S15pb-discover line 15

Quoted 10 lines
package/petitboot/S15pb-discover new file +10 -0
+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

Why are we not using start-stop-daemon here like in all other init scripts?

Quoted 14 lines
package/petitboot/S15pb-discover new file +8 -0
+        ;;
+    *)
+        echo "Usage: $0 {start|stop}"
+        exit 1
+        ;;
+esac
+
+exit 0
package/petitboot/kexec-restart new file +0 -0
new file mode 100755
index 0000000..0175e76

package/petitboot/kexec-restart line 8

Quoted 8 lines
package/petitboot/kexec-restart new file +8 -0
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+/usr/sbin/kexec -f -e
+
+while :
+do
+    sleep 1
+done

Can you shed some light about why this script is needed and why it's not part
of petitboot itself?

package/petitboot/petitboot-console-ui.rules line 5

Quoted 11 lines
package/petitboot/petitboot-console-ui.rules new file +5 -0
new file mode 100644
index 0000000..7464856
@@ -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"

It would make a lot more sense to me to use BR2_TARGET_GENERIC_GETTY_PORT and
leave it up to the user to update the ui-rules for his particular configuration, if necessary.

Quoted 15 lines
package/petitboot/petitboot.mk new file +9 -0
new file mode 100644
index 0000000..1bbf522
@@ -0,0 +1,57 @@
+################################################################################
+#
+# petitboot
+#
+################################################################################
+
+PETITBOOT_VERSION = 509fca5ca2733a741521ae4332400d54d95ee073
+PETITBOOT_SITE = git://ozlabs.org/~jk/petitboot
+PETITBOOT_DEPENDENCIES = ncurses udev host-bison host-flex

package/petitboot/petitboot.mk line 19

Quoted 10 lines
package/petitboot/petitboot.mk new file +10 -0
+PETITBOOT_LICENSE = GPLv2
+PETITBOOT_LICENSE_FILES = COPYING
+
+PETITBOOT_AUTORECONF = YES
+PETITBOOT_AUTORECONF_OPT = -i
+PETITBOOT_CONF_OPT += --with-ncurses --without-twin-x11 --without-twin-fbdev \
+	      --localstatedir=/var \
+	      HOST_PROG_KEXEC=/usr/sbin/kexec \
+	      HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot \
+	      $(if $(BR2_PACKAGE_BUSYBOX),--with-tftp=busybox)

Indentation should be just a single tab.

With so many options, I prefer one per line. But that's just nitpicking.

package/petitboot/petitboot.mk line 23

Quoted 4 lines
package/petitboot/petitboot.mk new file +4 -0
+
+ifdef PETITBOOT_DEBUG
+PETITBOOT_CONF_OPT += --enable-debug
+endif

I guess these three lines should be removed?

package/petitboot/petitboot.mk line 29

Quoted 6 lines
package/petitboot/petitboot.mk new file +6 -0
+
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
+PETITBOOT_CONF_OPT += --with-ncursesw MENU_LIB=-lmenuw FORM_LIB=-lformw
+endif
+
+PETITBOOT_PRE_CONFIGURE_HOOKS += PETITBOOT_PRE_CONFIGURE_BOOTSTRAP

PETITBOOT_PRE_CONFIGURE_BOOTSTRAP doesn't seem to be defined.

package/petitboot/petitboot.mk line 31

Quoted 2 lines
package/petitboot/petitboot.mk new file +2 -0
+
+define PETITBOOT_POST_INSTALL

Instead of _POST_INSTALL, we generally use more specific names like
PETITBOOT_INSTALL_CONFIG_AND_SCRIPTS. But again, that's just nitpicking.

package/petitboot/petitboot.mk line 43

Quoted 12 lines
package/petitboot/petitboot.mk new file +12 -0
+	$(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/

These should be installed using the PETITBOOT_INSTALL_INIT_SYSV commands. Not
that it's very likely that someone will use petitboot+systemd, but who knows...

package/petitboot/petitboot.mk line 52

Quoted 9 lines
package/petitboot/petitboot.mk new file +9 -0
+	$(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/

Even though after patch 1/7 this directory is created in busybox, you should
still create the directory here as well. Especially because you don't depend on busybox so it may not have been created yet.

Quoted 11 lines
package/petitboot/petitboot.mk new file +5 -0
+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 0000000..b736aef

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"

Why is this not part of petitboot itself?

Regards,
Arnout

Quoted 5 lines

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

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#19 lore raw

PATCH v3 6/7 package/petitboot: Add petitboot, the userspace bootloader

Hi Arnout,

Thanks for taking a look at this!

Quoted 6 lines
Quoted 6 lines
package/petitboot/Config.in new file +0 -0
new file mode 100644
index 0000000..d1e1783
@@ -0,0 +1,21 @@
Quoted 8 lines

package/petitboot/Config.in line 4

Quoted 4 lines
package/petitboot/Config.in new file +4 -0
+config BR2_PACKAGE_PETITBOOT
+	bool "petitboot"
+	# petitboot needs udev /dev management
+	depends on BR2_PACKAGE_HAS_UDEV

It looks to me that it also relies on udhcpc, which would mean you need to
depend on BUSYBOX. But of course, the thing still works even without udhcpc, it would just not react to dhcp/bootp, right?

That's correct; local boot would still work fine without a DHCP client.

Quoted 9 lines
Quoted 9 lines
package/petitboot/Config.in new file +9 -0
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_NCURSES_TARGET_PANEL
+	select BR2_PACKAGE_NCURSES_TARGET_FORM
+	select BR2_PACKAGE_NCURSES_TARGET_MENU
+	# run-time dependency only
+	select BR2_PACKAGE_KEXEC_LITE if !BR2_PACKAGE_KEXEC
+	# run-time dependency only
+	select BR2_PACKAGE_POWERPC_UTILS if BR2_powerpc || BR2_powerpc64
+	# run-time dependency only
Quoted 8 lines

package/petitboot/Config.in line 16

Quoted 3 lines
package/petitboot/Config.in new file +3 -0
+	select BR2_PACKAGE_IPRUTILS if BR2_powerpc || BR2_powerpc64
+	help
+	  Petitboot is a small kexec-based bootloader

We probably want a little more explanation about how you can use petitboot,
i.e. make a very small buildroot config with just petitboot and an initramfs filesystem, and use that to boot a full-fledged system which doesn't even need to be buildroot-based.

You mean just in the help section here?

Quoted 8 lines
Quoted 8 lines
package/petitboot/S14silence-console new file +2 -0
new file mode 100755
index 0000000..6570200
@@ -0,0 +1,9 @@
+#!/bin/sh
+
Quoted 8 lines

package/petitboot/S14silence-console line 7

Quoted 5 lines
package/petitboot/S14silence-console new file +5 -0
+case "$1" in
+    start)
+        echo 0 0 7 0 > /proc/sys/kernel/printk
+        ;;
+esac

Why is this needed? I mean, we could do this in general in buildroot but do we
really want it?

Since the ncurses-based petitboot UI is brought up on init on local serial consoles, we want to suppress kernel printk output, otherwise it'll corrupt the ncurses terminal state.

Quoted 12 lines
Quoted 12 lines
package/petitboot/S15pb-discover new file +9 -0
@@ -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)
Quoted 8 lines

package/petitboot/S15pb-discover line 15

Quoted 6 lines
package/petitboot/S15pb-discover new file +6 -0
+        PATH=/usr/bin:/usr/sbin:/bin:/sbin pb-discover -l $LOGFILE &
+        echo $! > $PIDFILE
+        ;;
+    stop)
+        pid=$(cat $PIDFILE)
+        [ -n "$pid" ] && kill -TERM $pid

Why are we not using start-stop-daemon here like in all other init scripts?

No reason at all, I'll update this :)

Quoted 9 lines
Quoted 9 lines
package/petitboot/kexec-restart new file +3 -0
new file mode 100755
index 0000000..0175e76
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+/usr/sbin/kexec -f -e
Quoted 8 lines

package/petitboot/kexec-restart line 8

Quoted 5 lines
package/petitboot/kexec-restart new file +5 -0
+
+while :
+do
+    sleep 1
+done

Can you shed some light about why this script is needed and why it's not part
of petitboot itself?

This script is used as busybox init's "restart" action, and is called by init, once all processes have been stopped.

It needs to be invoked by init, as petitboot is no longer running at this point. Because it's specific to buildroot with busybox init, I haven't included the script in the petitboot distribution.

Quoted 7 lines
Quoted 7 lines
package/petitboot/petitboot-console-ui.rules new file +1 -0
new file mode 100644
index 0000000..7464856
@@ -0,0 +1,5 @@
+
Quoted 8 lines

package/petitboot/petitboot-console-ui.rules line 5

Quoted 4 lines
package/petitboot/petitboot-console-ui.rules new file +4 -0
+# 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"

It would make a lot more sense to me to use BR2_TARGET_GENERIC_GETTY_PORT and
leave it up to the user to update the ui-rules for his particular configuration, if necessary.

What do you mean by the ui-rules here? Is this something that could still be defined in the general busybox config?

Quoted 28 lines
Quoted 15 lines
package/petitboot/petitboot.mk new file +9 -0
new file mode 100644
index 0000000..1bbf522
@@ -0,0 +1,57 @@
+################################################################################
+#
+# petitboot
+#
+################################################################################
+
+PETITBOOT_VERSION = 509fca5ca2733a741521ae4332400d54d95ee073
+PETITBOOT_SITE = git://ozlabs.org/~jk/petitboot
+PETITBOOT_DEPENDENCIES = ncurses udev host-bison host-flex

package/petitboot/petitboot.mk line 19

Quoted 10 lines
package/petitboot/petitboot.mk new file +10 -0
+PETITBOOT_LICENSE = GPLv2
+PETITBOOT_LICENSE_FILES = COPYING
+
+PETITBOOT_AUTORECONF = YES
+PETITBOOT_AUTORECONF_OPT = -i
+PETITBOOT_CONF_OPT += --with-ncurses --without-twin-x11 --without-twin-fbdev \
+	      --localstatedir=/var \
+	      HOST_PROG_KEXEC=/usr/sbin/kexec \
+	      HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot \
+	      $(if $(BR2_PACKAGE_BUSYBOX),--with-tftp=busybox)

Indentation should be just a single tab.

Quoted 1 line

With so many options, I prefer one per line. But that's just nitpicking.

Makes sense, I'll update.

Quoted 7 lines

package/petitboot/petitboot.mk line 23

Quoted 5 lines
package/petitboot/petitboot.mk new file +4 -0
+
+ifdef PETITBOOT_DEBUG
+PETITBOOT_CONF_OPT += --enable-debug
+endif

I guess these three lines should be removed?

I've been using this to allow a single way of building a debug petitboot system:

make ... PETITBOOT_DEBUG=1

However, petitboot now allows debug selection at runtime, so this is no longer really required. I'll remove it.

Quoted 10 lines

package/petitboot/petitboot.mk line 29

Quoted 7 lines
package/petitboot/petitboot.mk new file +6 -0
+
+ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
+PETITBOOT_CONF_OPT += --with-ncursesw MENU_LIB=-lmenuw FORM_LIB=-lformw
+endif
+
+PETITBOOT_PRE_CONFIGURE_HOOKS += PETITBOOT_PRE_CONFIGURE_BOOTSTRAP

PETITBOOT_PRE_CONFIGURE_BOOTSTRAP doesn't seem to be defined.

Quoted 5 lines

package/petitboot/petitboot.mk line 31

Quoted 2 lines
package/petitboot/petitboot.mk new file +2 -0
+
+define PETITBOOT_POST_INSTALL

Instead of _POST_INSTALL, we generally use more specific names like
PETITBOOT_INSTALL_CONFIG_AND_SCRIPTS. But again, that's just nitpicking.

OK, makes sense.

Quoted 16 lines

package/petitboot/petitboot.mk line 43

Quoted 13 lines
package/petitboot/petitboot.mk new file +12 -0
+	$(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/

These should be installed using the PETITBOOT_INSTALL_INIT_SYSV commands. Not
that it's very likely that someone will use petitboot+systemd, but who knows...

ok, neat.

Quoted 14 lines

package/petitboot/petitboot.mk line 52

Quoted 10 lines
package/petitboot/petitboot.mk new file +9 -0
+	$(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/

Even though after patch 1/7 this directory is created in busybox, you should
still create the directory here as well. Especially because you don't depend on busybox so it may not have been created yet.

Sure, OK.

Quoted 10 lines
Quoted 10 lines
package/petitboot/petitboot.mk new file +5 -0
+endef
+
+PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL
+
+$(eval $(autotools-package))
package/petitboot/removable-event-poll.rules new file +0 -1
new file mode 100644
index 0000000..b736aef
--- /dev/null
Quoted 8 lines

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

Quoted 6 lines

+++ b/package/petitboot/removable-event-poll.rules

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"

Why is this not part of petitboot itself?

You mean the file should be shipped with petitboot? or that the sysfs attribute should be set directly by petitboot instead of udev?

This configuration is only required when petitboot is running on buildroot; other OSes generally have this attribute set already. Because it's somewhat OS-dependent, I haven't included it in generic petitboot.

Cheers,

Jeremy

#20 lore raw

PATCH v3 6/7 package/petitboot: Add petitboot, the userspace bootloader

Quoted 2 lines · Jeremy Kerr

Hi Arnout,

[snip]

Quoted 9 lines
Quoted 7 lines

package/petitboot/Config.in line 16

Quoted 2 lines
package/petitboot/Config.in new file +2 -0
+	help
+	  Petitboot is a small kexec-based bootloader

We probably want a little more explanation about how you can use petitboot,
i.e. make a very small buildroot config with just petitboot and an initramfs filesystem, and use that to boot a full-fledged system which doesn't even need to be buildroot-based.

You mean just in the help section here?

Yes, I mean in the help section. Petitboot is pretty special, because it's not
just a package that you install in your buildroot-generated rootfs and that you use at runtime, but it's also not a bootloader in the buildroot sense. This should be clarified somewhere, and the help text is probably the best place.

Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
package/petitboot/S14silence-console new file +2 -0
new file mode 100755
index 0000000..6570200
@@ -0,0 +1,9 @@
+#!/bin/sh
+
Quoted 8 lines

package/petitboot/S14silence-console line 7

Quoted 5 lines
package/petitboot/S14silence-console new file +5 -0
+case "$1" in
+    start)
+        echo 0 0 7 0 > /proc/sys/kernel/printk
+        ;;
+esac

Why is this needed? I mean, we could do this in general in buildroot but do we
really want it?

Quoted 3 lines

Since the ncurses-based petitboot UI is brought up on init on local serial consoles, we want to suppress kernel printk output, otherwise it'll corrupt the ncurses terminal state.

OK I see. Could you add an explanatory comment?

But does this work? udev is already started before (S10 in case of eudev, and
systemd starts it almost immediately). So it's possible that the pb-console is already started before you do this printk. So I think this should be in S07 or something.

[snip]

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
package/petitboot/kexec-restart new file +3 -0
new file mode 100755
index 0000000..0175e76
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+/usr/sbin/kexec -f -e
Quoted 8 lines

package/petitboot/kexec-restart line 8

Quoted 5 lines
package/petitboot/kexec-restart new file +5 -0
+
+while :
+do
+    sleep 1
+done

Can you shed some light about why this script is needed and why it's not part
of petitboot itself?

Quoted 6 lines

This script is used as busybox init's "restart" action, and is called by init, once all processes have been stopped.

It needs to be invoked by init, as petitboot is no longer running at this point. Because it's specific to buildroot with busybox init, I haven't included the script in the petitboot distribution.

OK. Then its installation should also only be done if the init system is
busybox, and probably you'll need to fixup inittab so the restart action is actually included.

Quoted 17 lines
Quoted 16 lines

package/petitboot/petitboot-console-ui.rules line 5

Quoted 12 lines
package/petitboot/petitboot-console-ui.rules new file +5 -0
new file mode 100644
index 0000000..7464856
@@ -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"

It would make a lot more sense to me to use BR2_TARGET_GENERIC_GETTY_PORT and
leave it up to the user to update the ui-rules for his particular configuration, if necessary.

Quoted 1 line

What do you mean by the ui-rules here?

I mean: if the user wants to launch the pb-console on more than one port, then
they should install a custom petitboot-console-ui.rules file in their overlay.

Quoted 2 lines

Is this something that could
still be defined in the general busybox config?

Yes, petitboot-console-ui.rules could be simplified to

SUBSYSTEM=="tty", KERNEL=="@GETTY_PORT@", RUN+="/usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 $name vt100"

and during installation you sed the @GETTY_PORT@ into BR2_TARGET_GENERIC_GETTY_PORT.

Of course, only if that is defined.

Oh and BTW in that case the getty line should also be removed from inittab. So
you'd be fighting against the finalize hook that adds that getty line... Hmm, tough.

Perhaps the solution is to depend on !BR2_TARGET_GENERIC_GETTY (and add an
appropriate comment to Config.in) and to add the equivalent options to the petitboot Config.in file.

Quoted 16 lines
Quoted 16 lines
Quoted 7 lines
package/petitboot/petitboot.mk new file +0 -0
new file mode 100644
index 0000000..1bbf522

package/petitboot/petitboot.mk line 9

Quoted 9 lines
package/petitboot/petitboot.mk new file +9 -0
@@ -0,0 +1,57 @@
+################################################################################
+#
+# petitboot
+#
+################################################################################
+
+PETITBOOT_VERSION = 509fca5ca2733a741521ae4332400d54d95ee073
+PETITBOOT_SITE = git://ozlabs.org/~jk/petitboot
+PETITBOOT_DEPENDENCIES = ncurses udev host-bison host-flex

BTW, when the initscripts package is merged, you'll probably have to depend on
that, because you need to fix up the init scripts.

Quoted 6 lines
Quoted 6 lines

package/petitboot/petitboot.mk line 15

Quoted 6 lines
package/petitboot/petitboot.mk new file +6 -0
+PETITBOOT_LICENSE = GPLv2
+PETITBOOT_LICENSE_FILES = COPYING
+
+PETITBOOT_AUTORECONF = YES
+PETITBOOT_AUTORECONF_OPT = -i
+PETITBOOT_CONF_OPT += --with-ncurses --without-twin-x11 --without-twin-fbdev \

_OPT has now been renamed to _OPTS.

Quoted 1 line
Quoted 1 line

package/petitboot/petitboot.mk line 16

Quoted 1 line
package/petitboot/petitboot.mk new file +1 -0
+	      --localstatedir=/var \

localstatedir=/var is now passed automatically.

Quoted 3 lines
Quoted 3 lines

package/petitboot/petitboot.mk line 19

Quoted 3 lines
package/petitboot/petitboot.mk new file +3 -0
+	      HOST_PROG_KEXEC=/usr/sbin/kexec \
+	      HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot \
+	      $(if $(BR2_PACKAGE_BUSYBOX),--with-tftp=busybox)

[snip]

I'm afraid that petitboot is something so intrusive that it will take us a
while to get it working well (much like the problems we have with systemd). The defconfig that you provide already helps a lot, though.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#21 lore raw

PATCH v3 7/7 Add powerpc64 petitboot defconfig

In reply to Jeremy Kerr

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

---
 configs/powerpc64_petitboot_defconfig |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
configs/powerpc64_petitboot_defconfig new file +17 -0
new file mode 100644
index 0000000..fa629ab
@@ -0,0 +1,17 @@
+BR2_powerpc64=y
+BR2_GENERATE_LOCALE="en_US.UTF-8"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
+BR2_PACKAGE_LINUX_FIRMWARE_CXGB4=y
+BR2_PACKAGE_NCURSES_WCHAR=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_XZ=y
#22 lore raw

PATCH v3 7/7 Add powerpc64 petitboot defconfig

Quoted 2 lines · Jeremy Kerr

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

It would be nice if you could also create one for a qemu target, so people can
actually experiment with it.

Quoted 13 lines
---
 configs/powerpc64_petitboot_defconfig |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
configs/powerpc64_petitboot_defconfig new file +0 -0
new file mode 100644
index 0000000..fa629ab

configs/powerpc64_petitboot_defconfig line 9

Quoted 9 lines
configs/powerpc64_petitboot_defconfig new file +9 -0
@@ -0,0 +1,17 @@
+BR2_powerpc64=y
+BR2_GENERATE_LOCALE="en_US.UTF-8"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
+BR2_PACKAGE_LINUX_FIRMWARE_CXGB4=y
+BR2_PACKAGE_NCURSES_WCHAR=y

Is this needed?

configs/powerpc64_petitboot_defconfig line 10

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_DROPBEAR=y

Is this useful?

configs/powerpc64_petitboot_defconfig line 12

Quoted 2 lines
configs/powerpc64_petitboot_defconfig new file +2 -0
+# BR2_PACKAGE_DROPBEAR_SERVER is not set
+BR2_PACKAGE_ETHTOOL=y

Is this useful?

configs/powerpc64_petitboot_defconfig line 13

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_NETCAT=y

Is this useful?

configs/powerpc64_petitboot_defconfig line 14

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_RSYNC=y

Is this useful?

Quoted 8 lines
configs/powerpc64_petitboot_defconfig new file +3 -0
+BR2_PACKAGE_PETITBOOT=y
+BR2_TARGET_ROOTFS_CPIO=y
+BR2_TARGET_ROOTFS_CPIO_XZ=y

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

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#23 lore raw

PATCH v3 7/7 Add powerpc64 petitboot defconfig

Hi Arnout,

Quoted 2 lines

It would be nice if you could also create one for a qemu target, so people can
actually experiment with it.

This build should work fine for qemu, is there something else I should be doing here?

Quoted 6 lines
Quoted 6 lines
configs/powerpc64_petitboot_defconfig new file +3 -0
@@ -0,0 +1,17 @@
+BR2_powerpc64=y
+BR2_GENERATE_LOCALE="en_US.UTF-8"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
Quoted 8 lines

configs/powerpc64_petitboot_defconfig line 9

Quoted 6 lines
configs/powerpc64_petitboot_defconfig new file +6 -0
+BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
+BR2_PACKAGE_LINUX_FIRMWARE_CXGB4=y
+BR2_PACKAGE_NCURSES_WCHAR=y

Is this needed?

Yes, we need this to display boot labels that contain non-ASCII characters. Fedora uses "Schr?dinger?s cat", for example...

Quoted 9 lines

configs/powerpc64_petitboot_defconfig line 10

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_DROPBEAR=y

Is this useful?

configs/powerpc64_petitboot_defconfig line 12

Quoted 2 lines
configs/powerpc64_petitboot_defconfig new file +2 -0
+# BR2_PACKAGE_DROPBEAR_SERVER is not set
+BR2_PACKAGE_ETHTOOL=y

Is this useful?

Quoted 7 lines

configs/powerpc64_petitboot_defconfig line 13

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_NETCAT=y

Is this useful?

configs/powerpc64_petitboot_defconfig line 14

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_RSYNC=y

Is this useful?

We've found that these four utilities have been very useful in debugging boot issues; dropbear, netcat and rsync for remote access / file transfer, and ethtool for network-device firmware management.

However, if we want to keep the defconfig as minimal as possible (rather than the configuration that I've assumed users will generally need), we can remove these.

Regards,

Jeremy

#24 lore raw

PATCH v3 7/7 Add powerpc64 petitboot defconfig

Quoted 7 lines · Jeremy Kerr

Hi Arnout,

Quoted 2 lines

It would be nice if you could also create one for a qemu target, so people can
actually experiment with it.

This build should work fine for qemu, is there something else I should be doing here?

Because of the firmware lines, I thought that it was for some specific hardware.

It would be better to take qemu_ppc64_pseries_defconfig and add the
petitboot-specific things. I'd also name it qemu_ppc64_pseries_petitboot_defconfig to make this explicit. Or alternatively, petitboot_qemu_ppc64_pseries_defconfig.

Quoted 16 lines
Quoted 15 lines

configs/powerpc64_petitboot_defconfig line 9

Quoted 13 lines
configs/powerpc64_petitboot_defconfig new file +9 -0
@@ -0,0 +1,17 @@
+BR2_powerpc64=y
+BR2_GENERATE_LOCALE="en_US.UTF-8"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_BNX2X=y
+BR2_PACKAGE_LINUX_FIRMWARE_CXGB4=y
+BR2_PACKAGE_NCURSES_WCHAR=y

Is this needed?

Quoted 2 lines

Yes, we need this to display boot labels that contain non-ASCII characters. Fedora uses "Schr?dinger?s cat", for example...

Doesn't sound really essential, but probably OK.

Quoted 18 lines
Quoted 10 lines

configs/powerpc64_petitboot_defconfig line 10

Quoted 2 lines
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_DROPBEAR=y

Is this useful?

configs/powerpc64_petitboot_defconfig line 12

Quoted 2 lines
configs/powerpc64_petitboot_defconfig new file +2 -0
+# BR2_PACKAGE_DROPBEAR_SERVER is not set
+BR2_PACKAGE_ETHTOOL=y

Is this useful?

Quoted 7 lines

configs/powerpc64_petitboot_defconfig line 13

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_NETCAT=y

Is this useful?

configs/powerpc64_petitboot_defconfig line 14

Quoted 1 line
configs/powerpc64_petitboot_defconfig new file +1 -0
+BR2_PACKAGE_RSYNC=y

Is this useful?

Quoted 7 lines

We've found that these four utilities have been very useful in debugging boot issues; dropbear, netcat and rsync for remote access / file transfer, and ethtool for network-device firmware management.

However, if we want to keep the defconfig as minimal as possible (rather than the configuration that I've assumed users will generally need), we can remove these.

Yes, we try to have minimal defconfigs.

It would also be nice to create board/qemu/ppc64-pseries/readme-petitboot.txt
that explains how you can run this defconfig.

I guess petitboot takes some kind of configuration file that specifies what
you're going to boot into. It would be nice to have in the readme an example of how you can boot into another buildroot image (e.g. qemu_ppc64_pseries_defconfig).

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F