Hi

this patch fixes 3 things in the imagebuilder, one of them is literally big:

When running package_install the imagebuilder generates package list(s),
which are stored in $(TARGET_DIR)/usr/lib/opkg/lists/ and then copied
into the final image, which wastes around 200kB in the resulting image
(or 2x200kB if also external repos are used). The simple fix is to
delete these list(s) after packages were installed and before stuff is
copied to the final image.

The two other things this patch improves:
* generate a new package list only when something in the packages folder
has changed
* When we have selected a profile then only build images that are needed
for the devices we want it for.

These both save time and resources and i use them for a long time now
without any problems.

This patch should apply to both trunk and backfire.

regards, soma

Index: target/imagebuilder/files/Makefile
===================================================================
--- target/imagebuilder/files/Makefile	(Revision 28203)
+++ target/imagebuilder/files/Makefile	(Arbeitskopie)
@@ -100,7 +100,13 @@
 	echo
 	rm -rf $(TARGET_DIR)
 	mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR)
-	$(MAKE) package_index
+	if [ ! -f "$(PACKAGE_DIR)/Packages" ] || [ ! -f "$(PACKAGE_DIR)/Packages.gz" ] || [ "`find $(PACKAGE_DIR) -cnewer $(PACKAGE_DIR)/Packages.gz`" ]; then \
+		echo "Package list missing or not up-to-date, generating it.";\
+		$(MAKE) package_index; \
+	else \
+		mkdir -p $(TARGET_DIR)/tmp; \
+		$(OPKG) update; \
+	fi
 	$(MAKE) package_install
 ifneq ($(USER_FILES),)
 	$(MAKE) copy_files
@@ -121,6 +127,7 @@
 	@echo
 	@echo Installing packages...
 	$(OPKG) install $(BUILD_PACKAGES)
+	rm -rf $(TARGET_DIR)/usr/lib/opkg/lists/*
 
 copy_files: FORCE
 	@echo
@@ -145,7 +152,7 @@
 build_image: FORCE
 	@echo
 	@echo Building images...
-	$(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1
+	$(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 PROFILE=$(USER_PROFILE) IB=1
 	
 clean:
 	rm -rf $(TOPDIR)/tmp $(TOPDIR)/dl $(TARGET_DIR) $(BIN_DIR)

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to