1 ################################################################################
5 ################################################################################
7 PETITBOOT_VERSION = 1.15
8 PETITBOOT_SOURCE = petitboot-v$(PETITBOOT_VERSION).tar.gz
9 PETITBOOT_SITE = https://github.com/open-power/petitboot/releases/download/v$(PETITBOOT_VERSION)
10 PETITBOOT_DEPENDENCIES = \
17 $(if $(BR2_PACKAGE_LIBXCRYPT),libxcrypt) \
18 $(TARGET_NLS_DEPENDENCIES)
19 PETITBOOT_LICENSE = GPL-2.0
20 PETITBOOT_LICENSE_FILES = COPYING
22 PETITBOOT_CONF_ENV = LDFLAGS="$(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)"
23 PETITBOOT_CONF_OPTS = \
25 --enable-platform-auto \
28 --without-signed-boot \
29 --without-twin-fbdev \
31 $(if $(BR2_PACKAGE_BUSYBOX),--enable-busybox,--disable-busybox) \
32 HOST_PROG_KEXEC=/usr/sbin/kexec \
33 HOST_PROG_SHUTDOWN=/usr/libexec/petitboot/bb-kexec-reboot
35 # HPA and Busybox tftp are supported. HPA tftp is part of Buildroot's tftpd
37 ifeq ($(BR2_PACKAGE_TFTPD),y)
38 PETITBOOT_CONF_OPTS += --with-tftp=hpa
39 else ifeq ($(BR2_PACKAGE_BUSYBOX),y)
40 PETITBOOT_CONF_OPTS += --with-tftp=busybox
42 # This actually means "autodetect", there's no way to really disable.
43 PETITBOOT_CONF_OPTS += --without-tftp
46 ifeq ($(BR2_PACKAGE_DTC),y)
47 PETITBOOT_DEPENDENCIES += dtc
48 PETITBOOT_CONF_OPTS += --with-fdt
49 define PETITBOOT_POST_INSTALL_DTB
50 $(INSTALL) -D -m 0755 $(@D)/utils/hooks/30-dtb-updates \
51 $(TARGET_DIR)/etc/petitboot/boot.d/30-dtb-updates
53 PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL_DTB
55 PETITBOOT_CONF_OPTS += --without-fdt
58 PETITBOOT_GETTY_PORT = $(patsubst %,'%',$(call qstrip,$(BR2_PACKAGE_PETITBOOT_GETTY_PORT)))
60 define PETITBOOT_POST_INSTALL
61 $(INSTALL) -D -m 0755 $(@D)/utils/bb-kexec-reboot \
62 $(TARGET_DIR)/usr/libexec/petitboot/bb-kexec-reboot
63 $(INSTALL) -D -m 0755 $(@D)/utils/hooks/01-create-default-dtb \
64 $(TARGET_DIR)/etc/petitboot/boot.d/01-create-default-dtb
65 $(INSTALL) -D -m 0755 $(@D)/utils/hooks/90-sort-dtb \
66 $(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
67 $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/S15pb-discover \
68 $(TARGET_DIR)/etc/init.d/S15pb-discover
69 $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/pb-console \
70 $(TARGET_DIR)/etc/init.d/pb-console
72 mkdir -p $(TARGET_DIR)/etc/udev/rules.d
73 for port in $(PETITBOOT_GETTY_PORT); do \
74 printf 'SUBSYSTEM=="tty", KERNEL=="%s", RUN+="/etc/init.d/pb-console start $$name"\n' "$$port"; \
75 done > $(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
77 mkdir -p $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
78 ln -sf /usr/sbin/pb-udhcpc \
79 $(TARGET_DIR)/usr/share/udhcpc/default.script.d/
82 PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL
84 $(eval $(autotools-package))