[packages] flashrom: update source url, use PKG_INSTALL & MAKE_FLAGS, refresh patches
[openwrt/svn-archive/archive.git] / utils / petitboot / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=petitboot
11 PKG_REV:=93b2c2e0f0ca46d2a823b33cdfa44d082e9e8d10
12 PKG_VERSION:=20090709
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=git://ozlabs.org/home/jk/git/petitboot
17 PKG_SOURCE_PROTO:=git
18 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
19 PKG_SOURCE_VERSION:=$(PKG_REV)
20
21 PKG_INSTALL=1
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/petitboot
26 SECTION:=boot
27 CATEGORY:=Boot Loaders
28 TITLE:=A kexec based bootloader
29 URL:=http://ozlabs.org/~jk/projects/petitboot/
30 MAINTAINER:=Geoff Levand <geoffrey.levand@am.sony.com>
31 DEPENDS:=@TARGET_ps3 +kexec-tools +libncurses +libtwin +udev +ps3-utils
32 endef
33
34 define Package/petitboot/description
35 Petitboot is a Linux kexec based bootloader with both
36 graphical and command-line user interfaces. The OpenWRT
37 Petitboot package has configuration options that can be
38 used to specify which Petitboot components to build, and
39 can also be used to specify that Petitboot should be run
40 automatically at system start-up.
41
42 Petitboot supports loading Linux kernel and initrd images
43 from any device that can be mounted by Linux. It can
44 handle gzipped images and can also load images from the
45 network using TFTP, NFS, HTTP, HTTPS, and SFTP. Petitboot
46 looks for bootloader config files on mountable devices in
47 the system, and also uses the boot configuration sent to
48 it from a DHCP server.
49 endef
50
51 define Package/petitboot/config
52 source "$(SOURCE)/petitboot-config.in"
53 endef
54
55 petitboot-config-args-y$(CONFIG_PETITBOOT_CUI) += --without-ncurses
56 petitboot-config-args-y$(CONFIG_PETITBOOT_GUI) += --without-twin
57 petitboot-config-args-y$(CONFIG_PETITBOOT_PS3) += --enable-ps3=no
58
59 petitboot-cppflags-$(CONFIG_PETITBOOT_DEBUG) += -DDEBUG
60 petitboot-cppflags-y$(CONFIG_PETITBOOT_DEBUG) += -DNDEBUG
61
62 petitboot-extra-bin-$(CONFIG_PETITBOOT_CUI) += /usr/sbin/pb-cui
63 petitboot-extra-bin-$(CONFIG_PETITBOOT_GUI) += /usr/sbin/pb-twin
64 petitboot-extra-data-$(CONFIG_PETITBOOT_GUI) += /usr/share/petitboot/artwork/*
65
66 # The platform inittab and/or initrun should check for /usr/sbin/petitboot
67 # and run it on startup if found.
68
69 petitboot-install-autorun-$(CONFIG_PETITBOOT_AUTORUN_CUI) = \
70 ln -sf pb-cui $(1)/usr/sbin/petitboot
71 petitboot-install-autorun-$(CONFIG_PETITBOOT_AUTORUN_GUI) = \
72 ln -sf pb-twin $(1)/usr/sbin/petitboot
73
74 CONFIGURE_ARGS += $(petitboot-config-args-y) \
75 PACKAGE_VERSION=$(shell echo ${HOSTNAME})-$(shell date +%y.%m.%d-%H.%M)
76
77 EXTRA_CPPFLAGS += $(petitboot-cppflags-y)
78
79 define Build/Prepare
80 $(call Build/Prepare/Default)
81 (cd $(PKG_BUILD_DIR) && $(BASH) -x ./bootstrap)
82 endef
83
84 define Package/petitboot/install
85 $(INSTALL_DIR) $(1)/usr/sbin
86 $(INSTALL_BIN) \
87 $(addprefix $(PKG_INSTALL_DIR),$(petitboot-extra-bin-y)) \
88 $(PKG_INSTALL_DIR)/usr/sbin/pb-discover \
89 $(PKG_INSTALL_DIR)/usr/sbin/pb-event \
90 $(1)/usr/sbin/
91
92 $(INSTALL_DIR) $(1)/usr/share/petitboot/
93 $(INSTALL_DATA) \
94 $(addprefix $(PKG_INSTALL_DIR),$(petitboot-extra-data-y)) \
95 $(1)/usr/share/petitboot/
96
97 $(INSTALL_DIR) $(1)/etc/udev/rules.d
98 $(INSTALL_DATA) \
99 $(PKG_BUILD_DIR)/utils/99-petitboot.rules \
100 $(1)/etc/udev/rules.d/
101
102 $(INSTALL_DIR) $(1)/etc/
103 $(INSTALL_DATA) -T $(PKG_BUILD_DIR)/utils/udhcpc $(1)/etc/udhcpc.user
104
105 $(INSTALL_DIR) $(1)/etc/init.d
106 $(INSTALL_BIN) \
107 ./files/petitboot.init \
108 $(1)/etc/init.d/petitboot
109
110 $(petitboot-install-autorun-y)
111 endef
112
113 $(eval $(call BuildPackage,petitboot))