Skip to content

Commit

Permalink
Merge branch 'openwrt:main' into mx4300-foss
Browse files Browse the repository at this point in the history
  • Loading branch information
arix00 authored Nov 13, 2024
2 parents 3d852fb + f841870 commit bc4a6f6
Show file tree
Hide file tree
Showing 106 changed files with 981 additions and 376 deletions.
19 changes: 19 additions & 0 deletions config/Config-build.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ menu "Global build settings"
config USE_APK
imply PACKAGE_apk-mbedtls
bool "Use APK instead of OPKG to build distribution (EXPERIMENTAL)"
default y

comment "General build options"

Expand Down Expand Up @@ -295,12 +296,22 @@ menu "Global build settings"
Enable GCC Stack Smashing Protection (SSP) for userspace applications
config PKG_CC_STACKPROTECTOR_NONE
bool "None"
help
No stack smashing protection.
config PKG_CC_STACKPROTECTOR_REGULAR
bool "Regular"
help
Protects functions with vulnerable objects.
This includes functions with buffers larger than 8 bytes or calls to alloca.
config PKG_CC_STACKPROTECTOR_STRONG
bool "Strong"
help
Like Regular, but also protects functions with
local arrays or references to local frame addresses.
config PKG_CC_STACKPROTECTOR_ALL
bool "All"
help
Protects all functions.
endchoice

choice
Expand All @@ -310,10 +321,18 @@ menu "Global build settings"
Enable GCC Stack-Smashing Protection (SSP) for the kernel
config KERNEL_CC_STACKPROTECTOR_NONE
bool "None"
help
No stack smashing protection.
config KERNEL_CC_STACKPROTECTOR_REGULAR
bool "Regular"
help
Protects functions with vulnerable objects.
This includes functions with buffers larger than 8 bytes or calls to alloca.
config KERNEL_CC_STACKPROTECTOR_STRONG
bool "Strong"
help
Like Regular, but also protects functions with
local arrays or references to local frame addresses.
endchoice

config KERNEL_STACKPROTECTOR
Expand Down
2 changes: 1 addition & 1 deletion include/cmake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ define Build/Configure/Default
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_VERSION=1 \
-DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=$(if $(CONFIG_DEBUG),Debug,Release) \
-DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_C_COMPILER_LAUNCHER="$(CMAKE_C_COMPILER_LAUNCHER)" \
Expand Down
56 changes: 56 additions & 0 deletions include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ include $(INCLUDE_DIR)/rootfs.mk
override MAKE:=$(_SINGLE)$(SUBMAKE)
override NO_TRACE_MAKE:=$(_SINGLE)$(NO_TRACE_MAKE)

##@
# @brief Convert size with unit postfix to unitless expression in bytes.
#
# @param 1: Size with unit. Possible unit postfix are `g`, `m`, `k`.
##
exp_units = $(subst k, * 1024,$(subst m, * 1024k,$(subst g, * 1024m,$(1))))

target_params = $(subst +,$(space),$*)
Expand Down Expand Up @@ -111,19 +116,37 @@ endef

PROFILE_SANITIZED := $(call tolower,$(subst DEVICE_,,$(subst $(space),-,$(PROFILE))))

##@
# @brief Call function for each group of arguments.
#
# @param 1: List of lists of arguments. Lists are separated by `|`.
# @param 2: Function to call for list of arguments.
##
define split_args
$(foreach data, \
$(subst |,$(space),\
$(subst $(space),^,$(1))), \
$(call $(2),$(strip $(subst ^,$(space),$(data)))))
endef

##@
# @brief Call build function with arguments.
#
# @param 1: Function to call. Function name is prepended with `Build/`.
# @param 2...: Function arguments.
##
define build_cmd
$(if $(Build/$(word 1,$(1))),,$(error Missing Build/$(word 1,$(1))))
$(call Build/$(word 1,$(1)),$(wordlist 2,$(words $(1)),$(1)))

endef

##@
# @brief Call build functions from the list.
#
# @param 1: List of build functions with arguments, separated by `|`.
# First word in each group is a build command without `Build/` prefix.
##
define concat_cmd
$(call split_args,$(1),build_cmd)
endef
Expand Down Expand Up @@ -163,6 +186,12 @@ DTC_WARN_FLAGS := \
DTC_FLAGS += $(DTC_WARN_FLAGS)
DTCO_FLAGS += $(DTC_WARN_FLAGS)

##@
# @brief Pad file to specified size.
#
# @param 1: File.
# @param 2: Padding.
##
define Image/pad-to
dd if=$(1) of=$(1).new bs=$(2) conv=sync
mv $(1).new $(1)
Expand Down Expand Up @@ -403,26 +432,53 @@ define Device/InitProfile
DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE)
endef

