diff --git a/config/Config-build.in b/config/Config-build.in index dd314279590409..342859b7c0cdba 100644 --- a/config/Config-build.in +++ b/config/Config-build.in @@ -3,6 +3,20 @@ # Copyright (C) 2006-2013 OpenWrt.org # Copyright (C) 2016 LEDE Project +config EXPERIMENTAL + bool "Enable experimental features by default" + default n + help + Set this option to build with latest bleeding edge features + which may or may not work as expected. + If you would like to help the development of OpenWrt, you are + encouraged to set this option and provide feedback (both + positive and negative). But do so only if you know how to + recover your device in case of flashing potentially non-working + firmware. + + If you plan to use this build in production, say NO! + menu "Global build settings" config JSON_OVERVIEW_IMAGE_INFO @@ -49,17 +63,18 @@ menu "Global build settings" config TESTING_KERNEL bool "Use the testing kernel version" depends on HAS_TESTING_KERNEL - default n + default EXPERIMENTAL help If the target supports a newer kernel version than the default, you can use this config option to enable it + config DISPLAY_SUPPORT bool "Show packages that require graphics support (local or remote)" default n config BUILD_PATENTED - default y + default n bool "Compile with support for patented functionality" help When this option is disabled, software which provides patented functionality @@ -86,11 +101,19 @@ menu "Global build settings" This removes all ipkg/opkg status data files from the target directory before building the root filesystem. + config IPK_FILES_CHECKSUMS + bool + prompt "Record files checksums in package metadata" + default n + help + This makes file checksums part of package metadata. It increases size + but provides you with pkg_check command to check for flash coruptions. + config INCLUDE_CONFIG bool "Include build configuration in firmware" if DEVEL default n help - If enabled, config.seed will be stored in /etc/build.config of firmware. + If enabled, buildinfo files will be stored in /etc/build.* of firmware. config REPRODUCIBLE_DEBUG_INFO bool "Make debug information reproducible" diff --git a/config/Config-devel.in b/config/Config-devel.in index 57031d42f634b8..126462bfc3a0a1 100644 --- a/config/Config-devel.in +++ b/config/Config-devel.in @@ -7,7 +7,7 @@ menuconfig DEVEL default n config BROKEN - bool "Show broken platforms / packages" if DEVEL + bool "Show broken platforms / packages / devices" if DEVEL default n config BINARY_FOLDER @@ -63,7 +63,7 @@ menuconfig DEVEL config CCACHE bool "Use ccache" if DEVEL - default y + default n help Compiler cache; see https://ccache.samba.org/ @@ -115,6 +115,13 @@ menuconfig DEVEL help If enabled, log files will be written to the ./log directory. + config BUILD_LOG_DIR + string "Log folder" if DEVEL + default "" + help + Store build logs in this directory. + If not set, uses './logs' + config SRC_TREE_OVERRIDE bool "Enable package source tree override" if DEVEL help diff --git a/config/Config-images.in b/config/Config-images.in index eb0aa2c84c0762..26917267cf95c9 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -14,7 +14,6 @@ menu "Target Images" prompt "Compression" default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_apm821xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ath79_mikrotik - default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ipq40xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips @@ -94,7 +93,6 @@ menu "Target Images" menuconfig TARGET_ROOTFS_EXT4FS bool "ext4" default y if USES_EXT4 - default n if TARGET_x86 help Build an ext4 root filesystem. @@ -136,13 +134,6 @@ menu "Target Images" help Create an ext4 filesystem with a journal. - config TARGET_ROOTFS_ISO - bool "iso" - default n - depends on TARGET_x86_generic - help - Create a bootable ISO image. - config TARGET_ROOTFS_JFFS2 bool "jffs2" depends on USES_JFFS2 @@ -207,32 +198,32 @@ menu "Target Images" config GRUB_IMAGES bool "Build GRUB images (Linux x86 or x86_64 host only)" depends on TARGET_x86 - depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS + depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS select PACKAGE_grub2 default y - config EFI_IMAGES - bool "Build EFI GRUB images (Linux x86 or x86_64 host only)" + config GRUB_EFI_IMAGES + bool "Build GRUB EFI images (Linux x86 or x86_64 host only)" depends on TARGET_x86 - depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS + depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS select PACKAGE_grub2 select PACKAGE_grub2-efi + select PACKAGE_kmod-fs-vfat default y config GRUB_CONSOLE bool "Use Console Terminal (in addition to Serial)" - depends on GRUB_IMAGES || EFI_IMAGES + depends on GRUB_IMAGES || GRUB_EFI_IMAGES default y config GRUB_SERIAL string "Serial port device" - depends on GRUB_IMAGES || EFI_IMAGES - default "hvc0" if TARGET_x86_xen_domu - default "ttyS0" if ! TARGET_x86_xen_domu + depends on GRUB_IMAGES || GRUB_EFI_IMAGES + default "ttyS0" config GRUB_BAUDRATE int "Serial port baud rate" - depends on GRUB_IMAGES || EFI_IMAGES + depends on GRUB_IMAGES || GRUB_EFI_IMAGES default 38400 if TARGET_x86_generic default 115200 @@ -243,67 +234,46 @@ menu "Target Images" config GRUB_BOOTOPTS string "Extra kernel boot options" - depends on GRUB_IMAGES || EFI_IMAGES - default "xencons=hvc" if TARGET_x86_xen_domu + depends on GRUB_IMAGES || GRUB_EFI_IMAGES help If you don't know, just leave it blank. config GRUB_TIMEOUT string "Seconds to wait before booting the default entry" - depends on GRUB_IMAGES || EFI_IMAGES - default "0" + depends on GRUB_IMAGES || GRUB_EFI_IMAGES + default "5" help If you don't know, 5 seconds is a reasonable default. config GRUB_TITLE string "Title for the menu entry in GRUB" - depends on GRUB_IMAGES || EFI_IMAGES + depends on GRUB_IMAGES || GRUB_EFI_IMAGES default "OpenWrt" help This is the title of the GRUB menu entry. If unspecified, it defaults to OpenWrt. + config ISO_IMAGES + bool "Build LiveCD image (ISO)" + depends on TARGET_x86 + depends on GRUB_IMAGES || GRUB_EFI_IMAGES + config VDI_IMAGES bool "Build VirtualBox image files (VDI)" - depends on TARGET_x86 || TARGET_x86_64 - select GRUB_IMAGES - select TARGET_IMAGES_PAD + depends on TARGET_x86 + depends on GRUB_IMAGES || GRUB_EFI_IMAGES select PACKAGE_kmod-e1000 config VMDK_IMAGES bool "Build VMware image files (VMDK)" - depends on TARGET_x86 || TARGET_x86_64 - select GRUB_IMAGES - select TARGET_IMAGES_PAD - select PACKAGE_kmod-e1000 - default y - - config VHD_IMAGES - bool "Build Hyper-V image files (VHD)" - depends on TARGET_x86 || TARGET_x86_64 - depends on GRUB_IMAGES || EFI_IMAGES - select TARGET_IMAGES_PAD - select PACKAGE_kmod-tulip - default n - - config QCOW2_IMAGES - bool "Build PVE/KVM image files (QCOW2)" - depends on TARGET_x86 || TARGET_x86_64 - depends on GRUB_IMAGES || EFI_IMAGES - select TARGET_IMAGES_PAD + depends on TARGET_x86 + depends on GRUB_IMAGES || GRUB_EFI_IMAGES select PACKAGE_kmod-e1000 - default n - - config TARGET_IMAGES_PAD - bool "Pad images to filesystem size (for JFFS2)" - depends on GRUB_IMAGES || EFI_IMAGES - default y config TARGET_IMAGES_GZIP bool "GZip images" - depends on TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS || TARGET_x86 + depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta default y - default n if TARGET_x86 comment "Image Options" @@ -311,21 +281,21 @@ menu "Target Images" config TARGET_KERNEL_PARTSIZE int "Kernel partition size (in MB)" - depends on GRUB_IMAGES || EFI_IMAGES || USES_BOOT_PART + depends on USES_BOOT_PART default 8 if TARGET_apm821xx_sata default 64 if TARGET_bcm27xx default 16 config TARGET_ROOTFS_PARTSIZE int "Root filesystem partition size (in MB)" - depends on GRUB_IMAGES || EFI_IMAGES || USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_mvebu || TARGET_rb532 || TARGET_sunxi || TARGET_uml - default 160 + depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_sunxi || TARGET_uml + default 104 help Select the root filesystem partition size. config TARGET_ROOTFS_PARTNAME string "Root partition on target device" - depends on GRUB_IMAGES || EFI_IMAGES + depends on GRUB_IMAGES || GRUB_EFI_IMAGES help Override the root partition on the final device. If left empty, it will be mounted by PARTUUID which makes the kernel find the diff --git a/config/Config-kernel.in b/config/Config-kernel.in index df236cce0ed152..f71114b5daa874 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -48,8 +48,7 @@ config KERNEL_DEBUG_FS config KERNEL_MIPS_FP_SUPPORT bool - default y - depends on (mips || mipsel || mips64 || mips64el) + default y if TARGET_pistachio config KERNEL_ARM_PMU bool @@ -87,6 +86,126 @@ config KERNEL_PROFILING Enable the extended profiling support mechanisms used by profilers such as OProfile. +config KERNEL_UBSAN + bool "Compile the kernel with undefined behaviour sanity checker" + help + This option enables undefined behaviour sanity checker + Compile-time instrumentation is used to detect various undefined + behaviours in runtime. Various types of checks may be enabled + via boot parameter ubsan_handle + (see: Documentation/dev-tools/ubsan.rst). + +config KERNEL_UBSAN_SANITIZE_ALL + bool "Enable instrumentation for the entire kernel" + depends on KERNEL_UBSAN + default y + help + This option activates instrumentation for the entire kernel. + If you don't enable this option, you have to explicitly specify + UBSAN_SANITIZE := y for the files/directories you want to check for UB. + Enabling this option will get kernel image size increased + significantly. + +config KERNEL_UBSAN_ALIGNMENT + bool "Enable checking of pointers alignment" + depends on KERNEL_UBSAN + help + This option enables detection of unaligned memory accesses. + Enabling this option on architectures that support unaligned + accesses may produce a lot of false positives. + +config KERNEL_UBSAN_NULL + bool "Enable checking of null pointers" + depends on KERNEL_UBSAN + help + This option enables detection of memory accesses via a + null pointer. + +config KERNEL_KASAN + bool "Compile the kernel with KASan: runtime memory debugger" + select KERNEL_SLUB_DEBUG + depends on (x86_64 || aarch64) + help + Enables kernel address sanitizer - runtime memory debugger, + designed to find out-of-bounds accesses and use-after-free bugs. + This is strictly a debugging feature and it requires a gcc version + of 4.9.2 or later. Detection of out of bounds accesses to stack or + global variables requires gcc 5.0 or later. + This feature consumes about 1/8 of available memory and brings about + ~x3 performance slowdown. + For better error detection enable CONFIG_STACKTRACE. + 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 + + +choice + prompt "Instrumentation type" + depends on KERNEL_KASAN + default KERNEL_KASAN_OUTLINE + +config KERNEL_KASAN_OUTLINE + bool "Outline instrumentation" + help + Before every memory access compiler insert function call + __asan_load*/__asan_store*. These functions performs check + of shadow memory. This is slower than inline instrumentation, + however it doesn't bloat size of kernel's .text section so + much as inline does. + +config KERNEL_KASAN_INLINE + bool "Inline instrumentation" + help + Compiler directly inserts code checking shadow memory before + memory accesses. This is faster than outline (in some workloads + it gives about x2 boost over outline instrumentation), but + make kernel's .text size much bigger. + This requires a gcc version of 5.0 or later. + +endchoice + +config KERNEL_KCOV + bool "Compile the kernel with code coverage for fuzzing" + select KERNEL_DEBUG_FS + help + KCOV exposes kernel code coverage information in a form suitable + for coverage-guided fuzzing (randomized testing). + + If RANDOMIZE_BASE is enabled, PC values will not be stable across + different machines and across reboots. If you need stable PC values, + disable RANDOMIZE_BASE. + + For more details, see Documentation/kcov.txt. + +config KERNEL_KCOV_ENABLE_COMPARISONS + bool "Enable comparison operands collection by KCOV" + depends on KERNEL_KCOV + help + KCOV also exposes operands of every comparison in the instrumented + code along with operand sizes and PCs of the comparison instructions. + These operands can be used by fuzzing engines to improve the quality + of fuzzing coverage. + +config KERNEL_KCOV_INSTRUMENT_ALL + bool "Instrument all code by default" + depends on KERNEL_KCOV + default y if KERNEL_KCOV + help + If you are doing generic system call fuzzing (like e.g. syzkaller), + then you will want to instrument the whole kernel and you should + say y here. If you are doing more targeted fuzzing (like e.g. + filesystem fuzzing with AFL) then you will want to enable coverage + for more specific subsets of files, and should say n here. + config KERNEL_TASKSTATS bool "Compile the kernel with task resource/io statistics and accounting" default n @@ -270,7 +389,6 @@ config KERNEL_BLK_DEV_BSG config KERNEL_TRANSPARENT_HUGEPAGE bool - default n choice prompt "Transparent Hugepage Support sysfs defaults" @@ -318,6 +436,74 @@ config KERNEL_PROVE_LOCKING select KERNEL_DEBUG_KERNEL default n +config KERNEL_LOCKUP_DETECTOR + bool "Compile the kernel with detect Hard and Soft Lockups" + depends on KERNEL_DEBUG_KERNEL + help + Say Y here to enable the kernel to act as a watchdog to detect + hard and soft lockups. + + Softlockups are bugs that cause the kernel to loop in kernel + mode for more than 20 seconds, without giving other tasks a + chance to run. The current stack trace is displayed upon + detection and the system will stay locked up. + + Hardlockups are bugs that cause the CPU to loop in kernel mode + for more than 10 seconds, without letting other interrupts have a + chance to run. The current stack trace is displayed upon detection + and the system will stay locked up. + + The overhead should be minimal. A periodic hrtimer runs to + generate interrupts and kick the watchdog task every 4 seconds. + An NMI is generated every 10 seconds or so to check for hardlockups. + + The frequency of hrtimer and NMI events and the soft and hard lockup + thresholds can be controlled through the sysctl watchdog_thresh. + +config KERNEL_DETECT_HUNG_TASK + bool "Compile the kernel with detect Hung Tasks" + depends on KERNEL_DEBUG_KERNEL + default KERNEL_LOCKUP_DETECTOR + help + Say Y here to enable the kernel to detect "hung tasks", + which are bugs that cause the task to be stuck in + uninterruptible "D" state indefinitely. + + When a hung task is detected, the kernel will print the + current stack trace (which you should report), but the + task will stay in uninterruptible state. If lockdep is + enabled then all held locks will also be reported. This + feature has negligible overhead. + +config KERNEL_WQ_WATCHDOG + bool "Compile the kernel with detect Workqueue Stalls" + depends on KERNEL_DEBUG_KERNEL + help + Say Y here to enable stall detection on workqueues. If a + worker pool doesn't make forward progress on a pending work + item for over a given amount of time, 30s by default, a + warning message is printed along with dump of workqueue + state. This can be configured through kernel parameter + "workqueue.watchdog_thresh" and its sysfs counterpart. + +config KERNEL_DEBUG_ATOMIC_SLEEP + bool "Compile the kernel with sleep inside atomic section checking" + depends on KERNEL_DEBUG_KERNEL + help + If you say Y here, various routines which may sleep will become very + noisy if they are called inside atomic sections: when a spinlock is + held, inside an rcu read side critical section, inside preempt disabled + sections, inside an interrupt, etc... + +config KERNEL_DEBUG_VM + bool "Compile the kernel with debug VM" + depends on KERNEL_DEBUG_KERNEL + help + Enable this to turn on extended checks in the virtual-memory system + that may impact performance. + + If unsure, say N. + config KERNEL_PRINTK_TIME bool "Enable printk timestamps" default y @@ -460,7 +646,7 @@ if KERNEL_CGROUPS config KERNEL_CPUSETS bool "Cpuset support" - default y if !SMALL_FLASH + default y help This option will let you create and manage CPUSETs which allow dynamically partitioning a system into sets of CPUs and @@ -474,14 +660,14 @@ if KERNEL_CGROUPS config KERNEL_CGROUP_CPUACCT bool "Simple CPU accounting cgroup subsystem" - default y if !SMALL_FLASH + default y help Provides a simple Resource Controller for monitoring the total CPU consumed by the tasks in a cgroup. config KERNEL_RESOURCE_COUNTERS bool "Resource counters" - default y if !SMALL_FLASH + default y help This option enables controller independent resource accounting infrastructure that works with cgroups. @@ -492,7 +678,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG bool "Memory Resource Controller for Control Groups" - default y if !SMALL_FLASH + default y select KERNEL_FREEZER depends on KERNEL_RESOURCE_COUNTERS || !LINUX_3_18 help @@ -516,7 +702,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG_SWAP bool "Memory Resource Controller Swap Extension" - default y if !SMALL_FLASH + default y depends on KERNEL_MEMCG help Add swap management feature to memory resource controller. When you @@ -551,7 +737,7 @@ if KERNEL_CGROUPS config KERNEL_MEMCG_KMEM bool "Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)" - default y if !SMALL_FLASH + default y depends on KERNEL_MEMCG help The Kernel Memory extension for Memory Resource Controller can limit @@ -572,7 +758,7 @@ if KERNEL_CGROUPS menuconfig KERNEL_CGROUP_SCHED bool "Group CPU scheduler" - default y if !SMALL_FLASH + default y help This feature lets CPU scheduler recognize task groups and control CPU bandwidth allocation to such task groups. It uses cgroups to group @@ -582,11 +768,11 @@ if KERNEL_CGROUPS config KERNEL_FAIR_GROUP_SCHED bool "Group scheduling for SCHED_OTHER" - default y if !SMALL_FLASH + default y config KERNEL_CFS_BANDWIDTH bool "CPU bandwidth provisioning for FAIR_GROUP_SCHED" - default n + default y depends on KERNEL_FAIR_GROUP_SCHED help This option allows users to define CPU bandwidth rates (limits) for @@ -597,7 +783,7 @@ if KERNEL_CGROUPS config KERNEL_RT_GROUP_SCHED bool "Group scheduling for SCHED_RR/FIFO" - default y if !SMALL_FLASH + default y help This feature lets you explicitly allocate real CPU bandwidth to task groups. If enabled, it will also make it impossible to @@ -632,7 +818,7 @@ if KERNEL_CGROUPS config KERNEL_BLK_DEV_THROTTLING bool "Enable throttling policy" - default y if TARGET_bcm27xx + default y config KERNEL_BLK_DEV_THROTTLING_LOW bool "Block throttling .low limit interface support (EXPERIMENTAL)" @@ -667,7 +853,7 @@ endif config KERNEL_NAMESPACES bool "Enable kernel namespaces" - default n + default y if !SMALL_FLASH if KERNEL_NAMESPACES @@ -736,13 +922,13 @@ config KERNEL_POSIX_MQUEUE config KERNEL_SECCOMP_FILTER bool - default n + default y if !SMALL_FLASH config KERNEL_SECCOMP bool "Enable seccomp support" depends on !(TARGET_uml) select KERNEL_SECCOMP_FILTER - default n + default y if !SMALL_FLASH help Build kernel with support for seccomp. @@ -877,7 +1063,7 @@ menu "Filesystem ACL and attr support options" select KERNEL_FS_POSIX_ACL default y if USE_FS_ACL_ATTR - config KERNEL_HFSPLUG_FS_POSIX_ACL + config KERNEL_HFSPLUS_FS_POSIX_ACL bool "Enable POSIX ACL for HFS+ Filesystems" select KERNEL_FS_POSIX_ACL default y if USE_FS_ACL_ATTR diff --git a/feeds.conf.default b/feeds.conf.default index 276b2be4a96339..416da4b0c900a3 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -6,4 +6,3 @@ src-git telephony https://git.openwrt.org/feed/telephony.git #src-git targets https://github.com/openwrt/targets.git #src-git oldpackages http://git.openwrt.org/packages.git #src-link custom /usr/src/openwrt/custom-feed -#src-git helloworld https://github.com/fw876/helloworld diff --git a/include/cmake.mk b/include/cmake.mk index 96c4d7df3479f2..b38d44003912a5 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -1,5 +1,13 @@ cmake_bool = $(patsubst %,-D%:BOOL=$(if $($(1)),ON,OFF),$(2)) +PKG_USE_NINJA ?= 1 +HOST_USE_NINJA ?= 1 +ifeq ($(PKG_USE_NINJA),1) + PKG_BUILD_PARALLEL ?= 1 +endif +ifeq ($(HOST_USE_NINJA),1) + HOST_BUILD_PARALLEL ?= 1 +endif PKG_INSTALL:=1 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) @@ -44,6 +52,34 @@ CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_ CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST) CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions +ifeq ($(HOST_USE_NINJA),1) + CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja" + + define Host/Compile/Default + +$(NINJA) -C $(HOST_BUILD_DIR) $(1) + endef + + define Host/Install/Default + +$(NINJA) -C $(HOST_BUILD_DIR) install + endef + + define Host/Uninstall/Default + +$(NINJA) -C $(HOST_BUILD_DIR) uninstall + endef +endif + +ifeq ($(PKG_USE_NINJA),1) + CMAKE_OPTIONS += -DCMAKE_GENERATOR="Ninja" + + define Build/Compile/Default + +$(NINJA) -C $(CMAKE_BINARY_DIR) $(1) + endef + + define Build/Install/Default + +DESTDIR="$(PKG_INSTALL_DIR)" $(NINJA) -C $(CMAKE_BINARY_DIR) install + endef +endif + define Build/Configure/Default mkdir -p $(CMAKE_BINARY_DIR) (cd $(CMAKE_BINARY_DIR); \ diff --git a/include/feeds.mk b/include/feeds.mk index 98e315bceb5eab..e499ac2684a78d 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -43,5 +43,11 @@ endef # 1: package name define GetABISuffix -$(if $(filter-out kmod-%,$(1)),$(if $(ABIV_$(1)),$(ABIV_$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v))))) +$(call FormatABISuffix,$(1),$(if $(ABIV_$(1)),$(ABIV_$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v))))) +endef + +# 1: package name +# 2: abi version +define FormatABISuffix +$(if $(filter-out kmod-%,$(1)),$(if $(2),$(if $(filter %0 %1 %2 %3 %4 %5 %6 %7 %8 %9,$(1)),-)$(2))) endef diff --git a/include/image-commands.mk b/include/image-commands.mk index f21f9e3f03a39b..fa368850388d09 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -11,105 +11,77 @@ define rootfs_align $(patsubst %-256k,0x40000,$(patsubst %-128k,0x20000,$(patsubst %-64k,0x10000,$(patsubst squashfs%,0x4,$(patsubst root.%,%,$(1)))))) endef -define Build/buffalo-enc - $(eval product=$(word 1,$(1))) - $(eval version=$(word 2,$(1))) - $(eval args=$(wordlist 3,$(words $(1)),$(1))) - $(STAGING_DIR_HOST)/bin/buffalo-enc \ - -p $(product) -v $(version) $(args) \ - -i $@ -o $@.new - mv $@.new $@ -endef -define Build/buffalo-enc-tag - $(call Build/buffalo-enc,'' '' -S 152 $(1)) +define Build/append-dtb + cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@ endef -define Build/buffalo-tag-dhp - $(eval product=$(word 1,$(1))) - $(eval region=$(word 2,$(1))) - $(eval language=$(word 3,$(1))) - $(STAGING_DIR_HOST)/bin/buffalo-tag \ - -d 0x01000000 -w 1 \ - -a $(BUFFALO_TAG_PLATFORM) \ - -v $(BUFFALO_TAG_VERSION) -m $(BUFFALO_TAG_MINOR) \ - -b $(product) -p $(product) \ - -r $(region) -r $(region) -l $(language) \ - -I $@ -o $@.new - mv $@.new $@ +define Build/append-dtb-elf + $(TARGET_CROSS)objcopy \ + --set-section-flags=.appended_dtb=alloc,contents \ + --update-section \ + .appended_dtb=$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@ endef -define Build/buffalo-dhp-image - $(STAGING_DIR_HOST)/bin/mkdhpimg $@ $@.new - mv $@.new $@ +define Build/append-kernel + dd if=$(IMAGE_KERNEL) >> $@ endef -define Build/elx-header - $(eval hw_id=$(word 1,$(1))) - $(eval xor_pattern=$(word 2,$(1))) - ( \ - echo -ne "\x00\x00\x00\x00\x00\x00\x00\x03" | \ - dd bs=42 count=1 conv=sync; \ - hw_id="$(hw_id)"; \ - echo -ne "\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \ - dd bs=20 count=1 conv=sync; \ - echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ - dd bs=8 count=1 conv=sync; \ - echo -ne "$$($(MKHASH) md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ - dd bs=58 count=1 conv=sync; \ - ) > $(KDIR)/tmp/$(DEVICE_NAME).header - $(call Build/xor-image,-p $(xor_pattern) -x) - cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new - mv $@.new $@ - rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header +define Build/append-image + dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@ endef -define Build/eva-image - $(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new - mv $@.new $@ +ifdef IB +define Build/append-image-stage + dd if=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1) >> $@ endef - -define Build/seama - $(STAGING_DIR_HOST)/bin/seama -i $@ \ - -m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware" - mv $@.seama $@ +else +define Build/append-image-stage + dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) of=$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1) + dd if=$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) >> $@ endef +endif -define Build/seama-seal - $(STAGING_DIR_HOST)/bin/seama -i $@ -s $@.seama \ - -m "signature=$(SEAMA_SIGNATURE)" - mv $@.seama $@ -endef -define Build/zyxel-ras-image - let \ - newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \ - $(STAGING_DIR_HOST)/bin/mkrasimage \ - -b $(RAS_BOARD) \ - -v $(RAS_VERSION) \ - -r $@ \ - -s $$newsize \ - -o $@.new \ - $(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \ - && mv $@.new $@ -endef +compat_version=$(if $(DEVICE_COMPAT_VERSION),$(DEVICE_COMPAT_VERSION),1.0) +json_quote=$(subst ','\'',$(subst ",\",$(1))) +#")') -define Build/netgear-chk - $(STAGING_DIR_HOST)/bin/mkchkimg \ - -o $@.new \ - -k $@ \ - -b $(NETGEAR_BOARD_ID) \ - $(if $(NETGEAR_REGION),-r $(NETGEAR_REGION),) - mv $@.new $@ +legacy_supported_message=$(SUPPORTED_DEVICES) - Image version mismatch: image $(compat_version), \ + device 1.0. Please wipe config during upgrade (force required) or reinstall. \ + $(if $(DEVICE_COMPAT_MESSAGE),Reason: $(DEVICE_COMPAT_MESSAGE),Please check documentation ...) + +metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))")))) +metadata_json = \ + '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \ + "metadata_version": "1.1", \ + "compat_version": "$(call json_quote,$(compat_version))", \ + $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \ + $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \ + [$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \ + "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \ + $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \ + "version": { \ + "dist": "$(call json_quote,$(VERSION_DIST))", \ + "version": "$(call json_quote,$(VERSION_NUMBER))", \ + "revision": "$(call json_quote,$(REVISION))", \ + "target": "$(call json_quote,$(TARGETID))", \ + "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \ + } \ + }' + +define Build/append-metadata + $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json) | fwtool -I - $@) + [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \ + cp "$(BUILD_KEY).ucert" "$@.ucert" ;\ + usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\ + ucert -A -c "$@.ucert" -x "$@.sig" ;\ + fwtool -S "$@.ucert" "$@" ;\ + } endef -define Build/netgear-dni - $(STAGING_DIR_HOST)/bin/mkdniimg \ - -B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \ - $(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \ - -r "$(1)" \ - -i $@ -o $@.new - mv $@.new $@ +define Build/append-rootfs + dd if=$(IMAGE_ROOTFS) >> $@ endef define Build/append-squashfs-fakeroot-be @@ -126,6 +98,25 @@ define Build/append-string echo -n $(1) >> $@ endef +define Build/append-ubi + sh $(TOPDIR)/scripts/ubinize-image.sh \ + $(if $(UBOOTENV_IN_UBI),--uboot-env) \ + $(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \ + $(foreach part,$(UBINIZE_PARTS),--part $(part)) \ + $(IMAGE_ROOTFS) \ + $@.tmp \ + -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \ + $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \ + $(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \ + $(UBINIZE_OPTS) + cat $@.tmp >> $@ + rm $@.tmp +endef + +define Build/append-uboot + dd if=$(UBOOT_PATH) >> $@ +endef + # append a fake/empty uImage header, to fool bootloaders rootfs integrity check # for example define Build/append-uImage-fakehdr @@ -142,38 +133,83 @@ define Build/append-uImage-fakehdr cat $@.fakehdr >> $@ endef -define Build/tplink-safeloader - -$(STAGING_DIR_HOST)/bin/tplink-safeloader \ - -B $(TPLINK_BOARD_ID) \ - -V $(REVISION) \ - -k $(IMAGE_KERNEL) \ - -r $@ \ - -o $@.new \ - -j \ - $(wordlist 2,$(words $(1)),$(1)) \ - $(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@ +define Build/buffalo-dhp-image + $(STAGING_DIR_HOST)/bin/mkdhpimg $@ $@.new + mv $@.new $@ endef -define Build/append-dtb - cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@ +define Build/buffalo-enc + $(eval product=$(word 1,$(1))) + $(eval version=$(word 2,$(1))) + $(eval args=$(wordlist 3,$(words $(1)),$(1))) + $(STAGING_DIR_HOST)/bin/buffalo-enc \ + -p $(product) -v $(version) $(args) \ + -i $@ -o $@.new + mv $@.new $@ endef -define Build/append-dtb-elf - $(TARGET_CROSS)objcopy \ - --set-section-flags=.appended_dtb=alloc,contents \ - --update-section \ - .appended_dtb=$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@ +define Build/buffalo-enc-tag + $(call Build/buffalo-enc,'' '' -S 152 $(1)) endef -define Build/install-dtb - $(call locked, \ - $(foreach dts,$(DEVICE_DTS), \ - $(CP) \ - $(DTS_DIR)/$(dts).dtb \ - $(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \ - ), \ - install-dtb-$(IMG_PREFIX) \ - ) +define Build/buffalo-tag-dhp + $(eval product=$(word 1,$(1))) + $(eval region=$(word 2,$(1))) + $(eval language=$(word 3,$(1))) + $(STAGING_DIR_HOST)/bin/buffalo-tag \ + -d 0x01000000 -w 1 \ + -a $(BUFFALO_TAG_PLATFORM) \ + -v $(BUFFALO_TAG_VERSION) -m $(BUFFALO_TAG_MINOR) \ + -b $(product) -p $(product) \ + -r $(region) -r $(region) -l $(language) \ + -I $@ -o $@.new + mv $@.new $@ +endef + +define Build/check-size + @imagesize="$$(stat -c%s $@)"; \ + limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \ + [ $$limitsize -ge $$imagesize ] || { \ + echo "WARNING: Image file $@ is too big: $$imagesize > $$limitsize" >&2; \ + rm -f $@; \ + } +endef + +define Build/elecom-product-header + $(eval product=$(word 1,$(1))) + $(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@)) + + ( \ + echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \ + echo -n "0.00" | dd bs=16 count=1 conv=sync; \ + dd if=$(fw); \ + ) > $(fw).new + mv $(fw).new $(fw) +endef + +define Build/elx-header + $(eval hw_id=$(word 1,$(1))) + $(eval xor_pattern=$(word 2,$(1))) + ( \ + echo -ne "\x00\x00\x00\x00\x00\x00\x00\x03" | \ + dd bs=42 count=1 conv=sync; \ + hw_id="$(hw_id)"; \ + echo -ne "\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \ + dd bs=20 count=1 conv=sync; \ + echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ + dd bs=8 count=1 conv=sync; \ + echo -ne "$$($(MKHASH) md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ + dd bs=58 count=1 conv=sync; \ + ) > $(KDIR)/tmp/$(DEVICE_NAME).header + $(call Build/xor-image,-p $(xor_pattern) -x) + cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new + mv $@.new $@ + rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header +endef + +define Build/eva-image + $(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new + mv $@.new $@ endef define Build/initrd_compression @@ -204,28 +240,20 @@ define Build/fit @mv $@.new $@ endef -define Build/lzma - $(call Build/lzma-no-dict,-lc1 -lp2 -pb2 $(1)) -endef - -define Build/lzma-no-dict - $(STAGING_DIR_HOST)/bin/lzma e $@ $(1) $@.new - @mv $@.new $@ -endef - define Build/gzip gzip -f -9n -c $@ $(1) > $@.new @mv $@.new $@ endef -define Build/zip - mkdir $@.tmp - mv $@ $@.tmp/$(1) - - zip -j -X \ - $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \ - $@ $@.tmp/$(if $(1),$(1),$@) - rm -rf $@.tmp +define Build/install-dtb + $(call locked, \ + $(foreach dts,$(DEVICE_DTS), \ + $(CP) \ + $(DTS_DIR)/$(dts).dtb \ + $(BIN_DIR)/$(IMG_PREFIX)-$(dts).dtb; \ + ), \ + install-dtb-$(IMG_PREFIX) \ + ) endef define Build/jffs2 @@ -256,50 +284,57 @@ define Build/kernel-bin cp $< $@ endef -define Build/patch-cmdline - $(STAGING_DIR_HOST)/bin/patch-cmdline $@ '$(CMDLINE)' +define Build/linksys-image + $(TOPDIR)/scripts/linksys-image.sh \ + "$(call param_get_default,type,$(1),$(DEVICE_NAME))" \ + $@ $@.new + mv $@.new $@ endef -define Build/append-kernel - dd if=$(IMAGE_KERNEL) >> $@ +define Build/lzma + $(call Build/lzma-no-dict,-lc1 -lp2 -pb2 $(1)) endef -define Build/append-rootfs - dd if=$(IMAGE_ROOTFS) >> $@ +define Build/lzma-no-dict + $(STAGING_DIR_HOST)/bin/lzma e $@ $(1) $@.new + @mv $@.new $@ endef -define Build/append-ubi - sh $(TOPDIR)/scripts/ubinize-image.sh \ - $(if $(UBOOTENV_IN_UBI),--uboot-env) \ - $(if $(KERNEL_IN_UBI),--kernel $(IMAGE_KERNEL)) \ - $(foreach part,$(UBINIZE_PARTS),--part $(part)) \ - $(IMAGE_ROOTFS) \ - $@.tmp \ - -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \ - $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \ - $(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \ - $(UBINIZE_OPTS) - cat $@.tmp >> $@ - rm $@.tmp +define Build/netgear-chk + $(STAGING_DIR_HOST)/bin/mkchkimg \ + -o $@.new \ + -k $@ \ + -b $(NETGEAR_BOARD_ID) \ + $(if $(NETGEAR_REGION),-r $(NETGEAR_REGION),) + mv $@.new $@ endef -define Build/append-uboot - dd if=$(UBOOT_PATH) >> $@ +define Build/netgear-dni + $(STAGING_DIR_HOST)/bin/mkdniimg \ + -B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \ + $(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \ + -r "$(1)" \ + -i $@ -o $@.new + mv $@.new $@ endef -define Build/pad-to - $(call Image/pad-to,$@,$(1)) +define Build/openmesh-image + $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \ + "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \ + "$@-fwupgrade.cfg" \ + "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" \ + "$(call param_get_default,rootfs,$(1),$@)" + $(TOPDIR)/scripts/combined-ext-image.sh \ + "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" "$@" \ + "$@-fwupgrade.cfg" "fwupgrade.cfg" \ + "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" "kernel" \ + "$(call param_get_default,rootfs,$(1),$@)" "rootfs" endef define Build/pad-extra dd if=/dev/zero bs=$(1) count=1 >> $@ endef -define Build/pad-rootfs - $(STAGING_DIR_HOST)/bin/padjffs2 $@ $(1) \ - $(if $(BLOCKSIZE),$(BLOCKSIZE:%k=%),4 8 16 64 128 256) -endef - define Build/pad-offset let \ size="$$(stat -c%s $@)" \ @@ -311,45 +346,28 @@ define Build/pad-offset mv $@.new $@ endef -define Build/xor-image - $(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1) - mv $@.xor $@ -endef - -define Build/check-size - @imagesize="$$(stat -c%s $@)"; \ - limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \ - [ $$limitsize -ge $$imagesize ] || { \ - echo "WARNING: Image file $@ is too big: $$imagesize > $$limitsize" >&2; \ - rm -f $@; \ - } +define Build/pad-rootfs + $(STAGING_DIR_HOST)/bin/padjffs2 $@ $(1) \ + $(if $(BLOCKSIZE),$(BLOCKSIZE:%k=%),4 8 16 64 128 256) endef -define Build/linksys-image - $(TOPDIR)/scripts/linksys-image.sh \ - "$(call param_get_default,type,$(1),$(DEVICE_NAME))" \ - $@ $@.new - mv $@.new $@ +define Build/pad-to + $(call Image/pad-to,$@,$(1)) endef -define Build/openmesh-image - $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \ - "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \ - "$@-fwupgrade.cfg" \ - "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" \ - "$(call param_get_default,rootfs,$(1),$@)" - $(TOPDIR)/scripts/combined-ext-image.sh \ - "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" "$@" \ - "$@-fwupgrade.cfg" "fwupgrade.cfg" \ - "$(call param_get_default,kernel,$(1),$(IMAGE_KERNEL))" "kernel" \ - "$(call param_get_default,rootfs,$(1),$@)" "rootfs" +define Build/patch-cmdline + $(STAGING_DIR_HOST)/bin/patch-cmdline $@ '$(CMDLINE)' endef -define Build/qsdk-ipq-factory-mmc - $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \ - $@.its kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS) - PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new - @mv $@.new $@ +# Convert a raw image into a $1 type image. +# E.g. | qemu-image vdi +define Build/qemu-image + if command -v qemu-img; then \ + qemu-img convert -f raw -O $1 $@ $@.new; \ + mv $@.new $@; \ + else \ + echo "WARNING: Install qemu-img to create VDI/VMDK images" >&2; exit 1; \ + fi endef define Build/qsdk-ipq-factory-nand @@ -366,6 +384,18 @@ define Build/qsdk-ipq-factory-nor @mv $@.new $@ endef +define Build/seama + $(STAGING_DIR_HOST)/bin/seama -i $@ \ + -m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware" + mv $@.seama $@ +endef + +define Build/seama-seal + $(STAGING_DIR_HOST)/bin/seama -i $@ -s $@.seama \ + -m "signature=$(SEAMA_SIGNATURE)" + mv $@.seama $@ +endef + define Build/senao-header $(STAGING_DIR_HOST)/bin/mksenaofw $(1) -e $@ -o $@.new mv $@.new $@ @@ -379,6 +409,18 @@ define Build/sysupgrade-tar $@ endef +define Build/tplink-safeloader + -$(STAGING_DIR_HOST)/bin/tplink-safeloader \ + -B $(TPLINK_BOARD_ID) \ + -V $(REVISION) \ + -k $(IMAGE_KERNEL) \ + -r $@ \ + -o $@.new \ + -j \ + $(wordlist 2,$(words $(1)),$(1)) \ + $(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@ +endef + define Build/tplink-v1-header $(STAGING_DIR_HOST)/bin/mktplinkfw \ -c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \ @@ -426,22 +468,6 @@ define Build/tplink-v2-image rm -rf $@.new endef -json_quote=$(subst ','\'',$(subst ",\",$(1))) -#")') -metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))")))) -metadata_json = \ - '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \ - "metadata_version": "1.0", \ - "supported_devices":[$(call metadata_devices,$(1))], \ - "version": { \ - "dist": "$(call json_quote,$(VERSION_DIST))", \ - "version": "$(call json_quote,$(VERSION_NUMBER))", \ - "revision": "$(call json_quote,$(REVISION))", \ - "target": "$(call json_quote,$(TARGETID))", \ - "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \ - } \ - }' - define Build/uImage mkimage \ -A $(LINUX_KARCH) \ @@ -457,12 +483,30 @@ define Build/uImage mv $@.new $@ endef -define Build/append-metadata - $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) - [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \ - cp "$(BUILD_KEY).ucert" "$@.ucert" ;\ - usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\ - ucert -A -c "$@.ucert" -x "$@.sig" ;\ - fwtool -S "$@.ucert" "$@" ;\ - } +define Build/xor-image + $(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1) + mv $@.xor $@ +endef + +define Build/zip + mkdir $@.tmp + mv $@ $@.tmp/$(1) + + zip -j -X \ + $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \ + $@ $@.tmp/$(if $(1),$(1),$@) + rm -rf $@.tmp +endef + +define Build/zyxel-ras-image + let \ + newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \ + $(STAGING_DIR_HOST)/bin/mkrasimage \ + -b $(RAS_BOARD) \ + -v $(RAS_VERSION) \ + -r $@ \ + -s $$newsize \ + -o $@.new \ + $(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \ + && mv $@.new $@ endef diff --git a/include/image.mk b/include/image.mk index ef0d4605140143..a7473abe68f4fd 100644 --- a/include/image.mk +++ b/include/image.mk @@ -41,6 +41,7 @@ IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$ IMG_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_COMBINED:=$(IMG_PREFIX)-combined IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8) +IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/') MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt @@ -89,7 +90,6 @@ fs-types-$(CONFIG_TARGET_ROOTFS_SQUASHFS) += squashfs fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addprefix jffs2-,$(JFFS2_BLOCKSIZE)) fs-types-$(CONFIG_TARGET_ROOTFS_JFFS2_NAND) += $(addprefix jffs2-nand-,$(NAND_BLOCKSIZE)) fs-types-$(CONFIG_TARGET_ROOTFS_EXT4FS) += ext4 -fs-types-$(CONFIG_TARGET_ROOTFS_ISO) += iso fs-types-$(CONFIG_TARGET_ROOTFS_UBIFS) += ubifs fs-subtypes-$(CONFIG_TARGET_ROOTFS_JFFS2) += $(addsuffix -raw,$(addprefix jffs2-,$(JFFS2_BLOCKSIZE))) @@ -229,7 +229,7 @@ define Image/mkfs/squashfs-common $(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \ -nopad -noappend -root-owned \ -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \ - -processors $(shell nproc) + -processors 1 endef ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y) @@ -302,7 +302,7 @@ endif ifdef CONFIG_TARGET_ROOTFS_CPIOGZ define Image/Build/cpiogz - ( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz ) + ( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 | gzip -9n >$(BIN_DIR)/$(IMG_ROOTFS).cpio.gz ) endef endif @@ -364,14 +364,14 @@ define Device/Init IMAGES := ARTIFACTS := - IMAGE_PREFIX := $(IMG_PREFIX)-$(1) - IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2) + DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1) + DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2) IMAGE_SIZE := - KERNEL_PREFIX = $$(IMAGE_PREFIX) + KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX) KERNEL_SUFFIX := -kernel.bin KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX) KERNEL_IMAGE = $$(KERNEL_PREFIX)$$(KERNEL_SUFFIX) - KERNEL_INITRAMFS_PREFIX = $$(IMAGE_PREFIX)-initramfs + KERNEL_INITRAMFS_PREFIX = $$(DEVICE_IMG_PREFIX)-initramfs KERNEL_INITRAMFS_IMAGE = $$(KERNEL_INITRAMFS_PREFIX)$$(KERNEL_INITRAMFS_SUFFIX) KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs KERNEL_INSTALL := @@ -401,6 +401,8 @@ define Device/Init BOARD_NAME := UIMAGE_MAGIC := UIMAGE_NAME := + DEVICE_COMPAT_VERSION := 1.0 + DEVICE_COMPAT_MESSAGE := SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) IMAGE_METADATA := @@ -408,6 +410,7 @@ define Device/Init UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-$(1) + BROKEN := DEFAULT := endef @@ -416,9 +419,11 @@ DEFAULT_DEVICE_VARS := \ CMDLINE UBOOTENV_IN_UBI KERNEL_IN_UBI BLOCKSIZE PAGESIZE SUBPAGESIZE \ VID_HDR_OFFSET UBINIZE_OPTS UBINIZE_PARTS MKUBIFS_OPTS DEVICE_DTS \ DEVICE_DTS_CONFIG DEVICE_DTS_DIR DEVICE_DTS_OVERLAY DEVICE_FDT_NUM \ - SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ - SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR UBOOT_PATH \ - IMAGE_SIZE DEVICE_PACKAGES DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ + DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ + SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ + UBOOT_PATH IMAGE_SIZE \ + DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ + DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \ DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT @@ -473,6 +478,7 @@ define Device/Build/initramfs $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,)) $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare + $(1)-images: $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) cp $$^ $$@ @@ -487,10 +493,10 @@ define Device/Build/initramfs DEVICE_ID="$(1)" \ BIN_DIR="$(BIN_DIR)" \ SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ - IMAGE_NAME="$$(notdir $$^)" \ + DEVICE_IMG_NAME="$$(notdir $$^)" \ IMAGE_TYPE="kernel" \ IMAGE_FILESYSTEM="initramfs" \ - IMAGE_PREFIX="$$(IMAGE_PREFIX)" \ + DEVICE_IMG_PREFIX="$$(DEVICE_IMG_PREFIX)" \ DEVICE_VENDOR="$$(DEVICE_VENDOR)" \ DEVICE_MODEL="$$(DEVICE_MODEL)" \ DEVICE_VARIANT="$$(DEVICE_VARIANT)" \ @@ -562,9 +568,10 @@ endef define Device/Build/image GZ_SUFFIX := $(if $(filter %dtb %gz,$(2)),,$(if $(and $(findstring ext4,$(1)),$(CONFIG_TARGET_IMAGES_GZIP)),.gz)) $$(_TARGET): $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \ - $(BUILD_DIR)/json_info_files/$(call IMAGE_NAME,$(1),$(2)).json, \ - $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2))$$(GZ_SUFFIX)) - $(eval $(call Device/Export,$(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)),$(1))) + $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \ + $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)) + $(eval $(call Device/Export,$(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)),$(1))) + $(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX) ROOTFS/$(1)/$(3) := \ $(KDIR)/root.$(1)$$(strip \ @@ -575,28 +582,28 @@ define Device/Build/image ifndef IB $$(ROOTFS/$(1)/$(3)): $(if $(TARGET_PER_DEVICE_ROOTFS),target-dir-$$(ROOTFS_ID/$(3))) endif - $(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)): $$(KDIR_KERNEL_IMAGE) $$(ROOTFS/$(1)/$(3)) + $(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)): $$(KDIR_KERNEL_IMAGE) $$(ROOTFS/$(1)/$(3)) @rm -f $$@ [ -f $$(word 1,$$^) -a -f $$(word 2,$$^) ] $$(call concat_cmd,$(if $(IMAGE/$(2)/$(1)),$(IMAGE/$(2)/$(1)),$(IMAGE/$(2)))) - .IGNORE: $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2)) + .IGNORE: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2)) - $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2)).gz: $(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)) + $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2)).gz: $(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)) gzip -c -9n $$^ > $$@ - $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2)): $(KDIR)/tmp/$(call IMAGE_NAME,$(1),$(2)) + $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2)): $(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)) cp $$^ $$@ - $(BUILD_DIR)/json_info_files/$(call IMAGE_NAME,$(1),$(2)).json: $(BIN_DIR)/$(call IMAGE_NAME,$(1),$(2))$$(GZ_SUFFIX) + $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX) @mkdir -p $$(shell dirname $$@) DEVICE_ID="$(DEVICE_NAME)" \ BIN_DIR="$(BIN_DIR)" \ SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ - IMAGE_NAME="$(IMAGE_NAME)" \ + DEVICE_IMG_NAME="$(DEVICE_IMG_NAME)" \ IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \ IMAGE_FILESYSTEM="$(1)" \ - IMAGE_PREFIX="$(IMAGE_PREFIX)" \ + DEVICE_IMG_PREFIX="$(DEVICE_IMG_PREFIX)" \ DEVICE_VENDOR="$(DEVICE_VENDOR)" \ DEVICE_MODEL="$(DEVICE_MODEL)" \ DEVICE_VARIANT="$(DEVICE_VARIANT)" \ @@ -621,15 +628,15 @@ define Device/Build/image endef define Device/Build/artifact - $$(_TARGET): $(BIN_DIR)/$(IMAGE_PREFIX)-$(1) - $(eval $(call Device/Export,$(KDIR)/tmp/$(IMAGE_PREFIX)-$(1))) - $(KDIR)/tmp/$(IMAGE_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE) + $$(_TARGET): $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) + $(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1))) + $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE) $(2)-images @rm -f $$@ $$(call concat_cmd,$(ARTIFACT/$(1))) - .IGNORE: $(BIN_DIR)/$(IMAGE_PREFIX)-$(1) + .IGNORE: $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1) - $(BIN_DIR)/$(IMAGE_PREFIX)-$(1): $(KDIR)/tmp/$(IMAGE_PREFIX)-$(1) + $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1): $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1) cp $$^ $$@ endef @@ -646,7 +653,7 @@ define Device/Build $$(call Device/Build/image,$$(fs),$$(image),$(1))))) $$(eval $$(foreach artifact,$$(ARTIFACTS), \ - $$(call Device/Build/artifact,$$(artifact)))) + $$(call Device/Build/artifact,$$(artifact),$(1)))) endef @@ -656,6 +663,7 @@ Target-Profile-Name: $(DEVICE_DISPLAY) Target-Profile-Packages: $(DEVICE_PACKAGES) 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)) $(if $(DEFAULT),Target-Profile-Default: $(DEFAULT)) Target-Profile-Description: $(DEVICE_DESCRIPTION) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 32eb545b57862f..66a9f64c802959 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -160,7 +160,11 @@ define BuildKernel rm -f $(STAMP_CONFIGURED) $(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config $(_SINGLE)$(KERNEL_MAKE) \ - $(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \ + $(if $(findstring Darwin,$(HOST_OS)), \ + HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses" \ + HOSTLDLIBS_mconf="-L$(STAGING_DIR_HOST)/lib -lncurses" \ + filechk_conf_cfg=" :" \ + ) \ YACC=$(STAGING_DIR_HOST)/bin/bison \ $$@ $(call LINUX_RECONF_DIFF,$(LINUX_DIR)/.config) > $(LINUX_RECONFIG_TARGET) diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index bfa6a5ed94d2dc..f2864d6a10ff10 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -170,7 +170,7 @@ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS_SEPARATE),y) ifeq ($(CONFIG_EXTERNAL_CPIO),y) $(CP) $(CONFIG_EXTERNAL_CPIO) $(KERNEL_BUILD_DIR)/initrd.cpio else - ( cd $(TARGET_DIR); find . | cpio -o -H newc -R root:root > $(KERNEL_BUILD_DIR)/initrd.cpio ) + ( cd $(TARGET_DIR); find . | $(STAGING_DIR_HOST)/bin/cpio -o -H newc -R 0:0 > $(KERNEL_BUILD_DIR)/initrd.cpio ) endif $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio) diff --git a/include/logo.png b/include/logo.png new file mode 100644 index 00000000000000..bb208dd90590a2 Binary files /dev/null and b/include/logo.png differ diff --git a/include/logo.svg b/include/logo.svg new file mode 100644 index 00000000000000..ff4b8adfc704b8 --- /dev/null +++ b/include/logo.svg @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/netfilter.mk b/include/netfilter.mk index 36de07d58ff560..803749d931c925 100644 --- a/include/netfilter.mk +++ b/include/netfilter.mk @@ -105,10 +105,6 @@ $(eval $(call nf_add,IPT_PHYSDEV,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_ph $(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_STRING, $(P_XT)xt_string)) $(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_BPF, $(P_XT)xt_bpf)) -# imq - -$(eval $(call nf_add,IPT_IMQ,CONFIG_IP_NF_TARGET_IMQ, $(P_V4)ipt_IMQ)) -$(eval $(call nf_add,IPT_IMQ,CONFIG_NETFILTER_XT_TARGET_IMQ, $(P_XT)xt_IMQ)) # ipopt diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index b066e116f7acf1..19f09c2311d941 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -99,7 +99,7 @@ _endef=endef ifeq ($(DUMP),) define BuildTarget/ipkg - ABIV_$(1):=$(if $(filter-out kmod-%,$(1)),$(ABI_VERSION)) + ABIV_$(1):=$(call FormatABISuffix,$(1),$(ABI_VERSION)) PDIR_$(1):=$(call FeedPackageDir,$(1)) IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) diff --git a/include/package.mk b/include/package.mk index fc1bb7d67ef0d1..db0a869dab62b9 100644 --- a/include/package.mk +++ b/include/package.mk @@ -223,7 +223,7 @@ define Build/CoreTargets $(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG) $(STAMP_INSTALLED): $(STAMP_BUILT) rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME) - mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages + mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages $(foreach hook,$(Hooks/InstallDev/Pre),\ $(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\ ) @@ -342,9 +342,9 @@ clean-build: $(if $(wildcard $(PKG_BUILD_DIR)/.autoremove),force-clean-build) clean: force-clean-build $(CleanStaging) - $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST)) + $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR)/host) $(Build/Clean) - rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) $(STAGING_DIR_HOST)/packages/$(STAGING_FILES_LIST) + rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) dist: $(Build/Dist) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 639d1ad0face54..8fbf6f22c4e535 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -102,9 +102,9 @@ $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \ gpatch --version 2>&1 | grep 'Free Software Foundation', \ patch --version 2>&1 | grep 'Free Software Foundation')) -$(eval $(call SetupHostCommand,diff,Please install diffutils, \ - gdiff --version 2>&1 | grep diff, \ - diff --version 2>&1 | grep diff)) +$(eval $(call SetupHostCommand,diff,Please install GNU diffutils, \ + gdiff --version 2>&1 | grep GNU, \ + diff --version 2>&1 | grep GNU)) $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \ gcp --help 2>&1 | grep 'Copy SOURCE', \ diff --git a/include/shell.sh b/include/shell.sh old mode 100755 new mode 100644 diff --git a/include/target.mk b/include/target.mk index 8b20cda2edb754..c2651e5a59d124 100644 --- a/include/target.mk +++ b/include/target.mk @@ -10,13 +10,22 @@ __target_inc=1 DEVICE_TYPE?=router # Default packages - the really basic set -DEFAULT_PACKAGES:=base-files libc libgcc dropbear mtd uci opkg netifd fstools uclient-fetch logd urandom-seed urngd \ -block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw wget-ssl libustream-openssl ca-certificates \ -default-settings luci luci-app-ddns luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot luci-newapi \ -luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-unblockmusic \ -luci-app-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramfree \ -luci-app-sfe luci-app-nlbwmon luci-app-accesscontrol luci-app-cpufreq \ -ddns-scripts_aliyun ddns-scripts_dnspod +DEFAULT_PACKAGES:=\ + base-files \ + ca-bundle \ + dropbear \ + fstools \ + libc \ + libgcc \ + libustream-openssl \ + logd \ + mtd \ + netifd \ + opkg \ + uci \ + uclient-fetch \ + urandom-seed \ + urngd ifneq ($(CONFIG_SELINUX),) DEFAULT_PACKAGES+=busybox-selinux procd-selinux @@ -24,11 +33,28 @@ else DEFAULT_PACKAGES+=busybox procd endif +# For the basic set +DEFAULT_PACKAGES.basic:= # For nas targets -DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm +DEFAULT_PACKAGES.nas:=\ + block-mount \ + fdisk \ + lsblk \ + mdadm # For router targets -DEFAULT_PACKAGES.router:=dnsmasq-full iptables ppp ppp-mod-pppoe firewall -DEFAULT_PACKAGES.bootloader:= +DEFAULT_PACKAGES.router:=\ + dnsmasq-full \ + firewall \ + iptables \ + kmod-ipt-offload \ + ppp \ + ppp-mod-pppoe \ + luci-newapi block-mount coremark kmod-nf-nathelper kmod-nf-nathelper-extra kmod-ipt-raw wget-ssl \ + default-settings luci luci-app-ddns luci-app-upnp luci-app-adbyby-plus luci-app-autoreboot luci-newapi \ + luci-app-filetransfer luci-app-vsftpd luci-app-ssr-plus luci-app-unblockmusic \ + luci-app-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramfree \ + luci-app-flowoffload luci-app-nlbwmon luci-app-accesscontrol luci-app-cpufreq \ + ddns-scripts_aliyun ddns-scripts_dnspod ifneq ($(DUMP),) all: dumpinfo diff --git a/include/u-boot.mk b/include/u-boot.mk index ec9fb15b6ce27d..c0a1e87bf3d61a 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -44,7 +44,8 @@ TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET)) UBOOT_MAKE_FLAGS = \ HOSTCC="$(HOSTCC)" \ HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ - HOSTLDFLAGS="$(HOST_LDFLAGS)" + HOSTLDFLAGS="$(HOST_LDFLAGS)" \ + $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') define Build/U-Boot/Target $(eval $(call U-Boot/Init,$(1))) diff --git a/include/unpack.mk b/include/unpack.mk index 6a56b8e742fd15..ebece69978203d 100644 --- a/include/unpack.mk +++ b/include/unpack.mk @@ -40,7 +40,7 @@ ifeq ($(strip $(UNPACK_CMD)),) UNPACK_CMD=$(DECOMPRESS_CMD) $(TAR_CMD) endif ifeq ($(EXT),cpio) - UNPACK_CMD=$(DECOMPRESS_CMD) (cd $(1)/..; cpio -i -d) + UNPACK_CMD=$(DECOMPRESS_CMD) (cd $(1)/..; $(STAGING_DIR_HOST)/bin/cpio -i -d) endif ifeq ($(EXT),zip) UNPACK_CMD=$(UNZIP_CMD) diff --git a/include/version.mk b/include/version.mk index bbc69081871917..f39e35cd099a7d 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),21.02-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/21.02-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) @@ -105,3 +105,4 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \ -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \ -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \ -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' + diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 89a8551ccd1000..d8d093a3068d0c 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -47,6 +47,7 @@ define Package/base-files/conffiles /etc/config/ /etc/config/network /etc/config/system +/etc/crontabs/ /etc/dropbear/ /etc/ethers /etc/group @@ -108,12 +109,14 @@ ifdef CONFIG_SIGNED_PACKAGES endef +ifndef CONFIG_BUILDBOT define Package/base-files/install-key mkdir -p $(1)/etc/opkg/keys $(CP) $(BUILD_KEY).pub $(1)/etc/opkg/keys/`$(STAGING_DIR_HOST)/bin/usign -F -p $(BUILD_KEY).pub` endef endif +endif ifeq ($(CONFIG_NAND_SUPPORT),) define Package/base-files/nand-support @@ -189,12 +192,19 @@ define Package/base-files/install $(if $(CONFIG_INCLUDE_CONFIG), \ echo -e "# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc/build.config; \ - cat $(BIN_DIR)/config.seed >>$(1)/etc/build.config) + cat $(BIN_DIR)/config.buildinfo >>$(1)/etc/build.config; \ + cat $(BIN_DIR)/feeds.buildinfo >>$(1)/etc/build.feeds; \ + cat $(BIN_DIR)/version.buildinfo >>$(1)/etc/build.version) $(if $(CONFIG_CLEAN_IPKG),, \ mkdir -p $(1)/etc/opkg; \ $(call FeedSourcesAppend,$(1)/etc/opkg/distfeeds.conf); \ $(VERSION_SED_SCRIPT) $(1)/etc/opkg/distfeeds.conf) + $(if $(CONFIG_IPK_FILES_CHECKSUMS),, \ + rm -f $(1)/sbin/pkg_check) + + $(if $(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE), \ + rm -f $(1)/etc/banner.failsafe,) endef ifneq ($(DUMP),1) diff --git a/package/base-files/files/bin/board_detect b/package/base-files/files/bin/board_detect index 840bd0178d1410..94f45bec53a70a 100755 --- a/package/base-files/files/bin/board_detect +++ b/package/base-files/files/bin/board_detect @@ -6,7 +6,7 @@ CFG=$1 [ -d "/etc/board.d/" -a ! -s "$CFG" ] && { for a in $(ls /etc/board.d/*); do - [ -x $a ] || continue; + [ -s $a ] || continue; $(. $a) done } diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index 3cd0b3f60abc35..56f6c4423b342b 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -109,26 +109,17 @@ generate_network() { ports="$ifname" } - [ -n "$ports" -a -z "$bridge" ] && { - uci -q batch <<-EOF - add network device - set network.@device[-1].name='br-$1' - set network.@device[-1].type='bridge' - set network.@device[-1].macaddr='$macaddr' - EOF - for port in $ports; do uci add_list network.@device[-1].ports="$port"; done - ifname=br-$1 - type= - macaddr="" + [ -n "$ports" ] && { + type="bridge" + ifname="$ports" } [ -n "$bridge" ] && { - [ -z "$ports" ] && ports="$ifname" if [ -z "$vlan" ]; then bridge_vlan_id=$((bridge_vlan_id + 1)) vlan=$bridge_vlan_id fi - generate_bridge_vlan $1 $bridge "$ports" $vlan + generate_bridge_vlan $1 $bridge "$ifname" $vlan ifname=$bridge.$vlan type="" } @@ -306,10 +297,10 @@ generate_static_system() { set system.ntp='timeserver' set system.ntp.enabled='1' set system.ntp.enable_server='0' - add_list system.ntp.server='ntp1.aliyun.com' - add_list system.ntp.server='time1.cloud.tencent.com' - add_list system.ntp.server='time.ustc.edu.cn' - add_list system.ntp.server='pool.ntp.org' + add_list system.ntp.server='0.openwrt.pool.ntp.org' + add_list system.ntp.server='1.openwrt.pool.ntp.org' + add_list system.ntp.server='2.openwrt.pool.ntp.org' + add_list system.ntp.server='3.openwrt.pool.ntp.org' EOF if json_is_a system object; then @@ -319,6 +310,13 @@ generate_static_system() { uci -q set "system.@system[-1].hostname=$hostname" fi + local compat_version + if json_get_var compat_version compat_version; then + uci -q set "system.@system[-1].compat_version=$compat_version" + else + uci -q set "system.@system[-1].compat_version=1.0" + fi + if json_is_a ntpserver array; then local keys key json_get_keys keys ntpserver @@ -481,6 +479,8 @@ generate_gpioswitch() { json_init json_load "$(cat ${CFG})" +umask 077 + if [ ! -s /etc/config/network ]; then bridge_name="" touch /etc/config/network diff --git a/package/base-files/files/etc/bench.log b/package/base-files/files/etc/bench.log deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/package/base-files/files/etc/board.d/99-default_network b/package/base-files/files/etc/board.d/99-default_network old mode 100755 new mode 100644 index d70aa352b9214a..49d2a3b3544b07 --- a/package/base-files/files/etc/board.d/99-default_network +++ b/package/base-files/files/etc/board.d/99-default_network @@ -1,4 +1,3 @@ -#!/bin/sh # # Copyright (C) 2013-2015 OpenWrt.org # diff --git a/package/base-files/files/etc/diag.sh b/package/base-files/files/etc/diag.sh old mode 100755 new mode 100644 diff --git a/package/base-files/files/etc/hotplug.d/net/00-sysctl b/package/base-files/files/etc/hotplug.d/net/00-sysctl old mode 100755 new mode 100644 diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 974b68860f68a2..a1e8e828dd2b17 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -33,7 +33,6 @@ boot() { mkdir -p /tmp/resolv.conf.d touch /tmp/resolv.conf.d/resolv.conf.auto ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf - ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf.auto grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index 9a3ac069a20ecb..0beff1608f607c 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -1,4 +1,3 @@ -#!/bin/sh [ -e /tmp/.failsafe ] && export FAILSAFE=1 [ -f /etc/banner ] && cat /etc/banner @@ -13,6 +12,7 @@ export PATH="%PATH%" export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) export HOME=${HOME:-/root} export PS1='\u@\h:\w\$ ' +export ENV=/etc/shinit case "$TERM" in xterm*|rxvt*) @@ -20,16 +20,6 @@ case "$TERM" in ;; esac -[ -x /bin/more ] || alias more=less -[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi - -alias ll='ls -alF --color=auto' - -[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc - -[ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; } -[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } - [ -n "$FAILSAFE" ] || { for FILE in /etc/profile.d/*.sh; do [ -e "$FILE" ] && . "$FILE" @@ -48,12 +38,3 @@ in order to prevent unauthorized SSH logins. -------------------------------------------------- EOF fi - -service() { - [ -f "/etc/init.d/$1" ] || { - echo "service "'"'"$1"'"'" not found, the following services are available:" - ls "/etc/init.d" - return 1 - } - /etc/init.d/$@ -} diff --git a/package/base-files/files/etc/rc.local b/package/base-files/files/etc/rc.local old mode 100755 new mode 100644 diff --git a/package/base-files/files/etc/shinit b/package/base-files/files/etc/shinit old mode 100755 new mode 100644 diff --git a/package/base-files/files/etc/sysctl.d/10-default.conf b/package/base-files/files/etc/sysctl.d/10-default.conf index 46d079b36bf48f..bc8c57969514e6 100644 --- a/package/base-files/files/etc/sysctl.d/10-default.conf +++ b/package/base-files/files/etc/sysctl.d/10-default.conf @@ -8,6 +8,8 @@ fs.suid_dumpable=2 fs.protected_hardlinks=1 fs.protected_symlinks=1 +net.core.bpf_jit_enable=1 + net.ipv4.conf.default.arp_ignore=1 net.ipv4.conf.all.arp_ignore=1 net.ipv4.ip_forward=1 diff --git a/package/base-files/files/etc/uci-defaults/10_migrate-shadow b/package/base-files/files/etc/uci-defaults/10_migrate-shadow old mode 100755 new mode 100644 diff --git a/package/base-files/files/etc/uci-defaults/12_network-generate-ula b/package/base-files/files/etc/uci-defaults/12_network-generate-ula old mode 100755 new mode 100644 diff --git a/package/base-files/files/etc/uci-defaults/13_fix-group-user b/package/base-files/files/etc/uci-defaults/13_fix-group-user old mode 100755 new mode 100644 diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index f528b10ac8cd10..d8604415cc873b 100644 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -69,7 +69,7 @@ config () { local cfgtype="$1" local name="$2" - export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$(($CONFIG_NUM_SECTIONS + 1)) + export ${NO_EXPORT:+-n} CONFIG_NUM_SECTIONS=$((CONFIG_NUM_SECTIONS + 1)) name="${name:-cfg$CONFIG_NUM_SECTIONS}" append CONFIG_SECTIONS "$name" export ${NO_EXPORT:+-n} CONFIG_SECTION="$name" @@ -92,7 +92,7 @@ list() { config_get len "$CONFIG_SECTION" "${varname}_LENGTH" 0 [ $len = 0 ] && append CONFIG_LIST_STATE "${CONFIG_SECTION}_${varname}" - len=$(($len + 1)) + len=$((len + 1)) config_set "$CONFIG_SECTION" "${varname}_ITEM$len" "$value" config_set "$CONFIG_SECTION" "${varname}_LENGTH" "$len" append "CONFIG_${CONFIG_SECTION}_${varname}" "$value" "$LIST_SEP" @@ -106,9 +106,14 @@ config_unset() { # config_get