Skip to content

Commit

Permalink
Upstream parity 2
Browse files Browse the repository at this point in the history
  • Loading branch information
vincejv committed Jun 8, 2024
1 parent ceeb2d6 commit 24231ab
Show file tree
Hide file tree
Showing 496 changed files with 31,722 additions and 19,256 deletions.
3 changes: 3 additions & 0 deletions config/Config-build.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ menu "Global build settings"
bool "Enable TLS certificate verification during package download"
default y

config USE_APK
bool "Use APK instead of OPKG to build distribution (EXPERIMENTAL)"

comment "General build options"

config TESTING_KERNEL
Expand Down
17 changes: 5 additions & 12 deletions config/Config-kernel.in
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,6 @@ config KERNEL_KASAN
Currently CONFIG_KASAN doesn't work with CONFIG_DEBUG_SLAB
(the resulting kernel does not boot).

config KERNEL_KASAN_EXTRA
bool "KAsan: extra checks"
depends on KERNEL_KASAN && KERNEL_DEBUG_KERNEL
help
This enables further checks in the kernel address sanitizer, for now
it only includes the address-use-after-scope check that can lead
to excessive kernel stack usage, frame size warnings and longer
compile time.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more

config KERNEL_KASAN_VMALLOC
bool "Back mappings in vmalloc space with real shadow memory"
depends on KERNEL_KASAN
Expand Down Expand Up @@ -435,7 +425,6 @@ config KERNEL_DEBUG_INFO
This will compile your kernel and modules with debug information.

config KERNEL_DEBUG_INFO_BTF

bool "Enable additional BTF type information"
depends on !HOST_OS_MACOS
depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
Expand All @@ -447,9 +436,13 @@ config KERNEL_DEBUG_INFO_BTF

Required to run BPF CO-RE applications.

config KERNEL_DEBUG_INFO_BTF_MODULES
def_bool y
depends on KERNEL_DEBUG_INFO_BTF

