Skip to content

Commit

Permalink
Merge branch 'bananapi4-nvme-wip' into bananapi4
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Storm committed Dec 20, 2024
2 parents a3e34a6 + fb57e61 commit dbf4246
Show file tree
Hide file tree
Showing 178 changed files with 24,465 additions and 1,264 deletions.
4 changes: 1 addition & 3 deletions config-nstorm-bananapi-bpi-r4
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ CONFIG_BPF_TOOLCHAIN_BUILD_LLVM=y
# CONFIG_BPF_TOOLCHAIN_NONE is not set
CONFIG_BUILD_PATENTED=y
CONFIG_BUSYBOX_CONFIG_ASH_HELP=y
CONFIG_BUSYBOX_CONFIG_ASH_SLEEP=y
CONFIG_BUSYBOX_CONFIG_BLKDISCARD=y
CONFIG_BUSYBOX_CONFIG_BLKID=y
CONFIG_BUSYBOX_CONFIG_BUNZIP2=y
Expand Down Expand Up @@ -648,7 +647,6 @@ CONFIG_PACKAGE_luci-mod-network=y
CONFIG_PACKAGE_luci-mod-rpc=y
CONFIG_PACKAGE_luci-mod-status=y
CONFIG_PACKAGE_luci-mod-system=y
CONFIG_PACKAGE_luci-proto-bonding=y
CONFIG_PACKAGE_luci-proto-external=y
CONFIG_PACKAGE_luci-proto-ipv6=y
CONFIG_PACKAGE_luci-proto-ppp=y
Expand Down Expand Up @@ -767,7 +765,7 @@ CONFIG_USE_LTO=y
CONFIG_USE_MOLD=y
CONFIG_VERSIONOPT=y
CONFIG_VERSION_BUG_URL=""
CONFIG_VERSION_CODE="20241205-r42"
CONFIG_VERSION_CODE="20241220-r43"
CONFIG_VERSION_CODE_FILENAMES=y
CONFIG_VERSION_DIST="OpenWrt"
CONFIG_VERSION_FILENAMES=y
Expand Down
2 changes: 1 addition & 1 deletion config/Config-build.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ menu "Global build settings"

config USE_APK
imply PACKAGE_apk-mbedtls
bool "Use APK instead of OPKG to build distribution (EXPERIMENTAL)"
bool "Use APK instead of OPKG to build distribution"
default y

