添加CoreBoard-001支持:

1.修改厂商名为HYH/hyh,修改产品名称为CoreBoard-001/coreboard-001.
2.添加DS1307的设备树支持。
3.将WLAN灯改为系统灯。
4.仅启用WAN(网口0)、LAN(网口1),其余网口不启用。
This commit is contained in:
HEYAHONG 2024-05-01 11:39:13 +08:00
parent c5122cfe2d
commit e68e007f57
No known key found for this signature in database
GPG Key ID: 97E3E469FE2C920B
6 changed files with 255 additions and 3 deletions

View File

@ -37,6 +37,7 @@ GitVersion = $(shell git rev-parse --short HEAD 2>/dev/null)
prepare: openwrt/Makefile openwrt/feeds/ openwrt/.config
${Q}-openwrt_path_patch 2>/dev/null #若处在HEnvBox中尝试修改源代码保存路径
${Q}./local_patch #安装本地补丁
${Q}# 更新版本号
${Q}echo "GitDate=${GitDate},GitVerison=${GitVersion}"
${Q}sed -i "s/CONFIG_VERSION_NUMBER=.*/CONFIG_VERSION_NUMBER=\"${GitDate}\"/g" openwrt/.config

View File

@ -8,6 +8,8 @@
- MacOS
- Windows(WSL):在Windows下仅支持在WSL中编译。
注意由于本固件修改了设备树dts中的设备名称故第一次从HLK-7688A原厂固件升级时需要勾选强制升级。
# 常用操作
## 编译

View File

@ -74,7 +74,8 @@ CONFIG_TARGET_ramips_mt76x8=y
# CONFIG_TARGET_ramips_mt76x8_DEVICE_glinet_vixmini is not set
# CONFIG_TARGET_ramips_mt76x8_DEVICE_hak5_wifi-pineapple-mk7 is not set
# CONFIG_TARGET_ramips_mt76x8_DEVICE_hilink_hlk-7628n is not set
CONFIG_TARGET_ramips_mt76x8_DEVICE_hilink_hlk-7688a=y
# CONFIG_TARGET_ramips_mt76x8_DEVICE_hilink_hlk-7688a is not set
CONFIG_TARGET_ramips_mt76x8_DEVICE_hyh_coreboard-001=y
# CONFIG_TARGET_ramips_mt76x8_DEVICE_hiwifi_hc5611 is not set
# CONFIG_TARGET_ramips_mt76x8_DEVICE_hiwifi_hc5661a is not set
# CONFIG_TARGET_ramips_mt76x8_DEVICE_hiwifi_hc5761a is not set
@ -154,7 +155,7 @@ CONFIG_HAS_SUBTARGETS=y
CONFIG_HAS_DEVICES=y
CONFIG_TARGET_BOARD="ramips"
CONFIG_TARGET_SUBTARGET="mt76x8"
CONFIG_TARGET_PROFILE="DEVICE_hilink_hlk-7688a"
CONFIG_TARGET_PROFILE="DEVICE_hyh_coreboard-001"
CONFIG_TARGET_ARCH_PACKAGES="mipsel_24kc"
CONFIG_DEFAULT_TARGET_OPTIMIZATION="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc"
CONFIG_CPU_TYPE="24kc"
@ -168,9 +169,11 @@ CONFIG_DEFAULT_firewall4=y
CONFIG_DEFAULT_fstools=y
CONFIG_DEFAULT_iwinfo=y
CONFIG_DEFAULT_kmod-gpio-button-hotplug=y
CONFIG_DEFAULT_kmod-i2c-mt7628=y
CONFIG_DEFAULT_kmod-leds-gpio=y
CONFIG_DEFAULT_kmod-mt7603=y
CONFIG_DEFAULT_kmod-nft-offload=y
CONFIG_DEFAULT_kmod-rtc-ds1307=y
CONFIG_DEFAULT_kmod-usb-ledtrig-usbport=y
CONFIG_DEFAULT_kmod-usb-ohci=y
CONFIG_DEFAULT_kmod-usb2=y
@ -521,7 +524,7 @@ CONFIG_TARGET_INIT_SUPPRESS_STDERR=y
CONFIG_VERSIONOPT=y
CONFIG_VERSION_DIST="OpenWrt"
CONFIG_VERSION_NUMBER="2024-04-30"
CONFIG_VERSION_CODE="9161823"
CONFIG_VERSION_CODE="c5122cf"
CONFIG_VERSION_REPO="https://downloads.openwrt.org/releases/23.05-SNAPSHOT"
CONFIG_VERSION_HOME_URL=""
CONFIG_VERSION_MANUFACTURER="HYH"