config KERNEL_MODULE_ALLOW_BTF_MISMATCH
bool "Allow loading modules with non-matching BTF type info"
depends on KERNEL_DEBUG_INFO_BTF
depends on KERNEL_DEBUG_INFO_BTF_MODULES
help
For modules whose split BTF does not match vmlinux, load without
BTF rather than refusing to load. The default behavior with
Expand Down
20 changes: 19 additions & 1 deletion include/feeds.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ opkg_package_files = $(wildcard \
$(foreach dir,$(PACKAGE_SUBDIRS), \
$(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))

apk_package_files = $(wildcard \
$(foreach dir,$(PACKAGE_SUBDIRS), \
$(foreach pkg,$(1), $(dir)/$(pkg)_*.apk)))

# 1: package name
define FeedPackageDir
$(strip $(if $(CONFIG_PER_FEED_REPO), \
Expand All @@ -28,7 +32,7 @@ $(strip $(if $(CONFIG_PER_FEED_REPO), \
endef

# 1: destination file
define FeedSourcesAppend
define FeedSourcesAppendOPKG
( \
echo 'src/gz %d_core %U/targets/%S/packages'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
Expand All @@ -41,6 +45,20 @@ define FeedSourcesAppend
) >> $(1)
endef

# 1: destination file
define FeedSourcesAppendAPK
( \
echo '%U/targets/%S/packages/packages.adb'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
echo '%U/packages/%A/base/packages.adb'; \
$(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \
echo '%U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)/packages.adb';) \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \
echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )%U/packages/%A/$(feed)/packages.adb';)))) \
) >> $(1)
endef

# 1: package name
define GetABISuffix
$(if $(ABIV_$(1)),$(ABIV_$(1)),$(call FormatABISuffix,$(1),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v)))))
Expand Down
8 changes: 3 additions & 5 deletions include/host-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ include $(INCLUDE_DIR)/autotools.mk
_host_target:=$(if $(HOST_QUILT),,.)

Host/Patch:=$(Host/Patch/Default)
ifneq ($(strip $(HOST_UNPACK)),)
define Host/Prepare/Default
$(HOST_UNPACK)
define Host/Prepare/Default
$(if $(strip $(HOST_UNPACK)),$(HOST_UNPACK))
[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)
$(Host/Patch)
endef
endif
endef

define Host/Prepare
$(call Host/Prepare/Default)
Expand Down
39 changes: 33 additions & 6 deletions include/image-commands.mk
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,27 @@ define Build/buffalo-tag-dhp
mv $@.new $@
endef

define Build/buffalo-trx
$(eval magic=$(word 1,$(1)))
$(eval kern_bin=$(if $(1),$(IMAGE_KERNEL),$@))
$(eval rtfs_bin=$(word 2,$(1)))
$(eval apnd_bin=$(word 3,$(1)))
$(eval kern_size=$(if $(KERNEL_SIZE),$(KERNEL_SIZE),0x400000))

$(if $(rtfs_bin),touch $(rtfs_bin))
$(STAGING_DIR_HOST)/bin/otrx create $@.new \
$(if $(magic),-M $(magic),) \
-f $(kern_bin) \
$(if $(rtfs_bin),\
-a 0x20000 \
-b $$(( $(call exp_units,$(kern_size)) )) \
-f $(rtfs_bin),) \
$(if $(apnd_bin),\
-A $(apnd_bin) \
-a 0x20000)
mv $@.new $@
endef

define Build/check-size
@imagesize="$$(stat -c%s $@)"; \
limitsize="$$(($(call exp_units,$(if $(1),$(1),$(IMAGE_SIZE)))))"; \
Expand Down Expand Up @@ -430,12 +451,18 @@ define Build/jffs2
@mv $@.new $@
endef

define Build/kernel2minor
$(eval temp_file := $(shell mktemp))
cp $@ $(temp_file)
kernel2minor -k $(temp_file) -r $(temp_file).new $(1)
mv $(temp_file).new $@
rm -f $(temp_file)
define Build/yaffs-filesystem
let \
kernel_size="$$(stat -c%s $@)" \
kernel_chunks="(kernel_size / 1024) + 1" \
filesystem_chunks="kernel_chunks + 3" \
filesystem_blocks="(filesystem_chunks / 63) + 1" \
filesystem_size="filesystem_blocks * 64 * 1024" \
filesystem_size_with_reserve="(filesystem_blocks + 2) * 64 * 1024"; \
head -c $$filesystem_size_with_reserve /dev/zero | tr "\000" "\377" > $@.img \
&& yafut -d $@.img -w -i $@ -o kernel -C 1040 -B 64k -E -P -S $(1) \
&& truncate -s $$filesystem_size $@.img \
&& mv $@.img $@
endef

define Build/kernel-bin
Expand Down
22 changes: 20 additions & 2 deletions include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,12 @@ define Image/mkfs/ext4
endef

define Image/Manifest
$(call opkg,$(TARGET_DIR_ORIG)) list-installed > \
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest
$(if $(CONFIG_USE_APK), \
$(call apk,$(TARGET_DIR_ORIG)) list --quiet --manifest --no-network | sort | sed 's/ / - /' > \
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest, \
$(call opkg,$(TARGET_DIR_ORIG)) list-installed > \
$(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest \
)
ifneq ($(CONFIG_JSON_CYCLONEDX_SBOM),)
$(SCRIPT_DIR)/package-metadata.pl imgcyclonedxsbom \
$(if $(IB),$(TOPDIR)/.packageinfo, $(TMP_DIR)/.packageinfo) \
Expand Down Expand Up @@ -328,7 +332,20 @@ opkg_target = \
$(call opkg,$(mkfs_cur_target_dir)) \
-f $(mkfs_cur_target_dir).conf

apk_target = $(call apk,$(mkfs_cur_target_dir)) --no-scripts


target-dir-%: FORCE
ifneq ($(CONFIG_USE_APK),)
rm -rf $(mkfs_cur_target_dir)
$(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
mv $(mkfs_cur_target_dir)/etc/apk/repositories $(mkfs_cur_target_dir).repositories
$(if $(mkfs_packages_remove), \
$(apk_target) del $(mkfs_packages_remove))
$(if $(mkfs_packages_add), \
$(apk_target) add $(mkfs_packages_add))
mv $(mkfs_cur_target_dir).repositories $(mkfs_cur_target_dir)/etc/apk/repositories
else
rm -rf $(mkfs_cur_target_dir) $(mkfs_cur_target_dir).opkg
$(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
-mv $(mkfs_cur_target_dir)/etc/opkg $(mkfs_cur_target_dir).opkg
Expand All @@ -342,6 +359,7 @@ target-dir-%: FORCE
$(call opkg_package_files,$(mkfs_packages_add)))
-$(CP) -T $(mkfs_cur_target_dir).opkg/ $(mkfs_cur_target_dir)/etc/opkg/
rm -rf $(mkfs_cur_target_dir).opkg $(mkfs_cur_target_dir).conf
endif
$(call prepare_rootfs,$(mkfs_cur_target_dir),$(TOPDIR)/files)

$(KDIR)/root.%: kernel_prepare
Expand Down
Loading

0 comments on commit 24231ab

Please sign in to comment.