123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- --- a/include/image.mk
- +++ b/include/image.mk
- @@ -504,7 +504,6 @@ define Device/Check
- endif
- endef
-
- -ifndef IB
- define Device/Build/initramfs
- $(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1))
- $$(_TARGET): $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) \
- @@ -557,7 +556,6 @@ define Device/Build/initramfs
- SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \
- $(TOPDIR)/scripts/json_add_image_info.py $$@
- endef
- -endif
-
- define Device/Build/compile
- $$(_COMPILE_TARGET): $(KDIR)/$(1)
- @@ -623,7 +621,7 @@ define Device/Build/kernel
- endef
-
- define Device/Build/image
- - GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
- + GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(findstring img,$(2)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz))
- $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
- $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
- $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
- @@ -761,6 +761,7 @@ define Device/DumpInfo
- Target-Profile: DEVICE_$(1)
- Target-Profile-Name: $(DEVICE_DISPLAY)
- Target-Profile-Packages: $(DEVICE_PACKAGES)
- +Target-Profile-ImageSize: $(IMAGE_SIZE)
- Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image)))),1,0)
- Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES)
- $(if $(BROKEN),Target-Profile-Broken: $(BROKEN))
- --- a/scripts/target-metadata.pl
- +++ b/scripts/target-metadata.pl
- @@ -437,6 +437,7 @@ ()
- print "PROFILE_NAMES = ".join(" ", @profile_ids_unique)."\n";
- foreach my $profile (@{$cur->{profiles}}) {
- print $profile->{id}.'_NAME:='.$profile->{name}."\n";
- + print $profile->{id}.'_IMAGE_SIZE:='.$profile->{image_size}."\n";
- print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n";
- if (defined($profile->{supported_devices}) and @{$profile->{supported_devices}} > 0) {
- print $profile->{id}.'_SUPPORTED_DEVICES:='.join(' ', @{$profile->{supported_devices}})."\n";
- --- a/scripts/metadata.pm
- +++ b/scripts/metadata.pm
- @@ -150,6 +150,7 @@ sub parse_target_metadata($) {
- push @{$target->{profiles}}, $profile;
- };
- /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1;
- + /^Target-Profile-ImageSize:\s*(.*)\s*/ and $profile->{image_size} = $1;
- /^Target-Profile-hasImageMetadata:\s*(\d+)\s*$/ and $profile->{has_image_metadata} = $1;
- /^Target-Profile-SupportedDevices:\s*(.+)\s*$/ and $profile->{supported_devices} = [ split(/\s+/, $1) ];
- /^Target-Profile-Priority:\s*(\d+)\s*$/ and do {
- --- a/target/imagebuilder/Makefile
- +++ b/target/imagebuilder/Makefile
- @@ -39,7 +39,8 @@ $(BIN_DIR)/$(IB_NAME).tar.zst: clean
- ./files/Makefile \
- $(TMP_DIR)/.targetinfo \
- $(TMP_DIR)/.packageinfo \
- - $(PKG_BUILD_DIR)/
- + $(TOPDIR)/files \
- + $(PKG_BUILD_DIR)/ || true
-
- $(INSTALL_DIR) $(PKG_BUILD_DIR)/packages
-
- @@ -52,12 +53,13 @@ ifneq ($(CONFIG_USE_APK),)
-
- $(INSTALL_DATA) ./files/README.apk.md $(PKG_BUILD_DIR)/packages/README.md
- else
- - ifeq ($(CONFIG_IB_STANDALONE),)
- echo '## Remote package repositories' >> $(PKG_BUILD_DIR)/repositories.conf
- $(call FeedSourcesAppendOPKG,$(PKG_BUILD_DIR)/repositories.conf)
- $(VERSION_SED_SCRIPT) $(PKG_BUILD_DIR)/repositories.conf
-
- - endif
- + $(SED) 's/^src\/gz \(.*\) https.*ai\/\(.*packages.*\)/src \1 file:\/\/www\/wwwroot\/dl.openwrt.ai\/\2/' $(PKG_BUILD_DIR)/repositories.conf
- + $(SED) 's/^src\/gz \(.*\) https.*ai\/\(.*targets.*\)/src \1 file:\/\/www\/wwwroot\/dl.openwrt.ai\/\2/' $(PKG_BUILD_DIR)/repositories.conf
- + $(SED) '/openwrt_core/d' $(PKG_BUILD_DIR)/repositories.conf
-
- # create an empty package index so `opkg` doesn't report an error
- touch $(PKG_BUILD_DIR)/packages/Packages
- --- a/target/imagebuilder/files/Makefile
- +++ b/target/imagebuilder/files/Makefile
- @@ -142,6 +142,26 @@ BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel)
- # "-pkgname" in the package list means remove "pkgname" from the package list
- BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
- BUILD_PACKAGES:=$(USER_PACKAGES) $(BUILD_PACKAGES)
- +IMAGE_SIZE_VALUE := $(shell echo $($(USER_PROFILE)_IMAGE_SIZE) | sed 's/k$$//')
- +ifdef IMAGE_SIZE_VALUE
- + ifeq ($(shell test $(IMAGE_SIZE_VALUE) -lt 20480 && echo true),true)
- + SMALL_FLASH := true
- + endif
- +endif
- +ifneq ($(findstring usb,$(BUILD_PACKAGES)),)
- + BUILD_PACKAGES += automount luci-app-diskman
- +endif
- +ifeq ($(SMALL_FLASH),true)
- + BUILD_PACKAGES += -coremark -htop -bash -openssh-sftp-server -luci-app-diskman
- + ifeq ($(shell grep -q small_flash $(TOPDIR)/repositories.conf || echo "not_found"),not_found)
- + $(shell echo "`grep kwrt_kiddin9 $(TOPDIR)/repositories.conf | sed -e 's/kiddin9/small_flash/g'`" >>$(TOPDIR)/repositories.conf)
- + endif
- +else
- + $(shell sed -i "/small_flash/d" $(TOPDIR)/repositories.conf)
- +endif
- +define add_zh_cn_packages
- +$(eval BUILD_PACKAGES += $(foreach pkg,$(BUILD_PACKAGES),$(if $(and $(filter luci-app-%,$(pkg)),$(shell $(OPKG) list | grep -q "^luci-i18n-$(patsubst luci-app-%,%,$(pkg))-zh-cn" && echo 1)),luci-i18n-$(patsubst luci-app-%,%,$(pkg))-zh-cn)))
- +endef
- BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
- PACKAGES:=
-
- @@ -157,6 +177,8 @@ _call_image: staging_dir/host/.prereq-build
- $(MAKE) -s build_image
- $(MAKE) -s json_overview_image_info
- $(MAKE) -s checksum
- + rm -rf $(KERNEL_BUILD_DIR)/tmp
- + rm -rf $(KERNEL_BUILD_DIR)/root.*
-
- _call_manifest: FORCE
- rm -rf $(TARGET_DIR)
- @@ -224,9 +246,17 @@ package_install: FORCE
- @echo
- @echo Installing packages...
- ifeq ($(CONFIG_USE_APK),)
- + $(eval $(call add_zh_cn_packages))
- $(OPKG) install $(firstword $(wildcard $(LINUX_DIR)/libc_*.ipk $(PACKAGE_DIR)/libc_*.ipk))
- $(OPKG) install $(firstword $(wildcard $(LINUX_DIR)/kernel_*.ipk $(PACKAGE_DIR)/kernel_*.ipk))
- - $(OPKG) install $(BUILD_PACKAGES)
- + $(OPKG) install --force-maintainer $(BUILD_PACKAGES) luci-i18n-base-zh-cn || true
- + $(if $(USER_FILES), \
- + find $(USER_FILES) -name "*.ipk" -print0 | \
- + while IFS= read -r -d '' ipk; do \
- + $(OPKG) install "$$ipk" && rm -f "$$ipk" || true; \
- + done; \
- + )
- + $(OPKG) install --force-maintainer --force-reinstall my-default-settings
- else
- $(APK) add --no-scripts $(firstword $(wildcard $(LINUX_DIR)/libc-*.apk $(PACKAGE_DIR)/libc-*.apk))
- $(APK) add --no-scripts $(firstword $(wildcard $(LINUX_DIR)/kernel-*.apk $(PACKAGE_DIR)/kernel-*.apk))
- @@ -237,7 +267,7 @@ prepare_rootfs: FORCE
- @echo
- @echo Finalizing root filesystem...
-
- - $(CP) $(TARGET_DIR) $(TARGET_DIR_ORIG)
- + mkdir -p "$(TARGET_DIR_ORIG)" && (tar -C "$(TARGET_DIR)" -cf - .) | pv -trab --buffer-size 100M | (tar -C "$(TARGET_DIR_ORIG)" -xf - .)
- ifeq ($(CONFIG_USE_APK),)
- $(if $(CONFIG_SIGNATURE_CHECK), \
- $(if $(ADD_LOCAL_KEY), \
- @@ -254,16 +284,19 @@ else
- )
- endif
- $(call prepare_rootfs,$(TARGET_DIR),$(USER_FILES),$(DISABLED_SERVICES))
- + $(if $(SMALL_FLASH), \
- + $(shell echo "`grep kwrt_kiddin9 $(TOPDIR)/repositories.conf | sed -e 's/kiddin9/small_flash/g'`" >>$(BUILD_DIR)/root-*/etc/opkg/distfeeds.conf) \
- + )
-
- build_image: FORCE
- @echo
- @echo Building images...
- rm -rf $(BUILD_DIR)/json_info_files/
- if [ -d "target/linux/feeds/$(BOARD)" ]; then \
- - $(NO_TRACE_MAKE) -C target/linux/feeds/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
- + nice $(NO_TRACE_MAKE) -C target/linux/feeds/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
- $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)"); \
- else \
- - $(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
- + nice $(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
- $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)"); \
- fi
-
|