[OpenWrt-Devel] [PATCH 1/2] package/signing-key base-files: Move the package list signing key to separate package

openwrt at daniel.thecshore.com openwrt at daniel.thecshore.com
Tue Feb 16 02:34:05 EST 2016


From: Daniel Dickinson <openwrt at daniel.thecshore.com>

Abstract out the signing-key from base-files (to make duplicating
for use for building different key for SDK easier; the SDK needs to
build a signing-key by default when base-files has a signing key
due to the fact opkg will not accept unsigned package lists when
configured to use signed packages)

Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
---
 package/base-files/Makefile  | 20 ++------------
 package/signing-key/Makefile | 66 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+), 17 deletions(-)
 create mode 100644 package/signing-key/Makefile

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 8c75b91..da9525c 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -17,7 +17,7 @@ PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=usign/host
 PKG_LICENSE:=GPL-2.0
 
-PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH
+PKG_CONFIG_DEPENDS := CONFIG_TARGET_INIT_PATH
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -32,7 +32,7 @@ endif
 define Package/base-files
   SECTION:=base
   CATEGORY:=Base system
-  DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +fstools
+  DEPENDS:=+netifd +libc +procd +jsonfilter +fstools +SIGNED_PACKAGES:signing-key
   TITLE:=Base filesystem for OpenWrt
   URL:=http://openwrt.org/
   VERSION:=$(PKG_RELEASE)-$(REVISION)
@@ -91,25 +91,11 @@ endef
 define Build/Compile/Default
 
 endef
-Build/Compile = $(Build/Compile/Default)
-
-ifdef CONFIG_SIGNED_PACKAGES
-  define Build/Configure
-	[ -s $(BUILD_KEY) -a -s $(BUILD_KEY).pub ] || \
-		$(STAGING_DIR_HOST)/bin/usign -G -s $(BUILD_KEY) -p $(BUILD_KEY).pub -c "Local build key"
-
-  endef
 
-  define Package/base-files/install-key
-	mkdir -p $(1)/etc/opkg/keys
-	$(CP) $(BUILD_KEY).pub $(1)/etc/opkg/keys/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub`
-
-  endef
-endif
+Build/Compile = $(Build/Compile/Default)
 
 define Package/base-files/install
 	$(CP) ./files/* $(1)/
-	$(Package/base-files/install-key)
 	if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
 		$(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
 	fi
diff --git a/package/signing-key/Makefile b/package/signing-key/Makefile
new file mode 100644
index 0000000..3108e36
--- /dev/null
+++ b/package/signing-key/Makefile
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2007-2015 OpenWrt.org
+# Copyright (C) 2010 Vertical Communications
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=signing-key
+PKG_VERSION:=1.0
+PKG_RELEASE:=1
+
+PKG_BUILD_DEPENDS:=usign/host
+PKG_LICENSE:=GPL-2.0
+
+PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/signing-key
+  SECTION:=base
+  CATEGORY:=Base system
+  DEPENDS:=+usign
+  TITLE:=Signing key when using signed package lists (base build key)
+  URL:=http://openwrt.org/
+  DEFAULT:=y if SIGNED_PACKAGES
+endef
+
+define Package/signing-key/description
+  This package contains the opkg signing key for the base build when using signed package lists
+endef
+
+define Build/Prepare
+	true
+endef
+
+NOT_SDK_KEY=$(if $(SDK),,1)
+
+ifeq ($(NOT_SDK_KEY),1)
+define Build/Configure
+	[ -s $(BUILD_KEY) -a -s $(BUILD_KEY).pub ] || \
+		$(STAGING_DIR_HOST)/bin/usign -G -s $(BUILD_KEY) -p $(BUILD_KEY).pub -c "Local build key"
+endef
+
+else
+
+define Build/Configure
+	true
+endef
+endif
+
+define Build/Compile
+	echo "Placeholder for log file"
+endef
+
+ifeq ($(NOT_SDK_OR_IS_SDK_KEY),1)
+define Package/signing-key/install
+	$(INSTALL_DIR) $(1)/etc/opkg/keys
+	$(CP) $(BUILD_KEY).pub $(1)/etc/opkg/keys/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub`
+endef
+endif
+
+$(eval $(call BuildPackage,signing-key))
-- 
2.4.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list