comment "General build options"
Expand Down
3 changes: 2 additions & 1 deletion feeds.conf.default
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
src-git packages https://git.openwrt.org/feed/packages.git
#src-git luci https://github.com/rmandrad/luci;11be
src-git luci https://github.com/openwrt/luci
#src-git luci https://github.com/openwrt/luci
src-git luci https://git.openwrt.org/project/luci.git
src-git routing https://git.openwrt.org/feed/routing.git
src-git telephony https://git.openwrt.org/feed/telephony.git
#src-git video https://github.com/openwrt/video.git
Expand Down
4 changes: 2 additions & 2 deletions include/feeds.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define FeedSourcesAppendOPKG
echo 'src/gz %d_core %U/targets/%S/packages'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
echo 'src/gz %d_base %U/packages/%A/base'; \
$(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \
$(if $(CONFIG_BUILDBOT), \
echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \
Expand All @@ -51,7 +51,7 @@ define FeedSourcesAppendAPK
echo '%U/targets/%S/packages/packages.adb'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
echo '%U/packages/%A/base/packages.adb'; \
$(if $(filter %SNAPSHOT-y,$(VERSION_NUMBER)-$(CONFIG_BUILDBOT)), \
$(if $(CONFIG_BUILDBOT), \
echo '%U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)/packages.adb';) \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \
Expand Down
8 changes: 6 additions & 2 deletions include/image-commands.mk
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ define Build/fit
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
-A $(LINUX_KARCH) -v $(LINUX_VERSION), gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new
$(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new)
@mv $@.new $@
endef

Expand Down Expand Up @@ -732,6 +732,10 @@ define Build/zip
rm -rf $@.tmp
endef

define Build/zyimage
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
endef

define Build/zyxel-ras-image
let \
newsize="$(call exp_units,$(RAS_ROOTFS_SIZE))"; \
Expand Down
2 changes: 1 addition & 1 deletion include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ ifneq ($(CONFIG_USE_APK),)
rm -rf $(mkfs_cur_target_dir)
$(CP) $(TARGET_DIR_ORIG) $(mkfs_cur_target_dir)
$(if $(mkfs_packages_remove), \
$(apk_target) del $(mkfs_packages_remove))
-$(apk_target) del $(mkfs_packages_remove))
$(if $(mkfs_packages_add), \
$(apk_target) add $(mkfs_packages_add))
else
Expand Down
16 changes: 11 additions & 5 deletions include/meson.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ else
MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
endif

ifeq ($(MESON_USE_STAGING_PYTHON),)
PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/$(PYTHON)
else
PYTHON_BIN:=$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON)
endif

define Meson
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson.py $(1)
$(2) $(PYTHON_BIN) $(STAGING_DIR_HOST)/bin/meson.py $(1)
endef

define Meson/CreateNativeFile
Expand All @@ -65,7 +71,7 @@ define Meson/CreateNativeFile
-e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
-e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
-e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \
Expand All @@ -84,7 +90,7 @@ define Meson/CreateCrossFile
-e "s|@NM@|$(TARGET_NM)|" \
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
-e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
-e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
Expand All @@ -108,7 +114,7 @@ define Host/Configure/Meson
endef

define Host/Compile/Meson
+$(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
+$(MESON_HOST_VARS) $(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1)
endef

define Host/Install/Meson
Expand All @@ -135,7 +141,7 @@ define Build/Configure/Meson
endef

define Build/Compile/Meson
+$(NINJA) -C $(MESON_BUILD_DIR) $(1)
+$(MESON_VARS) $(NINJA) -C $(MESON_BUILD_DIR) $(1)
endef

define Build/Install/Meson
Expand Down
6 changes: 6 additions & 0 deletions include/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ else
endif
endif

# include ujail on systems with enough storage
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))

Expand Down Expand Up @@ -370,6 +375,7 @@ define BuildTargets/DumpCurrent
echo 'Target-Description:'; \
echo "$$$$DESCRIPTION"; \
echo '@@'; \
$(if $(DEFAULT_PROFILE),echo 'Target-Default-Profile: $(DEFAULT_PROFILE)';) \
echo 'Default-Packages: $(DEFAULT_PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES))'; \
$(DUMPINFO)
$(if $(CUR_SUBTARGET),$(SUBMAKE) -r --no-print-directory -C image -s DUMP=1 SUBTARGET=$(CUR_SUBTARGET))
Expand Down
17 changes: 1 addition & 16 deletions include/toplevel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,7 @@ endif

_ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p))

# Config that will invalidate the .targetinfo as they will affect
# DEFAULT_PACKAGES.
# Keep DYNAMIC_DEF_PKG_CONF in sync with target.mk to reflect the same configs
DYNAMIC_DEF_PKG_CONF := CONFIG_USE_APK CONFIG_SELINUX CONFIG_SMALL_FLASH CONFIG_USE_SECCOMP
check-dynamic-def-pkg: FORCE
@+DEF_PKG_CONFS=""; \
if [ -f $(TOPDIR)/.config ]; then \
for config in $(DYNAMIC_DEF_PKG_CONF); do \
DEF_PKG_CONFS="$$DEF_PKG_CONFS "$$(grep "$$config"=y $(TOPDIR)/.config); \
done; \
fi; \
[ ! -f tmp/.packagedynamicdefault ] || OLD_DEF_PKG_CONFS=$$(cat tmp/.packagedynamicdefault); \
[ "$$DEF_PKG_CONFS" = "$$OLD_DEF_PKG_CONFS" ] || rm -rf tmp/info/.targetinfo*; \
mkdir -p tmp && echo "$$DEF_PKG_CONFS" > tmp/.packagedynamicdefault;

