image: fix CONFIG_CLEAN_IPKG with CONFIG_TARGET_PER_DEVICE_ROOTFS

Running prepare_rootfs on TARGET_DIR deletes the opkg state when
CONFIG_CLEAN_IPKG is enabled, making the per-device rootfs package install
fail.

To avoid this, create a copy of the TARGET_DIR before prepare_rootfs is run
and use this as basis for per-device rootfs generation.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
This commit is contained in:
Matthias Schiffer 2016-09-25 09:30:55 +02:00
parent ce89535bce
commit 663145e419
No known key found for this signature in database
GPG key ID: 16EF3F64CB201D9C
3 changed files with 7 additions and 2 deletions

View file

@ -297,7 +297,7 @@ opkg_target = \
target-dir-%: FORCE target-dir-%: FORCE
rm -rf $(mkfs_cur_target_dir) $(mkfs_cur_target_dir).opkg rm -rf $(mkfs_cur_target_dir) $(mkfs_cur_target_dir).opkg
$(CP) $(TARGET_DIR) $(mkfs_cur_target_dir) $(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
-mv $(mkfs_cur_target_dir)/etc/opkg $(mkfs_cur_target_dir).opkg -mv $(mkfs_cur_target_dir)/etc/opkg $(mkfs_cur_target_dir).opkg
echo 'src default file://$(PACKAGE_DIR_ALL)' > $(mkfs_cur_target_dir).conf echo 'src default file://$(PACKAGE_DIR_ALL)' > $(mkfs_cur_target_dir).conf
$(if $(call opkg_package_files,$(mkfs_packages_add)), \ $(if $(call opkg_package_files,$(mkfs_packages_add)), \

View file

@ -52,6 +52,8 @@ opkg_package_files = $(wildcard \
$(foreach dir,$(PACKAGE_SUBDIRS), \ $(foreach dir,$(PACKAGE_SUBDIRS), \
$(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk))) $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
TARGET_DIR_ORIG := $(TARGET_ROOTFS_DIR)/root.orig-$(BOARD)
define prepare_rootfs define prepare_rootfs
@if [ -d $(TOPDIR)/files ]; then \ @if [ -d $(TOPDIR)/files ]; then \
$(call file_copy,$(TOPDIR)/files/.,$(1)); \ $(call file_copy,$(TOPDIR)/files/.,$(1)); \

View file

@ -54,7 +54,7 @@ $(curdir)/merge-index: $(curdir)/merge
$(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index) $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir)/merge $(if $(CONFIG_TARGET_PER_DEVICE_ROOTFS),$(curdir)/merge-index)
- find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755 - find $(STAGING_DIR_ROOT) -type d | $(XARGS) chmod 0755
rm -rf $(TARGET_DIR) rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp [ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
$(call opkg,$(TARGET_DIR)) install \ $(call opkg,$(TARGET_DIR)) install \
$(call opkg_package_files,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null)) $(call opkg_package_files,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null))
@ -65,6 +65,9 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/system/opkg/host/install $(curdir
done; \ done; \
done || true done || true
@-$(MAKE) package/preconfig @-$(MAKE) package/preconfig
$(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG)
$(call prepare_rootfs,$(TARGET_DIR)) $(call prepare_rootfs,$(TARGET_DIR))
PASSOPT="" PASSOPT=""