From f8b977d9de3887975a1f4cb159f2f0bdcd87f229 Mon Sep 17 00:00:00 2001 From: geoff Date: Fri, 10 Jul 2009 01:12:10 +0000 Subject: [PATCH] petitboot: Update to petitboot to latest Update the petitboot package to the latest version in the petitboot git repo. Add new build config options to allow selection of which of the petitboot user interface program to run at system boot. git-svn-id: svn://svn.openwrt.org/openwrt/packages@16762 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- utils/petitboot/Makefile | 101 ++++++++++++++++++++++++-------- utils/petitboot/files/petitboot-wrapper | 16 ----- utils/petitboot/files/petitboot.init | 18 ++++-- utils/petitboot/petitboot-config.in | 65 ++++++++++++++++++++ 4 files changed, 155 insertions(+), 45 deletions(-) delete mode 100644 utils/petitboot/files/petitboot-wrapper create mode 100644 utils/petitboot/petitboot-config.in diff --git a/utils/petitboot/Makefile b/utils/petitboot/Makefile index 7bc76a82f..6f544dbc1 100644 --- a/utils/petitboot/Makefile +++ b/utils/petitboot/Makefile @@ -8,53 +8,104 @@ include $(TOPDIR)/rules.mk PKG_NAME:=petitboot -PKG_VERSION:=0.2 +PKG_VERSION:=53aa807ae41e48fd71653c2d00083a44a8bca14c PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://ozlabs.org/~jk/projects/petitboot/downloads/ -PKG_MD5SUM:=b320c434f38d57c1fcc6980e51d934a8 +PKG_SOURCE_URL:=git://ozlabs.org/home/jk/git/petitboot +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_VERSION) + +PKG_INSTALL=1 include $(INCLUDE_DIR)/package.mk define Package/petitboot - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=+libtwin +udev +udevextras +kexec-tools @TARGET_ps3 - TITLE:=Graphical bootloader - URL:=http://ozlabs.org/~jk/projects/petitboot/ + SECTION:=boot + CATEGORY:=Boot Loaders + TITLE:=A kexec based bootloader + URL:=http://ozlabs.org/~jk/projects/petitboot/ + MAINTAINER:=Geoff Levand + DEPENDS:=+kexec-tools +libncurses +libtwin +udev +ps3-utils endef -define Build/Configure +define Package/petitboot/description + Petitboot is a Linux kexec based bootloader with both + graphical and command-line user interfaces. The OpenWRT + Petitboot package has configuration options that can be + used to specify which Petitboot components to build, and + can also be used to specify that Petitboot should be run + automatically at system start-up. + + Petitboot supports loading Linux kernel and initrd images + from any device that can be mounted by Linux. It can + handle gzipped images and can also load images from the + network using TFTP, NFS, HTTP, HTTPS, and SFTP. Petitboot + looks for bootloader config files on mountable devices in + the system, and also uses the boot configuration sent to + it from a DHCP server. +endef +define Package/petitboot/config + source "$(SOURCE)/petitboot-config.in" endef -TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR) +petitboot-config-args-y$(CONFIG_PETITBOOT_CUI) += --without-ncurses +petitboot-config-args-y$(CONFIG_PETITBOOT_GUI) += --without-twin +petitboot-config-args-y$(CONFIG_PETITBOOT_PS3) += --enable-ps3=no + +petitboot-cppflags-$(CONFIG_PETITBOOT_DEBUG) += -DDEBUG +petitboot-cppflags-y$(CONFIG_PETITBOOT_DEBUG) += -DNDEBUG + +petitboot-extra-bin-$(CONFIG_PETITBOOT_CUI) += /usr/sbin/pb-cui +petitboot-extra-bin-$(CONFIG_PETITBOOT_GUI) += /usr/sbin/pb-twin +petitboot-extra-data-$(CONFIG_PETITBOOT_GUI) += /usr/share/petitboot/artwork/* + +# The platform inittab and/or initrun should check for /usr/sbin/petitboot +# and run it on startup if found. + +petitboot-install-autorun-$(CONFIG_PETITBOOT_AUTORUN_CUI) = \ + ln -sf pb-cui $(1)/usr/sbin/petitboot +petitboot-install-autorun-$(CONFIG_PETITBOOT_AUTORUN_GUI) = \ + ln -sf pb-twin $(1)/usr/sbin/petitboot -define Build/Compile - PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \ - PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \ - $(MAKE) -C $(PKG_BUILD_DIR) \ - DESTDIR="$(PKG_INSTALL_DIR)" \ - $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \ - all install +CONFIGURE_ARGS += $(petitboot-config-args-y) + +EXTRA_CPPFLAGS += $(petitboot-cppflags-y) + +define Build/Prepare + $(call Build/Prepare/Default) + (cd $(PKG_BUILD_DIR) && $(BASH) -x ./bootstrap) endef define Package/petitboot/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/petitboot $(1)/usr/sbin/ - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/petitboot-udev-helper \ + $(INSTALL_BIN) \ + $(addprefix $(PKG_INSTALL_DIR),$(petitboot-extra-bin-y)) \ + $(PKG_INSTALL_DIR)/usr/sbin/pb-discover \ + $(PKG_INSTALL_DIR)/usr/sbin/pb-event \ $(1)/usr/sbin/ - $(INSTALL_BIN) files/petitboot-wrapper $(1)/usr/sbin/petitboot-wrapper + $(INSTALL_DIR) $(1)/usr/share/petitboot/ - $(CP) $(PKG_INSTALL_DIR)/usr/share/petitboot/artwork \ + $(INSTALL_DATA) \ + $(addprefix $(PKG_INSTALL_DIR),$(petitboot-extra-data-y)) \ $(1)/usr/share/petitboot/ + $(INSTALL_DIR) $(1)/etc/udev/rules.d - $(CP) $(PKG_BUILD_DIR)/utils/99-petitboot.rules $(1)/etc/udev/rules.d/ - $(INSTALL_DIR) $(1)/etc/init.d/ - $(INSTALL_BIN) ./files/petitboot.init $(1)/etc/init.d/petitboot + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/utils/99-petitboot.rules \ + $(1)/etc/udev/rules.d/ + + $(INSTALL_DIR) $(1)/etc/ + $(INSTALL_DATA) -T $(PKG_BUILD_DIR)/utils/udhcpc $(1)/etc/udhcpc.user + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) \ + ./files/petitboot.init \ + $(1)/etc/init.d/petitboot + $(petitboot-install-autorun-y) endef $(eval $(call BuildPackage,petitboot)) diff --git a/utils/petitboot/files/petitboot-wrapper b/utils/petitboot/files/petitboot-wrapper deleted file mode 100644 index 607a35770..000000000 --- a/utils/petitboot/files/petitboot-wrapper +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# wrapper script for petitboot - re-exec as required. -mkdir -p /var/tmp/mnt - -while : -do - /usr/sbin/petitboot -u >/var/log/petitboot.log 2>&1 - - # cleanup - for dir in /var/tmp/mnt/* - do - umount "$dir" - rmdir "$dir" - done -done diff --git a/utils/petitboot/files/petitboot.init b/utils/petitboot/files/petitboot.init index e02041c10..336d47a21 100644 --- a/utils/petitboot/files/petitboot.init +++ b/utils/petitboot/files/petitboot.init @@ -1,12 +1,22 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2006 OpenWrt.org -START=80 + +START=90 + +kill_discover() { + killall -q -KILL pb-discover + umount -f -d /var/petitboot/mnt/* 2>/dev/null +} start() { - /usr/sbin/petitboot-wrapper & + kill_discover + /usr/sbin/pb-discover 2>&- >&- & } stop() { - killall petitboot-wrapper - killall petitboot + # first signal pb-discover to exit + killall -q -INT pb-discover + sleep 3 + # now force it + kill_discover } diff --git a/utils/petitboot/petitboot-config.in b/utils/petitboot/petitboot-config.in new file mode 100644 index 000000000..c5213c231 --- /dev/null +++ b/utils/petitboot/petitboot-config.in @@ -0,0 +1,65 @@ +# petitboot package config + +config PETITBOOT_GUI + bool "Enable Graphical UI support" + depends on PACKAGE_petitboot + select PACKAGE_libtwin + default y + help + Enable support a petitboot graphical front end based on + the twin windowing package. + +config PETITBOOT_CUI + bool "Enable Command-line UI support" + depends on PACKAGE_petitboot + select PACKAGE_libncurses + default y + help + Enable support a petitboot command-line front end based on + the ncurses package. + +config PETITBOOT_DEBUG + bool "Build debug versions of petitboot binaries" + depends on PACKAGE_petitboot + default n + help + Enable additional petitboot runtime checks and debug messages. + +config PETITBOOT_PS3 + bool "Build in extra support for the PS3 game console" + depends on PACKAGE_petitboot + default n + help + Enable additional petitboot runtime checks and debug messages. + +choice + prompt "Startup behavior" + default PETITBOOT_AUTORUN_GUI + depends on PETITBOOT_GUI || PETITBOOT_CUI + +config PETITBOOT_AUTORUN_GUI + bool "Auto run Petitboot GUI" + depends on PETITBOOT_GUI + help + Automatically run Petitboot in graphical mode at + system startup. Note that the Petitboot program has a menu item + 'Exit to Shell' that can be used to exit the program when + it is running. + +config PETITBOOT_AUTORUN_CUI + bool "Auto run Petitboot CUI" + depends on PETITBOOT_CUI + help + Automatically run Petitboot in command-line mode at system + startup. Note that the Petitboot program has a menu item + 'Exit to Shell' that can be used to exit the program when + it is running. + +config PETITBOOT_AUTORUN_NONE + bool "Disable Petitboot auto run" + help + Disable Petitboot from running automatically at system startup. + The system will boot into a shell. Petitboot can still be run + manually from the shell prompt when this option is selected. + +endchoice -- 2.11.0