diff --git a/include/image.mk b/include/image.mk index 12654931cd..88d80e72e5 100644 --- a/include/image.mk +++ b/include/image.mk @@ -472,7 +472,8 @@ 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)) + $$(_TARGET): $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) \ + $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,)) $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE) @@ -481,6 +482,38 @@ define Device/Build/initramfs $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare @rm -f $$@ $$(call concat_cmd,$$(KERNEL_INITRAMFS)) + + $(call Device/Export,$(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,$(1)) + + $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE) + @mkdir -p $$(shell dirname $$@) + DEVICE_ID="$(1)" \ + BIN_DIR="$(BIN_DIR)" \ + SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \ + IMAGE_NAME="$$(notdir $$^)" \ + IMAGE_TYPE="kernel" \ + IMAGE_FILESYSTEM="initramfs" \ + IMAGE_PREFIX="$$(IMAGE_PREFIX)" \ + DEVICE_VENDOR="$$(DEVICE_VENDOR)" \ + DEVICE_MODEL="$$(DEVICE_MODEL)" \ + DEVICE_VARIANT="$$(DEVICE_VARIANT)" \ + DEVICE_ALT0_VENDOR="$$(DEVICE_ALT0_VENDOR)" \ + DEVICE_ALT0_MODEL="$$(DEVICE_ALT0_MODEL)" \ + DEVICE_ALT0_VARIANT="$$(DEVICE_ALT0_VARIANT)" \ + DEVICE_ALT1_VENDOR="$$(DEVICE_ALT1_VENDOR)" \ + DEVICE_ALT1_MODEL="$$(DEVICE_ALT1_MODEL)" \ + DEVICE_ALT1_VARIANT="$$(DEVICE_ALT1_VARIANT)" \ + DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \ + DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \ + DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \ + DEVICE_TITLE="$$(DEVICE_TITLE)" \ + DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \ + TARGET="$(BOARD)" \ + SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \ + VERSION_NUMBER="$(VERSION_NUMBER)" \ + VERSION_CODE="$(VERSION_CODE)" \ + SUPPORTED_DEVICES="$$(SUPPORTED_DEVICES)" \ + $(TOPDIR)/scripts/json_add_image_info.py $$@ endef endif diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index 5b17555da8..e41a40e0e9 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -40,7 +40,7 @@ generate_static_network() { uci -q batch <<-EOF delete network.loopback set network.loopback='interface' - set network.loopback.ifname='lo' + set network.loopback.device='lo' set network.loopback.proto='static' set network.loopback.ipaddr='127.0.0.1' set network.loopback.netmask='255.0.0.0' @@ -91,36 +91,45 @@ generate_static_network() { addr_offset=2 generate_network() { - local ports ifname macaddr protocol type ipaddr netmask vlan + local ports device macaddr protocol type ipaddr netmask vlan local bridge=$2 json_select network json_select "$1" + json_get_vars device macaddr protocol ipaddr netmask vlan json_get_values ports ports - json_get_vars ifname macaddr protocol ipaddr netmask vlan json_select .. json_select .. - [ -n "$ifname" -o -n "$ports" ] || return + [ -n "$device" -o -n "$ports" ] || return # Force bridge for "lan" as it may have other devices (e.g. wireless) # bridged [ "$1" = "lan" -a -z "$ports" ] && { - ports="$ifname" + ports="$device" } - [ -n "$ports" ] && { - type="bridge" - ifname="$ports" + [ -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 + device=br-$1 + type= + macaddr="" } [ -n "$bridge" ] && { + [ -z "$ports" ] && ports="$device" if [ -z "$vlan" ]; then bridge_vlan_id=$((bridge_vlan_id + 1)) vlan=$bridge_vlan_id fi - generate_bridge_vlan $1 $bridge "$ifname" $vlan - ifname=$bridge.$vlan + generate_bridge_vlan $1 $bridge "$ports" $vlan + device=$bridge.$vlan type="" } @@ -128,12 +137,12 @@ generate_network() { delete network.$1 set network.$1='interface' set network.$1.type='$type' - set network.$1.ifname='$ifname' + set network.$1.device='$device' set network.$1.proto='none' EOF if [ -n "$macaddr" ]; then - for name in $ifname; do + for name in $device; do uci -q batch <<-EOF delete network.$1_${name/./_}_dev set network.$1_${name/./_}_dev='device' @@ -163,14 +172,14 @@ generate_network() { dhcp) # fixup IPv6 slave interface if parent is a bridge - [ "$type" = "bridge" ] && ifname="br-$1" + [ "$type" = "bridge" ] && device="br-$1" uci set network.$1.proto='dhcp' [ -e /proc/sys/net/ipv6 ] && { uci -q batch <<-EOF delete network.${1}6 set network.${1}6='interface' - set network.${1}6.ifname='$ifname' + set network.${1}6.device='$device' set network.${1}6.proto='dhcpv6' EOF } @@ -187,7 +196,7 @@ generate_network() { set network.$1.ipv6='1' delete network.${1}6 set network.${1}6='interface' - set network.${1}6.ifname='@${1}' + set network.${1}6.device='@${1}' set network.${1}6.proto='dhcpv6' EOF } diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 407a9c710f..02882f43ca 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -39,7 +39,7 @@ ucidef_set_interface() { [ -n "$opt" -a -n "$val" ] || break - [ "$opt" = "ifname" -a "$val" != "${val/ //}" ] && { + [ "$opt" = "device" -a "$val" != "${val/ //}" ] && { json_select_array "ports" for e in $val; do json_add_string "" "$e"; done json_close_array @@ -79,11 +79,11 @@ ucidef_set_compat_version() { } ucidef_set_interface_lan() { - ucidef_set_interface "lan" ifname "$1" protocol "${2:-static}" + ucidef_set_interface "lan" device "$1" protocol "${2:-static}" } ucidef_set_interface_wan() { - ucidef_set_interface "wan" ifname "$1" protocol "${2:-dhcp}" + ucidef_set_interface "wan" device "$1" protocol "${2:-dhcp}" } ucidef_set_interfaces_lan_wan() { @@ -201,14 +201,14 @@ _ucidef_finish_switch_roles() { json_select_object "$role" # attach previous interfaces (for multi-switch devices) - json_get_var devices ifname + json_get_var devices device if ! list_contains devices "$device"; then devices="${devices:+$devices }$device" fi json_select .. json_select .. - ucidef_set_interface "$role" ifname "$devices" + ucidef_set_interface "$role" device "$devices" done } diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 475a154fa3..7ac042e9f7 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -1,15 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later # -# Copyright (C) 2006-2020 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# +# Copyright (C) 2006-2021 OpenWrt.org include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.33.1 -PKG_RELEASE:=1 +PKG_RELEASE:=$(AUTORELEASE) PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -84,10 +81,6 @@ endef Package/busybox-selinux/conffiles = $(Package/busybox/conffiles) endif -# don't create a version string containing the actual timestamp -export KCONFIG_NOTIMESTAMP=1 - - ifndef CONFIG_USE_MUSL LDLIBS:=m crypt endif diff --git a/package/utils/busybox/patches/530-use-SOURCE_DATE_EPOCH-for-timestamp-if-available.patch b/package/utils/busybox/patches/530-use-SOURCE_DATE_EPOCH-for-timestamp-if-available.patch new file mode 100644 index 0000000000..af473622ed --- /dev/null +++ b/package/utils/busybox/patches/530-use-SOURCE_DATE_EPOCH-for-timestamp-if-available.patch @@ -0,0 +1,80 @@ +From 59f773ee81a8945321f4aa20abc5e9577e6483e4 Mon Sep 17 00:00:00 2001 +From: Paul Spooren +Date: Thu, 13 May 2021 11:25:34 +0200 +Subject: [PATCH] use SOURCE_DATE_EPOCH for timestamp if available + +The SOURCE_DATE_EPOCH is an effort of the Reproducible Builds +organization to make timestamps/build dates in compiled tools +deterministic over several repetitive builds. + +Busybox shows by default the build date timestamp which changes whenever +compiled. To have a reasonable accurate build date while staying +reproducible, it's possible to use the *date of last source +modification* rather than the current time and date. + +Further information on SOURCE_DATE_EPOCH are available online [1]. + +This patch modifies `confdata.c` so that the content of the +SOURCE_DATE_EPOCH env variable is used as timestamp. + +To be independent of different timezones between builds, whenever +SOURCE_DATE_EPOCH is defined the GMT time is used. + +[1]: https://reproducible-builds.org/docs/source-date-epoch/ + +Signed-off-by: Paul Spooren +--- + scripts/kconfig/confdata.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c +index b05b96e45..73c25e3a8 100644 +--- a/scripts/kconfig/confdata.c ++++ b/scripts/kconfig/confdata.c +@@ -342,6 +342,8 @@ int conf_write(const char *name) + time_t now; + int use_timestamp = 1; + char *env; ++ char *source_date_epoch; ++ struct tm *build_time; + + dirname[0] = 0; + if (name && name[0]) { +@@ -378,7 +380,16 @@ int conf_write(const char *name) + } + sym = sym_lookup("KERNELVERSION", 0); + sym_calc_value(sym); +- time(&now); ++ ++ source_date_epoch = getenv("SOURCE_DATE_EPOCH"); ++ if (source_date_epoch && *source_date_epoch) { ++ now = strtoull(source_date_epoch, NULL, 10); ++ build_time = gmtime(&now); ++ } else { ++ time(&now); ++ build_time = localtime(&now); ++ } ++ + env = getenv("KCONFIG_NOTIMESTAMP"); + if (env && *env) + use_timestamp = 0; +@@ -398,14 +409,14 @@ int conf_write(const char *name) + if (use_timestamp) { + size_t ret = \ + strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " +- "\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now)); ++ "\"%Y-%m-%d %H:%M:%S %Z\"\n", build_time); + /* if user has Factory timezone or some other odd install, the + * %Z above will overflow the string leaving us with undefined + * results ... so let's try again without the timezone. + */ + if (ret == 0) + strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " +- "\"%Y-%m-%d %H:%M:%S\"\n", localtime(&now)); ++ "\"%Y-%m-%d %H:%M:%S\"\n", build_time); + } else { /* bbox */ + strcpy(buf, "#define AUTOCONF_TIMESTAMP \"\"\n"); + } +-- +2.30.2 + diff --git a/target/linux/arc770/image/Makefile b/target/linux/arc770/image/Makefile index 172eb06744..4cb9364ef3 100644 --- a/target/linux/arc770/image/Makefile +++ b/target/linux/arc770/image/Makefile @@ -24,6 +24,8 @@ endef define Device/nsim $(call Device/vmlinux) + DEVICE_VENDOR := Synopsys + DEVICE_MODEL := nSIM DEVICE_PROFILE := nsim DEVICE_DTS := nsim_700 endef diff --git a/target/linux/archs38/image/Makefile b/target/linux/archs38/image/Makefile index e8cfb63ce1..1d0beca27f 100644 --- a/target/linux/archs38/image/Makefile +++ b/target/linux/archs38/image/Makefile @@ -24,6 +24,8 @@ endef define Device/nsim_hs $(call Device/vmlinux) + DEVICE_VENDOR := Synopsys + DEVICE_MODEL := nSIM HS DEVICE_PROFILE := nsim_hs DEVICE_DTS := nsim_hs_idu endef diff --git a/target/linux/gemini/base-files/etc/board.d/02_network b/target/linux/gemini/base-files/etc/board.d/02_network index f371956a66..9e80fee758 100755 --- a/target/linux/gemini/base-files/etc/board.d/02_network +++ b/target/linux/gemini/base-files/etc/board.d/02_network @@ -7,17 +7,17 @@ board_config_update case "$(board_name)" in dlink,dir-685) # These are all connected to eth0 thru RTL8366RB - ucidef_set_interface "eth" ifname "eth0" protocol "none" + ucidef_set_interface "eth" device "eth0" protocol "none" ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan" ;; itian,sq201) # These are all connected to eth1 thru VSC7395 - ucidef_set_interface "eth" ifname "eth1" protocol "none" + ucidef_set_interface "eth" device "eth1" protocol "none" ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0" ;; storlink,gemini324) # These are all connected to eth1 thru VSC7385 - ucidef_set_interface "eth" ifname "eth1" protocol "none" + ucidef_set_interface "eth" device "eth1" protocol "none" ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth0" ;; esac diff --git a/target/linux/ipq806x/base-files/etc/init.d/cpufreq b/target/linux/ipq806x/base-files/etc/init.d/cpufreq new file mode 100755 index 0000000000..19278902ed --- /dev/null +++ b/target/linux/ipq806x/base-files/etc/init.d/cpufreq @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common + +START=15 + +boot() { + local governor + + governor=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor) + + if [ "$governor" = "ondemand" ]; then + # Effective only with ondemand + echo 600000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq + echo 600000 > /sys/devices/system/cpu/cpufreq/policy1/scaling_min_freq + echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor + echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold + fi +} diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 2568fd2e0e..45ab84ee9e 100755 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -24,7 +24,7 @@ for lan in /sys/class/net/lan*; do done ucidef_set_bridge_device switch ucidef_set_interface_wan "$lan_list" -ucidef_set_interface "lan" ifname "lan1:t" protocol "static" vlan 100 +ucidef_set_interface "lan" device "lan1:t" protocol "static" vlan 100 lan_mac="" wan_mac=""