57
FW/openwrt-23.05/local_patch Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
# shellcheck disable=SC2128 # ignore array expansion warning
if [ -n "${BASH_SOURCE-}" ]
then
self_path="${BASH_SOURCE}"
elif [ -n "${ZSH_VERSION-}" ]
then
self_path="${(%):-%x}"
else
exit 1
fi
# shellcheck disable=SC2169,SC2169,SC2039 # unreachable with 'dash'
if [[ "$OSTYPE" == "darwin"* ]]; then
# convert possibly relative path to absolute
script_dir="$(realpath_int "${self_path}")"
# resolve any ../ references to make the path shorter
script_dir="$(cd "${script_dir}" || exit 1; pwd)"
else
# convert to full path and get the directory name of that
script_name="$(readlink -f "${self_path}")"
script_dir="$(dirname "${script_name}")"
fi
#参数1为补丁路径参数二为戳路径参数2为sha256sum输出结果
function patch_diff()
{
echo apply patch "${3}"
patch -p1 -d "${script_dir}/openwrt" < "${1}"
if [ "$?" -eq "0" ]
then
echo -n "${3}" > "${2}"
fi
}
pushd "${script_dir}" > /dev/null
for patch_file in `find local_patch.d -name "*.diff"`
do
patch_file_path=`realpath "${patch_file}"`
patch_file_stamp="${patch_file_path}.stamp"
patch_file_sha256sum=`sha256sum "${patch_file_path}"`
if [ -f ${patch_file_stamp} ]
then
if [ "${patch_file_sha256sum}" != "`cat "${patch_file_stamp}"`" ]
then
patch_diff "${patch_file_path}" "${patch_file_stamp}" "${patch_file_sha256sum}"
else
echo "${patch_file_path}" has been patched!
fi
else
patch_diff "${patch_file_path}" "${patch_file_stamp}" "${patch_file_sha256sum}"
fi
done
popd > /dev/null

View File

@ -0,0 +1 @@
*.stamp

View File

@ -0,0 +1,188 @@
diff --git a/target/linux/ramips/dts/mt7628an_hyh_coreboard-001.dts b/target/linux/ramips/dts/mt7628an_hyh_coreboard-001.dts
new file mode 100644
index 0000000000..03953b2dea
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_hyh_coreboard-001.dts
@@ -0,0 +1,134 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7628an.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "hyh,coreboard-001","hilink,hlk-7688a", "mediatek,mt7628an-soc";
+ model = "HYH CoreBoard-001";
+
+ aliases {
+ led-boot = &led_sys;
+ led-failsafe = &led_sys;
+ led-upgrade = &led_sys;
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ gpios = <&gpio 38 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_sys: sys {
+ label = "sys";
+ gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "heartbeat";
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "wdt", "wled_an";
+ function = "gpio";
+ };
+};
+
+&uart1 {
+ status = "okay";
+};
+
+&i2c {
+ status = "okay";
+ ds1307: rtc@68 {
+ compatible = "dallas,ds1307";
+ reg = <0x68>;
+ };
+
+};
+
+&spi0 {
+ status = "okay";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <40000000>;
+ broken-flash-reset;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x30000>;
+ read-only;
+ };
+
+ partition@30000 {
+ label = "u-boot-env";
+ reg = <0x30000 0x10000>;
+ read-only;
+ };
+
+ factory: partition@40000 {
+ label = "factory";
+ reg = <0x40000 0x10000>;
+ read-only;
+ };
+
+ partition@50000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x50000 0x1fb0000>;
+ };
+ };
+ };
+
+ spidev@1 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "linux,spidev";
+ reg = <1>;
+ spi-max-frequency = <40000000>;
+ };
+};
+
+&ethernet {
+ nvmem-cells = <&macaddr_factory_28>;
+ nvmem-cell-names = "mac-address";
+};
+
+&esw {
+ mediatek,portmap = <0x3e>;
+};
+
+&wmac {
+ status = "okay";
+
+ mediatek,mtd-eeprom = <&factory 0x0>;
+};
+
+&factory {
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ macaddr_factory_28: macaddr@28 {
+ reg = <0x28 0x6>;
+ };
+};
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 816009ac18..b78793a589 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -246,6 +246,14 @@ define Device/hilink_hlk-7688a
endef
TARGET_DEVICES += hilink_hlk-7688a
+define Device/hyh_coreboard-001
+ IMAGE_SIZE := 32448k
+ DEVICE_VENDOR := HYH
+ DEVICE_MODEL := CoreBoard-001
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport kmod-i2c-mt7628 kmod-rtc-ds1307
+endef
+TARGET_DEVICES += hyh_coreboard-001
+
define Device/hiwifi_hc5611
IMAGE_SIZE := 15808k
DEVICE_VENDOR := HiWiFi
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
index 792bd13ebc..8d211fc638 100644
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
@@ -46,6 +46,9 @@ skylab,skw92a)
hilink,hlk-7688a)
ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
;;
+hyh,coreboard-001)
+ ucidef_set_led_heartbeat "sys" "SYS" "sys"
+ ;;
hiwifi,hc5611)
ucidef_set_led_netdev "internet" "internet" "red:internet" "br-lan" "tx rx"
;;
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
index 6bcdea971b..448049415a 100644
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
@@ -60,6 +60,10 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
+ hyh,coreboard-001)
+ ucidef_add_switch "switch0" \
+ "1:lan" "0:wan" "6@eth0"
+ ;;
asus,rt-n10p-v3|\
asus,rt-n11p-b1|\
asus,rt-n12-vp-b1|\