prepare-tmpinfo: check-dynamic-def-pkg FORCE
prepare-tmpinfo: FORCE
@+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK)
mkdir -p tmp/info feeds
[ -e $(TOPDIR)/feeds/base ] || ln -sf $(TOPDIR)/package $(TOPDIR)/feeds/base
Expand Down
2 changes: 1 addition & 1 deletion package/base-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ define Package/base-files
+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring \
+NAND_SUPPORT:ubi-utils +fstools +fwtool \
+SELINUX:procd-selinux +!SELINUX:procd +USE_SECCOMP:procd-seccomp \
+SELINUX:busybox-selinux +!SELINUX:busybox +!SMALL_FLASH:procd-ujail
+SELINUX:busybox-selinux +!SELINUX:busybox
TITLE:=Base filesystem for OpenWrt
URL:=http://openwrt.org/
VERSION:=$(PKG_RELEASE)~$(lastword $(subst -, ,$(REVISION)))
Expand Down
28 changes: 28 additions & 0 deletions package/base-files/files/etc/init.d/led
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

START=96

extra_command "turnon" "Put the LEDs into their default state"
extra_command "turnoff" "Turn all LEDs off"
extra_command "blink" "Blink all LEDs"

led_color_set() {
local cfg="$1"
local sysfs="$2"
Expand Down Expand Up @@ -168,7 +172,31 @@ load_led() {
}
}

turnoff() {
for led in `ls /sys/class/leds/`; do
echo 0 > /sys/class/leds/$led/brightness
done
}

turnon() {
turnoff
. /etc/diag.sh
set_state done
start
}

blink() {
for led in `ls /sys/class/leds/`; do
echo 0 > /sys/class/leds/$led/brightness
echo timer > /sys/class/leds/$led/trigger
done
}

start() {
[ "$(uci -q get system.@system[-1].leds_off)" = '1' ] && {
turnoff
exit 0
}
[ -e /sys/class/leds/ ] && {
[ -s /var/run/led.state ] && {
local led trigger brightness color
Expand Down
21 changes: 21 additions & 0 deletions package/base-files/files/etc/profile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,24 @@ in order to prevent unauthorized SSH logins.
--------------------------------------------------
EOF
fi

if [ -x /usr/bin/apk ]; then
cat << EOF
OpenWrt recently switched to the "apk" package manager!
OPKG Command APK Equivalent Description
------------------------------------------------------------------
opkg install <pkg> apk add <pkg> Install a package
opkg remove <pkg> apk del <pkg> Remove a package
opkg upgrade apk upgrade Upgrade all packages
opkg files <pkg> apk info -L <pkg> List package contents
opkg list-installed apk info List installed packages
opkg update apk update Update package lists
opkg search <pkg> apk search <pkg> Search for packages
------------------------------------------------------------------
For more https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet
EOF
fi
2 changes: 1 addition & 1 deletion package/base-files/files/etc/rc.button/reset
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ released)
elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
then
echo "FACTORY RESET" > /dev/console
jffs2reset -y && reboot &
factoryreset -y && reboot &
fi
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion package/base-files/files/sbin/firstboot
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

/sbin/jffs2reset $@
/sbin/factoryreset $@
11 changes: 11 additions & 0 deletions package/boot/arm-trusted-firmware-mediatek/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,15 @@ define Trusted-Firmware-A/mt7986-spim-nand-ddr3
DDR_TYPE:=ddr3
endef

define Trusted-Firmware-A/mt7986-spim-nand-ubi-ddr3
NAME:=MediaTek MT7986 (SPI-NAND via SPIM using UBI, DDR3)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr3
USE_UBI:=1
endef

define Trusted-Firmware-A/mt7988-nor-ddr3
NAME:=MediaTek MT7988 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
Expand Down Expand Up @@ -531,6 +540,7 @@ TFA_TARGETS:= \
mt7986-sdmmc-ddr3 \
mt7986-snand-ddr3 \
mt7986-spim-nand-ddr3 \
mt7986-spim-nand-ubi-ddr3 \
mt7986-ram-ddr4 \
mt7986-emmc-ddr4 \
mt7986-nor-ddr4 \
Expand Down Expand Up @@ -570,6 +580,7 @@ TFA_MAKE_FLAGS += \
$(if $(RAM_BOOT_UART_DL),RAM_BOOT_UART_DL=1) \
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7622,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x80000)) \
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7981,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x100000)) \
$(if $(USE_UBI),UBI=1 $(if $(findstring mt7986,$(PLAT)),OVERRIDE_UBI_START_ADDR=0x200000)) \
$(if $(RAM_BOOT_UART_DL),bl2,all)

