|
@@ -30,7 +30,7 @@ PETITBOOT_CONF_OPTS = \
|
|
--without-twin-x11 \
|
|
--without-twin-x11 \
|
|
$(if $(BR2_PACKAGE_BUSYBOX),--enable-busybox,--disable-busybox) \
|
|
$(if $(BR2_PACKAGE_BUSYBOX),--enable-busybox,--disable-busybox) \
|
|
HOST_PROG_KEXEC=/usr/sbin/kexec \
|
|
HOST_PROG_KEXEC=/usr/sbin/kexec \
|
|
- HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot
|
|
|
|
|
|
+ HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/kexec-restart
|
|
|
|
|
|
# HPA and Busybox tftp are supported. HPA tftp is part of Buildroot's tftpd
|
|
# HPA and Busybox tftp are supported. HPA tftp is part of Buildroot's tftpd
|
|
# package.
|
|
# package.
|
|
@@ -55,11 +55,37 @@ else
|
|
PETITBOOT_CONF_OPTS += --without-fdt
|
|
PETITBOOT_CONF_OPTS += --without-fdt
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
+ifeq ($(BR2_INIT_BUSYBOX),y)
|
|
|
|
+# inittab "restart" runlevel entry runs kexec
|
|
|
|
+PETITBOOT_KEXEC_COMMAND = /bin/kill -QUIT 1
|
|
|
|
+define PETITBOOT_BUSYBOX_INITTAB
|
|
|
|
+ grep -q kexec $(TARGET_DIR)/etc/inittab || \
|
|
|
|
+ printf "\nnull::restart:/usr/sbin/kexec -f -e\n" >> $(TARGET_DIR)/etc/inittab
|
|
|
|
+endef
|
|
|
|
+PETITBOOT_TARGET_FINALIZE_HOOKS += PETITBOOT_BUSYBOX_INITTAB
|
|
|
|
+else ifeq ($(BR2_INIT_SYSV),y)
|
|
|
|
+# inittab runlevel 6 entry runs kexec
|
|
|
|
+PETITBOOT_KEXEC_COMMAND = /sbin/shutdown -r now
|
|
|
|
+define PETITBOOT_SYSV_INITTAB
|
|
|
|
+ grep -q kexec $(TARGET_DIR)/etc/inittab || \
|
|
|
|
+ $(SED) 's~^reb0:.*~reb0:6:wait:/usr/sbin/kexec -f -e~' $(TARGET_DIR)/etc/inittab
|
|
|
|
+endef
|
|
|
|
+PETITBOOT_TARGET_FINALIZE_HOOKS += PETITBOOT_SYSV_INITTAB
|
|
|
|
+else ifeq ($(BR2_INIT_OPENRC),y)
|
|
|
|
+PETITBOOT_KEXEC_COMMAND = /sbin/openrc-shutdown --kexec now
|
|
|
|
+else ifeq ($(BR2_INIT_SYSTEMD),y)
|
|
|
|
+PETITBOOT_KEXEC_COMMAND = /usr/bin/systemctl kexec
|
|
|
|
+else # BR2_INIT_NONE
|
|
|
|
+PETITBOOT_KEXEC_COMMAND = /usr/sbin/kexec -f -e
|
|
|
|
+endif
|
|
|
|
+
|
|
PETITBOOT_GETTY_PORT = $(patsubst %,'%',$(call qstrip,$(BR2_PACKAGE_PETITBOOT_GETTY_PORT)))
|
|
PETITBOOT_GETTY_PORT = $(patsubst %,'%',$(call qstrip,$(BR2_PACKAGE_PETITBOOT_GETTY_PORT)))
|
|
|
|
|
|
define PETITBOOT_POST_INSTALL
|
|
define PETITBOOT_POST_INSTALL
|
|
- $(INSTALL) -D -m 0755 $(@D)/utils/bb-kexec-reboot \
|
|
|
|
- $(TARGET_DIR)/usr/libexec/petitboot/bb-kexec-reboot
|
|
|
|
|
|
+ $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/kexec-restart.in \
|
|
|
|
+ $(TARGET_DIR)/usr/libexec/petitboot/kexec-restart
|
|
|
|
+ $(SED) 's~@KEXEC_COMMAND@~$(PETITBOOT_KEXEC_COMMAND)~' \
|
|
|
|
+ $(TARGET_DIR)/usr/libexec/petitboot/kexec-restart
|
|
$(INSTALL) -D -m 0755 $(@D)/utils/hooks/01-create-default-dtb \
|
|
$(INSTALL) -D -m 0755 $(@D)/utils/hooks/01-create-default-dtb \
|
|
$(TARGET_DIR)/etc/petitboot/boot.d/01-create-default-dtb
|
|
$(TARGET_DIR)/etc/petitboot/boot.d/01-create-default-dtb
|
|
$(INSTALL) -D -m 0755 $(@D)/utils/hooks/90-sort-dtb \
|
|
$(INSTALL) -D -m 0755 $(@D)/utils/hooks/90-sort-dtb \
|
|
@@ -77,6 +103,7 @@ define PETITBOOT_POST_INSTALL
|
|
mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
|
|
mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
|
|
ln -sf /usr/sbin/pb-udhcpc \
|
|
ln -sf /usr/sbin/pb-udhcpc \
|
|
$(TARGET_DIR)/usr/share/udhcpc/default.script.d/
|
|
$(TARGET_DIR)/usr/share/udhcpc/default.script.d/
|
|
|
|
+
|
|
endef
|
|
endef
|
|
|
|
|
|
PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL
|
|
PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL
|