##@
# @brief Image configuration variables.
#
# @param 1: Device name.
##
define Device/Init
##@ Device name.
DEVICE_NAME := $(1)
##@ Commands to build kernel.
# Commands with arguments are separated by `|`.
##
KERNEL:=
##@ Commands to build initramfs.
# Commands with arguments are separated by `|`.
##
KERNEL_INITRAMFS = $$(KERNEL)
##@ Kernel command line.
CMDLINE:=

##@ Images to build.
IMAGES :=
##@ Artifacts to build.
ARTIFACTS :=
##@ Device image prefix.
DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1)
##@ Device image name.
DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2)
##@ Factory image name.
FACTORY_IMG_NAME :=
##@ Maximum image size. Optional.
IMAGE_SIZE :=
##@ Maximum image size. Optional.
NAND_SIZE :=
##@ Kernel image prefix.
KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX)
##@ Kernel image suffix.
KERNEL_SUFFIX := -kernel.bin
##@ Initramfs image suffix.
KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX)
##@ Kernel image name.
KERNEL_IMAGE = $$(KERNEL_PREFIX)$$(KERNEL_SUFFIX)
##@ Initramfs image prefix.
KERNEL_INITRAMFS_PREFIX = $$(DEVICE_IMG_PREFIX)-initramfs
KERNEL_INITRAMFS_IMAGE = $$(KERNEL_INITRAMFS_PREFIX)$$(KERNEL_INITRAMFS_SUFFIX)
##@ Initramfs image name.
KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs
##@ Kernel install flag.
KERNEL_INSTALL :=
KERNEL_NAME := vmlinux
KERNEL_DEPENDS :=
Expand Down
4 changes: 2 additions & 2 deletions include/kernel-6.6
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LINUX_VERSION-6.6 = .59
LINUX_KERNEL_HASH-6.6.59 = 23616808d8c08f12815ff898f4edb4c11397a2b2843d029ee62452d21833a76d
LINUX_VERSION-6.6 = .60
LINUX_KERNEL_HASH-6.6.60 = 52f9e32d5082ab94253447fd66670d0c3bb765cfcb99b0bf61d1b8eae25952ef
2 changes: 1 addition & 1 deletion include/meson.mk
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ define Build/Configure/Meson
$(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt)
$(call Meson, \
setup \
--buildtype plain \
--buildtype $(if $(CONFIG_DEBUG),debug,plain) \
--native-file $(PKG_BUILD_DIR)/openwrt-native.txt \
--cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \
-Ddefault_library=both \
Expand Down
3 changes: 1 addition & 2 deletions include/rootfs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ apk = \
$(FAKEROOT) $(STAGING_DIR_HOST)/bin/apk \
--root $(1) \
--keys-dir $(if $(APK_KEYS),$(APK_KEYS),$(TOPDIR)) \
--no-cache \
--no-logfile \
--preserve-env

Expand Down Expand Up @@ -84,7 +83,7 @@ define prepare_rootfs
IPKG_POSTINST_PATH=./usr/lib/opkg/info/*.postinst; \
fi; \
for script in $$IPKG_POSTINST_PATH; do \
PATH="$(TARGET_PATH_PKG)" IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
ret=$$?; \
if [ $$ret -ne 0 ]; then \
echo "postinst script $$script has failed with exit code $$ret" >&2; \
Expand Down
74 changes: 31 additions & 43 deletions include/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ ifneq ($(__target_inc),1)
__target_inc=1


# default device type
##@
# @brief Default device type ( basic | nas | router ).
##
DEVICE_TYPE?=router

# Default packages - the really basic set
##@
# @brief Default packages.
#
# The really basic set. Additional packages are added based on @DEVICE_TYPE and
# @CONFIG_* values.
##
DEFAULT_PACKAGES:=\
base-files \
ca-bundle \
Expand All @@ -27,15 +34,21 @@ DEFAULT_PACKAGES:=\
urandom-seed \
urngd

# For the basic set
##@
# @brief Default packages for @DEVICE_TYPE basic.
##
DEFAULT_PACKAGES.basic:=
# For nas targets
##@
# @brief Default packages for @DEVICE_TYPE nas.
##
DEFAULT_PACKAGES.nas:=\
block-mount \
fdisk \
lsblk \
mdadm
# For router targets
##@
# @brief Default packages for @DEVICE_TYPE router.
##
DEFAULT_PACKAGES.router:=\
dnsmasq \
firewall4 \
Expand Down Expand Up @@ -77,51 +90,26 @@ else
endif
endif

ifneq ($(DUMP),)
# Parse generic config that might be set before a .config is generated to modify the
# default package configuration
# Keep DYNAMIC_DEF_PKG_CONF in sync with toplevel.mk to reflect the same configs
DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_SECCOMP
$(foreach config, $(DYNAMIC_DEF_PKG_CONF), \
$(eval $(config) := $(shell grep "$(config)=y" $(TOPDIR)/.config 2>/dev/null)) \
)
# The config options that are enabled by default and where other default
# packages depends on needs to be set if they are missing in the .config.
ifeq ($(shell grep "CONFIG_SECCOMP" $(TOPDIR)/.config 2>/dev/null),)
ifeq ($(filter $(BOARD), uml),)
ifneq ($(filter $(ARCH), aarch64 arm armeb mips mipsel mips64 mips64el i386 powerpc x86_64),)
CONFIG_SECCOMP := y
endif
endif
endif
endif

ifneq ($(CONFIG_USE_APK),)
DEFAULT_PACKAGES+=apk-mbedtls
else
DEFAULT_PACKAGES+=opkg
endif

ifneq ($(CONFIG_SELINUX),)
DEFAULT_PACKAGES+=busybox-selinux procd-selinux
else
DEFAULT_PACKAGES+=busybox procd
endif

# include ujail on systems with enough storage
ifeq ($(CONFIG_SMALL_FLASH),)
DEFAULT_PACKAGES+=procd-ujail
endif

# include seccomp ld-preload hooks if kernel supports it
ifneq ($(CONFIG_SECCOMP),)
DEFAULT_PACKAGES+=procd-seccomp
ifeq ($(filter small_flash,$(FEATURES)),)
DEFAULT_PACKAGES+=procd-ujail
endif

# Add device specific packages (here below to allow device type set from subtarget)
DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))

##@
# @brief Filter out packages, prepended with `-`.
#
# @param 1: Package list.
##
filter_packages = $(filter-out -% $(patsubst -%,%,$(filter -%,$(1))),$(1))

##@
# @brief Append extra package dependencies.
#
# @param 1: Package list.
##
extra_packages = $(if $(filter wpad wpad-% nas,$(1)),iwinfo)

define ProfileDefault
Expand Down
9 changes: 7 additions & 2 deletions package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ $(curdir)/install: $(TMP_DIR)/.build $(curdir)/merge $(curdir)/merge-index
ifneq ($(CONFIG_USE_APK),)
$(file >$(TMP_DIR)/apk_install_list,\
$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
$(call apk,$(TARGET_DIR)) add --initdb --no-scripts --arch $(ARCH_PACKAGES) \
$(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \
--repositories-file /dev/zero --repository file://$(PACKAGE_DIR_ALL)/packages.adb \
$$(cat $(TMP_DIR)/apk_install_list)
else
Expand Down Expand Up @@ -130,7 +130,12 @@ ifneq ($(CONFIG_USE_APK),)
--keys-dir $(TOPDIR) \
--sign $(BUILD_KEY_APK_SEC) \
--output packages.adb \
$$(ls *.apk | grep -v 'kernel\|libc'); \
$$(ls *.apk | grep -v 'base-files-\|kernel-\|libc-'); \
echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \
$(STAGING_DIR_HOST)/bin/apk adbdump packages.adb | \
awk '/- name: / {pkg = $$NF} ; / version: / {printf "\"%s\": \"%s\", ", pkg, $$NF}' | \
sed 's/, $$//' >> index.json; \
echo '}}' >> index.json; \
done
else
@for d in $(PACKAGE_SUBDIRS); do ( \
Expand Down
1 change: 1 addition & 0 deletions package/base-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ ifneq ($(CONFIG_USE_APK),)
$(VERSION_SED_SCRIPT) $(1)/etc/apk/repositories

rm -f $(1)/etc/uci-defaults/13_fix-group-user
rm -f $(1)/sbin/pkg_check
else
$(if $(CONFIG_CLEAN_IPKG),, \
mkdir -p $(1)/etc/opkg; \
Expand Down
1 change: 1 addition & 0 deletions package/boot/uboot-envtools/files/ath79
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ ruckus,zf7372)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x40000" "0x10000"
;;
sophos,ap15|\
sophos,ap15c|\
sophos,ap55|\
sophos,ap55c|\
sophos,ap100|\
Expand Down
4 changes: 2 additions & 2 deletions package/devel/gdb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=gdb
PKG_VERSION:=15.2
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/gdb
Expand Down Expand Up @@ -37,7 +37,7 @@ $(call Package/gdb/Default)
endef

define Package/gdb/description
GDB, the GNU Project debugger, allows you to see what is going on `inside'
GDB, the GNU Project debugger, allows you to see what is going on 'inside'
another program while it executes -- or what another program was doing at the
moment it crashed.
endef
Expand Down
2 changes: 1 addition & 1 deletion package/devel/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define Package/perf
DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +libpthread +librt +objdump @!IN_SDK @KERNEL_PERF_EVENTS \
+PACKAGE_libbfd:libbfd +PACKAGE_libopcodes:libopcodes +libtraceevent
TITLE:=Linux performance monitoring tool
VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE)
VERSION:=$(LINUX_VERSION)-r$(PKG_RELEASE)
URL:=http://www.kernel.org
endef

Expand Down
Loading

0 comments on commit bc4a6f6

Please sign in to comment.