define Package/trusted-firmware-a-ram/install
Expand Down
1 change: 1 addition & 0 deletions package/boot/uboot-envtools/files/mediatek_filogic
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ case "$board" in
abt,asr3000|\
h3c,magic-nx30-pro|\
jcg,q30-pro|\
mercusys,mr90x-v1-ubi|\
netcore,n60|\
nokia,ea0326gmp|\
qihoo,360t7|\
Expand Down
13 changes: 13 additions & 0 deletions package/boot/uboot-mediatek/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,18 @@ define U-Boot/mt7986_jdcloud_re-cp-03
DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4
endef

define U-Boot/mt7986_mercusys_mr90x-v1
NAME:=MERCUSYS MR90X v1
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=mercusys_mr90x-v1-ubi
UBOOT_CONFIG:=mt7986_mercusys_mr90x-v1
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=spim-nand-ubi
BL2_SOC:=mt7986
BL2_DDRTYPE:=ddr3
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ubi-ddr3
endef

define U-Boot/mt7986_netcore_n60
NAME:=Netcore N60
BUILD_SUBTARGET:=filogic
Expand Down Expand Up @@ -847,6 +859,7 @@ UBOOT_TARGETS := \
mt7986_bananapi_bpi-r3-mini-snand \
mt7986_glinet_gl-mt6000 \
mt7986_jdcloud_re-cp-03 \
mt7986_mercusys_mr90x-v1 \
mt7986_netcore_n60 \
mt7986_tplink_tl-xdr4288 \
mt7986_tplink_tl-xdr6086 \
Expand Down
6 changes: 4 additions & 2 deletions package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
+CONFIG_LMB_MAX_REGIONS=64
--- /dev/null
+++ b/openwrt-one-nor_env
@@ -0,0 +1,47 @@
@@ -0,0 +1,48 @@
+ethaddr_factory=mtd read factory 0x46000000 0x0 0x20000 && env readmem -b ethaddr 0x4600002a 0x6 ; setenv ethaddr_factory
+bl2_mtd_write=mtd erase bl2-nor && mtd write bl2-nor $loadaddr 0x0 0x40000
+bl2_tftp_write=tftpboot $loadaddr $bootfile_bl2_nor && run bl2_mtd_write
Expand Down Expand Up @@ -510,6 +510,7 @@
+serverip=192.168.11.23
+tftp_boot=run led_start ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
+tftp_write=run led_start ; tftpboot $loadaddr $bootfile && mtd erase recovery 0x0 ${filesize} && mtd write recovery $loadaddr 0x0 ${filesize}
+usb_pgood_delay=4000
+usb_recovery=run led_start ; usb start && run usb_recovery_bl2 && run usb_recovery_ubi && run led_loop_done
+usb_recovery_bl2=fatload usb 0:1 ${loadaddr} ${recoverfile_bl2} && run recovery_write_bl2
+usb_recovery_ubi=fatload usb 0:1 ${loadaddr} ${recoverfile_ubi} && run recovery_write_ubi
Expand All @@ -519,7 +520,7 @@
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"
--- /dev/null
+++ b/openwrt-one-spi-nand_env
@@ -0,0 +1,60 @@
@@ -0,0 +1,61 @@
+ethaddr_factory=mtd read factory 0x46000000 0x0 0x20000 && env readmem -b ethaddr 0x4600002a 0x6 ; setenv ethaddr_factory
+ipaddr=192.168.11.11
+serverip=192.168.11.23
Expand Down Expand Up @@ -571,6 +572,7 @@
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
+usb_pgood_delay=4000
+usb_recover=run led_start ; usb start && run usb_recover_production && run led_loop_done
+usb_recover_production=fatload usb 0:1 ${loadaddr} ${bootfile_upg} && iminfo $loadaddr && run ubi_write_production
+ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip $filesize static && ubi write $loadaddr fip $filesize
Expand Down
Loading

0 comments on commit dbf4246

Please sign in to comment.