nanako
This commit is contained in:
parent
7560af7647
commit
b74c4497b4
517
build_openwrt.sh
Executable file
517
build_openwrt.sh
Executable file
@ -0,0 +1,517 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#====================================================
|
||||
# OpenWrt 构建管理脚本
|
||||
# 功能:提供交互式菜单,可选择执行特定操作
|
||||
# 更新:2024-02-26
|
||||
#====================================================
|
||||
|
||||
#---------------基础配置---------------#
|
||||
# 日志目录设置
|
||||
LOGS_ROOT="openwrt_logs"
|
||||
SESSION_DIR="${LOGS_ROOT}/$(date +%Y%m%d_%H%M%S)"
|
||||
LOG_FILE="${SESSION_DIR}/build.log"
|
||||
|
||||
#---------------清理配置---------------#
|
||||
# 需要移除的目录列表
|
||||
declare -a REMOVE_DIRS=(
|
||||
)
|
||||
|
||||
# 需要移除的包列表
|
||||
declare -a REMOVE_PACKAGES=(
|
||||
"feeds/luci/applications/luci-app-mosdns"
|
||||
"feeds/packages/net/alist"
|
||||
"feeds/packages/net/adguardhome"
|
||||
"feeds/packages/net/smartdns"
|
||||
)
|
||||
|
||||
#---------------自定义包配置---------------#
|
||||
# 定义自定义包配置,格式:[包名]=[目标目录]=[仓库URL]=[分支]=[是否使用--depth 1]
|
||||
declare -A CUSTOM_PACKAGES=(
|
||||
["golang"]="feeds/packages/lang/golang=https://github.com/kenzok8/golang=main=true"
|
||||
["partexp"]="package/luci-app-partexp=https://github.com/sirpdboy/luci-app-partexp=main=false"
|
||||
["openclash"]="package/openclash=https://github.com/vernesong/OpenClash=dev=true"
|
||||
["zerotier"]="package/luci-app-zerotier=https://github.com/mmc1987/luci-app-zerotier.git=main=false"
|
||||
["5gsupport"]="package/openwrt-app-actions=https://github.com/Siriling/openwrt-app-actions.git=main=true"
|
||||
["kucat"]="package/luci-theme-kucat=https://github.com/sirpdboy/luci-theme-kucat.git=main=false"
|
||||
["mt76"]="package/firmware/mt76=https://github.com/openwrt/mt76.git=master=false"
|
||||
)
|
||||
|
||||
#---------------日志系统---------------#
|
||||
# 保存原始的标准输出和错误输出
|
||||
exec {STDOUT_ORIG}>&1
|
||||
exec {STDERR_ORIG}>&2
|
||||
|
||||
# 初始化日志系统
|
||||
init_logger() {
|
||||
# 创建日志目录结构
|
||||
mkdir -p "$SESSION_DIR" || {
|
||||
echo "无法创建日志目录: $SESSION_DIR"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 设置全局变量标记是否记录日志
|
||||
LOGGING_ENABLED=true
|
||||
|
||||
echo "日志保存在: $LOG_FILE"
|
||||
|
||||
if [ "$LOGGING_ENABLED" = true ]; then
|
||||
# 标准输出重定向
|
||||
exec > >(while read -r line; do
|
||||
printf "[%(%Y-%m-%d %H:%M:%S)T] %s\n" -1 "$line" | tee -a "$LOG_FILE"
|
||||
done)
|
||||
|
||||
# 标准错误重定向
|
||||
exec 2> >(while read -r line; do
|
||||
printf "[%(%Y-%m-%d %H:%M:%S)T] %s\n" -1 "$line" | tee -a "$LOG_FILE"
|
||||
done >&2)
|
||||
fi
|
||||
}
|
||||
|
||||
# 创建新的编译日志文件
|
||||
create_build_log() {
|
||||
local build_type=$1
|
||||
local timestamp=$(date +%Y%m%d_%H%M%S)
|
||||
BUILD_LOG_FILE="${SESSION_DIR}/${build_type}_${timestamp}.log"
|
||||
echo "创建新的编译日志: $BUILD_LOG_FILE"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 禁用日志输出
|
||||
disable_logging() {
|
||||
LOGGING_ENABLED=false
|
||||
exec >&$STDOUT_ORIG
|
||||
exec 2>&$STDERR_ORIG
|
||||
}
|
||||
|
||||
# 启用日志输出
|
||||
enable_logging() {
|
||||
LOGGING_ENABLED=true
|
||||
# 标准输出重定向
|
||||
exec > >(while read -r line; do
|
||||
printf "[%(%Y-%m-%d %H:%M:%S)T] %s\n" -1 "$line" | tee -a "$LOG_FILE"
|
||||
done)
|
||||
|
||||
# 标准错误重定向
|
||||
exec 2> >(while read -r line; do
|
||||
printf "[%(%Y-%m-%d %H:%M:%S)T] %s\n" -1 "$line" | tee -a "$LOG_FILE"
|
||||
done >&2)
|
||||
}
|
||||
|
||||
# 设置终端颜色
|
||||
setup_colors() {
|
||||
if [[ -t 2 ]]; then
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
else
|
||||
RED='' GREEN='' YELLOW='' BLUE='' NC=''
|
||||
fi
|
||||
}
|
||||
|
||||
# 记录日志函数 - 使用此函数来明确日志级别
|
||||
log() {
|
||||
local level=$1
|
||||
local message=$2
|
||||
local timestamp=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
local color="" level_str=""
|
||||
|
||||
case $level in
|
||||
"INFO") color="$GREEN"; level_str="INFO" ;;
|
||||
"WARN") color="$YELLOW"; level_str="WARN" ;;
|
||||
"ERROR") color="$RED"; level_str="ERROR" ;;
|
||||
"DEBUG") color="$BLUE"; level_str="DEBUG" ;;
|
||||
esac
|
||||
|
||||
printf "[%s] ${color}[%s]${NC}: %s\n" "$timestamp" "$level_str" "$message"
|
||||
}
|
||||
|
||||
#---------------自定义包管理函数---------------#
|
||||
# 更新单个自定义包
|
||||
update_single_package() {
|
||||
local pkg_name=$1
|
||||
local config=$2
|
||||
|
||||
# 解析配置
|
||||
local target_dir=$(echo "$config" | cut -d= -f1)
|
||||
local repo_url=$(echo "$config" | cut -d= -f2)
|
||||
local branch=$(echo "$config" | cut -d= -f3)
|
||||
local use_depth=$(echo "$config" | cut -d= -f4)
|
||||
|
||||
log "INFO" "更新 $pkg_name..."
|
||||
|
||||
# 检查目标目录
|
||||
if [ -d "$target_dir" ]; then
|
||||
log "INFO" "移除现有 $target_dir 目录"
|
||||
rm -rf "$target_dir" || {
|
||||
log "ERROR" "无法删除 $target_dir 目录"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# 准备克隆命令
|
||||
local clone_cmd="git clone --progress"
|
||||
|
||||
# 添加分支参数 (如果指定)
|
||||
if [ -n "$branch" ] && [ "$branch" != "master" ]; then
|
||||
clone_cmd="$clone_cmd -b $branch"
|
||||
fi
|
||||
|
||||
# 添加 depth 参数 (如果需要)
|
||||
if [ "$use_depth" = "true" ]; then
|
||||
clone_cmd="$clone_cmd --depth 1"
|
||||
fi
|
||||
|
||||
# 完成克隆命令
|
||||
clone_cmd="$clone_cmd $repo_url $target_dir"
|
||||
|
||||
# 执行克隆
|
||||
log "INFO" "执行: $clone_cmd"
|
||||
eval "$clone_cmd" || {
|
||||
log "ERROR" "克隆 $pkg_name 失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
log "INFO" "$pkg_name 更新完成"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 更新自定义包的主函数
|
||||
update_custom_package() {
|
||||
local failed_packages=()
|
||||
local success_count=0
|
||||
local total_packages=${#CUSTOM_PACKAGES[@]}
|
||||
|
||||
log "INFO" "开始更新 $total_packages 个自定义包..."
|
||||
|
||||
for pkg_name in "${!CUSTOM_PACKAGES[@]}"; do
|
||||
update_single_package "$pkg_name" "${CUSTOM_PACKAGES[$pkg_name]}" || {
|
||||
failed_packages+=("$pkg_name")
|
||||
continue
|
||||
}
|
||||
((success_count++))
|
||||
done
|
||||
|
||||
# 显示更新结果
|
||||
if [ ${#failed_packages[@]} -eq 0 ]; then
|
||||
log "INFO" "所有自定义包更新成功 ($success_count/$total_packages)"
|
||||
return 0
|
||||
else
|
||||
log "WARN" "部分包更新失败 (成功: $success_count/$total_packages)"
|
||||
log "ERROR" "更新失败的包: ${failed_packages[*]}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新特定自定义包
|
||||
update_specific_package() {
|
||||
local pkg_name=$1
|
||||
|
||||
if [ -z "$pkg_name" ]; then
|
||||
log "ERROR" "未指定包名"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "${CUSTOM_PACKAGES[$pkg_name]}" ]; then
|
||||
log "ERROR" "未找到包配置:$pkg_name"
|
||||
log "INFO" "可用的包: ${!CUSTOM_PACKAGES[*]}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
update_single_package "$pkg_name" "${CUSTOM_PACKAGES[$pkg_name]}"
|
||||
}
|
||||
|
||||
#---------------基础功能函数---------------#
|
||||
# 清理工作区
|
||||
clean_workspace() {
|
||||
log "INFO" "开始清理工作区..."
|
||||
|
||||
log "INFO" "执行./scripts/feeds clean..."
|
||||
./scripts/feeds clean || log "WARN" "feeds clean 失败"
|
||||
|
||||
log "INFO" "执行rm -rf ./tmp ./staging_dir ./build_dir ./bin ./dl..."
|
||||
rm -rf ./tmp ./staging_dir ./build_dir ./bin ./dl || log "WARN" "删除临时目录失败"
|
||||
|
||||
log "INFO" "工作区清理完成"
|
||||
}
|
||||
|
||||
# 清理编译临时文件
|
||||
clean_build_temp() {
|
||||
log "INFO" "开始清理编译临时文件..."
|
||||
|
||||
log "INFO" "删除临时编译目录和缓存..."
|
||||
rm -rf ./tmp ./staging_dir ./build_dir || log "WARN" "删除临时编译目录失败"
|
||||
|
||||
log "INFO" "编译临时文件清理完成"
|
||||
}
|
||||
|
||||
# 更新源码
|
||||
update_source() {
|
||||
log "INFO" "开始更新源码..."
|
||||
git pull || { log "ERROR" "源码更新失败"; return 1; }
|
||||
log "INFO" "源码更新完成"
|
||||
}
|
||||
|
||||
# 更新feeds
|
||||
update_feeds() {
|
||||
log "INFO" "开始更新feeds..."
|
||||
./scripts/feeds update -a && ./scripts/feeds install -a || {
|
||||
log "ERROR" "Feeds更新失败"
|
||||
return 1
|
||||
}
|
||||
log "INFO" "Feeds更新完成"
|
||||
return 0
|
||||
}
|
||||
|
||||
# 编译固件
|
||||
build_firmware() {
|
||||
# 创建新的编译日志
|
||||
create_build_log "firmware"
|
||||
local current_log="$BUILD_LOG_FILE"
|
||||
|
||||
log "INFO" "开始编译固件..."
|
||||
log "INFO" "编译详细日志位置: $current_log"
|
||||
|
||||
# 下载依赖
|
||||
log "INFO" "下载依赖包..."
|
||||
make download -j$(nproc) V=s 2>&1 | tee -a "$current_log" || {
|
||||
log "ERROR" "依赖下载失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
# 使用多线程编译
|
||||
local cpu_cores=$(nproc)
|
||||
log "INFO" "使用 $cpu_cores 线程开始编译..."
|
||||
|
||||
if make -j$cpu_cores V=s 2>&1 | tee -a "$current_log"; then
|
||||
log "INFO" "多线程编译成功完成"
|
||||
return 0
|
||||
else
|
||||
log "WARN" "多线程编译失败,清理临时文件后切换为单线程编译..."
|
||||
|
||||
# 清理编译临时文件
|
||||
clean_build_temp
|
||||
|
||||
# 创建一个新日志用于单线程编译
|
||||
create_build_log "firmware_singlethread"
|
||||
current_log="$BUILD_LOG_FILE"
|
||||
log "INFO" "单线程编译详细日志位置: $current_log"
|
||||
|
||||
# 重新下载依赖
|
||||
log "INFO" "重新下载依赖包..."
|
||||
make download -j1 V=s 2>&1 | tee -a "$current_log" || {
|
||||
log "ERROR" "单线程依赖下载也失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
if make -j1 V=s 2>&1 | tee -a "$current_log"; then
|
||||
log "INFO" "单线程编译成功完成"
|
||||
return 0
|
||||
else
|
||||
log "ERROR" "编译失败,即使在单线程模式下"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# 清理旧包
|
||||
clean_packages() {
|
||||
log "INFO" "开始清理旧包..."
|
||||
local removed_count=0
|
||||
local failed_count=0
|
||||
|
||||
# 清理目录
|
||||
for dir in "${REMOVE_DIRS[@]}"; do
|
||||
if [ -d "$dir" ]; then
|
||||
rm -rf "$dir" && {
|
||||
log "INFO" "已删除: $dir"
|
||||
((removed_count++))
|
||||
} || {
|
||||
log "ERROR" "删除失败: $dir"
|
||||
((failed_count++))
|
||||
}
|
||||
fi
|
||||
done
|
||||
|
||||
# 清理包
|
||||
for pkg in "${REMOVE_PACKAGES[@]}"; do
|
||||
if [ -d "$pkg" ]; then
|
||||
rm -rf "$pkg" && {
|
||||
log "INFO" "已移除: $pkg"
|
||||
((removed_count++))
|
||||
} || {
|
||||
log "ERROR" "删除失败: $pkg"
|
||||
((failed_count++))
|
||||
}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $failed_count -eq 0 ]; then
|
||||
log "INFO" "包清理完成,共移除 $removed_count 个包/目录"
|
||||
return 0
|
||||
else
|
||||
log "WARN" "包清理部分完成,成功: $removed_count, 失败: $failed_count"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新所有组件
|
||||
update_all_components() {
|
||||
log "INFO" "开始更新所有组件..."
|
||||
local failed=false
|
||||
|
||||
# 更新源码
|
||||
log "INFO" "执行源码更新..."
|
||||
update_source || failed=true
|
||||
|
||||
# 清理旧包
|
||||
log "INFO" "执行清理旧包..."
|
||||
clean_packages || log "WARN" "清理旧包部分失败,继续执行..."
|
||||
|
||||
# 更新自定义包
|
||||
log "INFO" "执行自定义包更新..."
|
||||
update_custom_package || failed=true
|
||||
|
||||
# 更新feeds
|
||||
log "INFO" "执行feeds更新..."
|
||||
update_feeds || failed=true
|
||||
|
||||
if [ "$failed" = true ]; then
|
||||
log "WARN" "部分组件更新失败,请查看日志了解详情"
|
||||
return 1
|
||||
else
|
||||
log "INFO" "所有组件更新完成"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# 菜单配置
|
||||
menuconfig() {
|
||||
log "INFO" "开始菜单配置..."
|
||||
disable_logging
|
||||
make menuconfig
|
||||
enable_logging
|
||||
log "INFO" "菜单配置完成"
|
||||
}
|
||||
|
||||
#---------------组合功能函数---------------#
|
||||
# 完整构建流程
|
||||
full_build() {
|
||||
log "INFO" "启动完整构建流程..."
|
||||
|
||||
clean_workspace || log "WARN" "工作区清理部分失败,继续执行..."
|
||||
update_source || { log "ERROR" "源码更新失败,终止构建"; return 1; }
|
||||
clean_packages || log "WARN" "清理旧包部分失败,继续执行..."
|
||||
update_custom_package || { log "ERROR" "自定义包更新失败,终止构建"; return 1; }
|
||||
update_feeds || { log "ERROR" "feeds更新失败,终止构建"; return 1; }
|
||||
|
||||
log "INFO" "进入菜单配置..."
|
||||
menuconfig
|
||||
|
||||
log "INFO" "开始编译固件..."
|
||||
build_firmware || {
|
||||
log "ERROR" "固件编译失败"
|
||||
return 1
|
||||
}
|
||||
|
||||
log "INFO" "完整构建流程完成"
|
||||
return 0
|
||||
}
|
||||
|
||||
#---------------菜单函数---------------#
|
||||
print_menu() {
|
||||
echo -e "\n${BLUE}OpenWrt 构建管理菜单${NC}"
|
||||
echo -e "${YELLOW}================================${NC}"
|
||||
echo -e "${GREEN}1.${NC} 完整构建流程"
|
||||
echo -e "${GREEN}2.${NC} 清理工作区"
|
||||
echo -e "${GREEN}3.${NC} 更新所有组件"
|
||||
echo -e "${GREEN}4.${NC} 清理旧包"
|
||||
echo -e "${GREEN}5.${NC} 编译固件"
|
||||
echo -e "${GREEN}6.${NC} 调整配置(menuconfig)"
|
||||
echo -e "${GREEN}7.${NC} 更新自定义包"
|
||||
echo -e "${GREEN}8.${NC} 更新特定自定义包"
|
||||
echo -e "${GREEN}9.${NC} 更新源码"
|
||||
echo -e "${GREEN}10.${NC} 更新feeds"
|
||||
echo -e "${GREEN}0.${NC} 退出"
|
||||
echo -e "${YELLOW}================================${NC}"
|
||||
echo -ne "请选择操作 [0-10]: "
|
||||
}
|
||||
|
||||
# 显示可用的自定义包
|
||||
print_package_menu() {
|
||||
echo -e "\n${BLUE}可用的自定义包${NC}"
|
||||
echo -e "${YELLOW}================================${NC}"
|
||||
|
||||
local i=1
|
||||
for pkg_name in "${!CUSTOM_PACKAGES[@]}"; do
|
||||
echo -e "${GREEN}$i.${NC} $pkg_name"
|
||||
((i++))
|
||||
done
|
||||
|
||||
echo -e "${YELLOW}================================${NC}"
|
||||
echo -ne "请选择要更新的包 [1-$((i-1))]: "
|
||||
}
|
||||
|
||||
# 选择特定自定义包更新
|
||||
select_specific_package() {
|
||||
local pkg_names=("${!CUSTOM_PACKAGES[@]}")
|
||||
print_package_menu
|
||||
|
||||
read -r choice
|
||||
|
||||
# 验证选择
|
||||
if [[ ! "$choice" =~ ^[0-9]+$ ]] || [ "$choice" -lt 1 ] || [ "$choice" -gt ${#pkg_names[@]} ]; then
|
||||
log "ERROR" "无效选择: $choice"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local selected_pkg=${pkg_names[$((choice-1))]}
|
||||
log "INFO" "选择更新包: $selected_pkg"
|
||||
|
||||
update_specific_package "$selected_pkg"
|
||||
}
|
||||
|
||||
#---------------主函数---------------#
|
||||
main() {
|
||||
# 初始化日志目录和日志系统
|
||||
init_logger
|
||||
setup_colors
|
||||
|
||||
log "INFO" "OpenWrt 构建管理脚本启动 - 会话日志目录: $SESSION_DIR"
|
||||
|
||||
while true; do
|
||||
print_menu
|
||||
read -r choice
|
||||
|
||||
case $choice in
|
||||
1) full_build ;;
|
||||
2) clean_workspace ;;
|
||||
3) update_all_components ;;
|
||||
4) clean_packages ;;
|
||||
5) build_firmware ;;
|
||||
6) menuconfig ;;
|
||||
7) update_custom_package ;;
|
||||
8) select_specific_package ;;
|
||||
9) update_source ;;
|
||||
10) update_feeds ;;
|
||||
0)
|
||||
log "INFO" "退出脚本"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
log "WARN" "无效选择: $choice,请重试"
|
||||
;;
|
||||
esac
|
||||
|
||||
# 操作完成后暂停
|
||||
if [[ $choice != 0 ]]; then
|
||||
echo -e "\n${YELLOW}操作完成,按回车键继续...${NC}"
|
||||
read -r
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# 执行主函数
|
||||
main "$@"
|
@ -0,0 +1,613 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
|
||||
/dts-v1/;
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/leds/common.h>
|
||||
#include <dt-bindings/pinctrl/rockchip.h>
|
||||
#include <dt-bindings/soc/rockchip,vop2.h>
|
||||
#include "rk3568.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Ariaboard Photonicat";
|
||||
compatible = "ariaboard,photonicat", "rockchip,rk3568";
|
||||
|
||||
aliases {
|
||||
ethernet0 = &gmac0;
|
||||
ethernet1 = &gmac1;
|
||||
mmc0 = &sdhci;
|
||||
mmc1 = &sdmmc0;
|
||||
mmc2 = &sdmmc1;
|
||||
};
|
||||
|
||||
chosen: chosen {
|
||||
stdout-path = "serial2:1500000n8";
|
||||
};
|
||||
|
||||
gpio-poweroff {
|
||||
compatible = "gpio-poweroff";
|
||||
gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>;
|
||||
timeout-ms = <3000>;
|
||||
};
|
||||
|
||||
hdmi-con {
|
||||
compatible = "hdmi-connector";
|
||||
type = "a";
|
||||
|
||||
port {
|
||||
hdmi_con_in: endpoint {
|
||||
remote-endpoint = <&hdmi_out_con>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
modem-rfkill {
|
||||
compatible = "rfkill-gpio";
|
||||
label = "modem-rfkill";
|
||||
radio-type = "wwan";
|
||||
reset-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_LOW>;
|
||||
shutdown-gpios = <&gpio4 RK_PC4 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
sdio_pwrseq: sdio-pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
clocks = <&pmucru CLK_RTC_32K>;
|
||||
clock-names = "ext_clock";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&wifi_enable_h &clk32k_out1>;
|
||||
reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
vccin_5v: regulator-vccin-5v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vccin_5v";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
};
|
||||
|
||||
vcc_sysin: regulator-vcc-sysin {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_sysin";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <&vccin_5v>;
|
||||
};
|
||||
|
||||
vcc_syson: regulator-vcc-syson {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_syson";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <&vcc_sysin>;
|
||||
};
|
||||
|
||||
vcc3v3_sys: regulator-vcc3v3-sys {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc3v3_sys";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc_syson>;
|
||||
};
|
||||
|
||||
vcc_1v8: regulator-vcc-1v8 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_1v8";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vcc_3v3: regulator-vcc-3v3 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc_3v3";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vcc3v3_ngff: regulator-vcc3v3-ngff {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>;
|
||||
regulator-name = "vcc3v3_ngff";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vccin_5v>;
|
||||
};
|
||||
|
||||
/* pi6c pcie clock generator */
|
||||
vcc3v3_pi6c: regulator-vcc3v3-pi6c {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pcie_enable_h>;
|
||||
regulator-name = "vcc3v3_pi6c";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc_syson>;
|
||||
};
|
||||
|
||||
/* actually fed by vcc_syson, dependent on pi6c clock generator */
|
||||
vcc3v3_pcie: regulator-vcc3v3-pcie {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcc3v3_pcie";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc3v3_pi6c>;
|
||||
};
|
||||
|
||||
vcc3v3_sd: regulator-vcc3v3-sd {
|
||||
compatible = "regulator-fixed";
|
||||
gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&vcc_sd_h>;
|
||||
regulator-boot-on;
|
||||
regulator-name = "vcc3v3_sd";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
vin-supply = <&vcc_3v3>;
|
||||
};
|
||||
|
||||
/* actually fed by vccin_5v, dependent on vcc5v0_usb_otg */
|
||||
vcc5v0_boost: regulator-vcc5v0-boost {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&vcc5v0_boost_en>;
|
||||
regulator-name = "vcc5v0_boost";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <&vcc5v0_usb_otg>;
|
||||
};
|
||||
|
||||
vcc5v0_usb_otg: regulator-vcc5v0-usb-otg {
|
||||
compatible = "regulator-fixed";
|
||||
enable-active-high;
|
||||
gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&vcc5v0_usb_otg_en>;
|
||||
regulator-name = "vcc5v0_usb_otg";
|
||||
regulator-min-microvolt = <5000000>;
|
||||
regulator-max-microvolt = <5000000>;
|
||||
vin-supply = <&vccin_5v>;
|
||||
};
|
||||
|
||||
vcca_1v8: regulator-vcca-1v8 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vcca_1v8";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vdda_0v9: regulator-vdda-0v9 {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "vdda_0v9";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-min-microvolt = <900000>;
|
||||
regulator-max-microvolt = <900000>;
|
||||
vin-supply = <&vcc3v3_sys>;
|
||||
};
|
||||
|
||||
vdd_gpu: regulator-vdd-gpu {
|
||||
compatible = "pwm-regulator";
|
||||
pwms = <&pwm2 0 5000 1>;
|
||||
regulator-name = "vdd_gpu";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-init-microvolt = <900000>;
|
||||
regulator-min-microvolt = <800000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-ramp-delay = <6001>;
|
||||
regulator-settling-time-up-us = <250>;
|
||||
pwm-supply = <&vcc_syson>;
|
||||
};
|
||||
|
||||
vdd_logic: regulator-vdd-logic {
|
||||
compatible = "pwm-regulator";
|
||||
pwms = <&pwm1 0 5000 1>;
|
||||
regulator-name = "vdd_logic";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-init-microvolt = <900000>;
|
||||
regulator-min-microvolt = <500000>;
|
||||
regulator-max-microvolt = <1350000>;
|
||||
regulator-ramp-delay = <6001>;
|
||||
regulator-settling-time-up-us = <250>;
|
||||
pwm-supply = <&vcc_syson>;
|
||||
};
|
||||
};
|
||||
|
||||
&combphy0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&combphy1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&combphy2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&cpu1 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&cpu2 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&cpu3 {
|
||||
cpu-supply = <&vdd_cpu>;
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
assigned-clocks = <&cru SCLK_GMAC0_RX_TX>;
|
||||
assigned-clock-parents = <&gmac0_xpcsclk>;
|
||||
power-domains = <&power RK3568_PD_PIPE>;
|
||||
phys = <&combphy2 PHY_TYPE_SGMII>;
|
||||
phy-handle = <&sgmii_phy>;
|
||||
phy-mode = "sgmii";
|
||||
phy-supply = <&vcc_3v3>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gmac0_miim>;
|
||||
rockchip,xpcs = <&xpcs>;
|
||||
snps,reset-gpio = <&gpio3 RK_PC6 GPIO_ACTIVE_LOW>;
|
||||
snps,reset-active-low;
|
||||
snps,reset-delays-us = <0 15000 50000>;
|
||||
tx_delay = <0xff>;
|
||||
rx_delay = <0xff>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
|
||||
assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>;
|
||||
assigned-clock-rates = <0>, <125000000>;
|
||||
clock_in_out = "output";
|
||||
phy-handle = <&rgmii_phy>;
|
||||
phy-mode = "rgmii";
|
||||
phy-supply = <&vcc_3v3>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&gmac1m1_miim
|
||||
&gmac1m1_tx_bus2
|
||||
&gmac1m1_rx_bus2
|
||||
&gmac1m1_rgmii_clk
|
||||
&gmac1m1_rgmii_bus>;
|
||||
snps,reset-gpio = <&gpio4 RK_PC0 GPIO_ACTIVE_LOW>;
|
||||
snps,reset-active-low;
|
||||
snps,reset-delays-us = <0 15000 50000>;
|
||||
tx_delay = <0x30>;
|
||||
rx_delay = <0x10>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpu {
|
||||
mali-supply = <&vdd_gpu>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hdmi {
|
||||
avdd-0v9-supply = <&vdda_0v9>;
|
||||
avdd-1v8-supply = <&vcca_1v8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&hdmi_in {
|
||||
hdmi_in_vp0: endpoint {
|
||||
remote-endpoint = <&vp0_out_hdmi>;
|
||||
};
|
||||
};
|
||||
|
||||
&hdmi_out {
|
||||
hdmi_out_con: endpoint {
|
||||
remote-endpoint = <&hdmi_con_in>;
|
||||
};
|
||||
};
|
||||
|
||||
&hdmi_sound {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2c0 {
|
||||
status = "okay";
|
||||
|
||||
vdd_cpu: regulator@1c {
|
||||
compatible = "tcs,tcs4525";
|
||||
reg = <0x1c>;
|
||||
fcs,suspend-voltage-selector = <1>;
|
||||
regulator-name = "vdd_cpu";
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-init-microvolt = <900000>;
|
||||
regulator-min-microvolt = <712500>;
|
||||
regulator-max-microvolt = <1390000>;
|
||||
regulator-ramp-delay = <2300>;
|
||||
vin-supply = <&vcc_syson>;
|
||||
|
||||
regulator-state-mem {
|
||||
regulator-off-in-suspend;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c2m1_xfer>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2s0_8ch {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&mdio0 {
|
||||
sgmii_phy: ethernet-phy@0 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <0>;
|
||||
motorcomm,led-data = <0xe004 0x0000 0x2600 0x0070 0x000a>;
|
||||
};
|
||||
};
|
||||
|
||||
&mdio1 {
|
||||
rgmii_phy: ethernet-phy@0 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <0>;
|
||||
motorcomm,led-data = <0xe004 0x0000 0x2600 0x0070 0x000a>;
|
||||
};
|
||||
};
|
||||
|
||||
&pcie30phy {
|
||||
phy-supply = <&vcc3v3_pi6c>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pcie3x2 {
|
||||
reset-gpios = <&gpio0 RK_PC3 GPIO_ACTIVE_HIGH>;
|
||||
vpcie3v3-supply = <&vcc3v3_pcie>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
bt {
|
||||
bt_enable_h: bt-enable-h {
|
||||
rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
pcie {
|
||||
pcie_enable_h: pcie-enable-h {
|
||||
rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
sdio-pwrseq {
|
||||
wifi_enable_h: wifi-enable-h {
|
||||
rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
usb {
|
||||
vcc5v0_boost_en: vcc5v0-boost-en {
|
||||
rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
|
||||
vcc5v0_usb_otg_en: vcc5v0-usb-otg-en {
|
||||
rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
|
||||
vcc-sd {
|
||||
vcc_sd_h: vcc-sd-h {
|
||||
rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pmu_io_domains {
|
||||
pmuio1-supply = <&vcc_3v3>;
|
||||
pmuio2-supply = <&vcc_3v3>;
|
||||
vccio1-supply = <&vcc_3v3>;
|
||||
vccio3-supply = <&vcc_3v3>;
|
||||
vccio4-supply = <&vcc_1v8>;
|
||||
vccio5-supply = <&vcc_3v3>;
|
||||
vccio6-supply = <&vcc_3v3>;
|
||||
vccio7-supply = <&vcc_3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&saradc {
|
||||
vref-supply = <&vcca_1v8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdhci {
|
||||
bus-width = <8>;
|
||||
max-frequency = <200000000>;
|
||||
non-removable;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>;
|
||||
vmmc-supply = <&vcc_3v3>;
|
||||
vqmmc-supply = <&vcc_1v8>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdmmc0 {
|
||||
bus-width = <4>;
|
||||
cap-sd-highspeed;
|
||||
cd-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_LOW>;
|
||||
disable-wp;
|
||||
no-1-8-v;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd>;
|
||||
vmmc-supply = <&vcc3v3_sd>;
|
||||
vqmmc-supply = <&vcc_3v3>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdmmc1 {
|
||||
bus-width = <4>;
|
||||
cap-sd-highspeed;
|
||||
cap-sdio-irq;
|
||||
keep-power-in-suspend;
|
||||
mmc-pwrseq = <&sdio_pwrseq>;
|
||||
non-removable;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>;
|
||||
sd-uhs-sdr25;
|
||||
sd-uhs-sdr50;
|
||||
sd-uhs-sdr104;
|
||||
vmmc-supply = <&vcc3v3_sys>;
|
||||
vqmmc-supply = <&vcc_1v8>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
wifi@1 {
|
||||
reg = <1>;
|
||||
interrupt-parent = <&gpio2>;
|
||||
interrupts = <RK_PB2 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "host-wake";
|
||||
};
|
||||
};
|
||||
|
||||
&tsadc {
|
||||
rockchip,hw-tshut-mode = <1>;
|
||||
rockchip,hw-tshut-polarity = <0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart1 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>;
|
||||
status = "okay";
|
||||
uart-has-rtscts;
|
||||
|
||||
bluetooth {
|
||||
compatible = "qcom,qca9377-bt";
|
||||
enable-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
|
||||
clocks = <&pmucru CLK_RTC_32K>;
|
||||
clock-names = "lpo";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&bt_enable_h>;
|
||||
vddio-supply = <&vcc_1v8>;
|
||||
};
|
||||
};
|
||||
|
||||
&uart2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart3 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart4 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_ohci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host0_xhci {
|
||||
dr_mode = "host";
|
||||
extcon = <&usb2phy0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_ehci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_ohci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb_host1_xhci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy0_host {
|
||||
phy-supply = <&vcc3v3_ngff>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy0_otg {
|
||||
phy-supply = <&vcc5v0_boost>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usb2phy1_otg {
|
||||
phy-supply = <&vcc5v0_usb_otg>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vop {
|
||||
assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
|
||||
assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vop_mmu {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&vp0 {
|
||||
vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
|
||||
reg = <ROCKCHIP_VOP2_EP_HDMI0>;
|
||||
remote-endpoint = <&hdmi_in_vp0>;
|
||||
};
|
||||
};
|
||||
|
||||
&xin32k {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&clk32k_out1>;
|
||||
};
|
||||
|
||||
&xpcs {
|
||||
status = "okay";
|
||||
};
|
@ -16,6 +16,16 @@ define Device/armsom_sige7
|
||||
endef
|
||||
TARGET_DEVICES += armsom_sige7
|
||||
|
||||
define Device/ariaboard_photonicat
|
||||
DEVICE_VENDOR := Ariaboard
|
||||
DEVICE_MODEL := Photonicat
|
||||
SOC := rk3568
|
||||
BOOT_FLOW := pine64-img
|
||||
DEVICE_PACKAGES := kmod-ath10k-sdio ath10k-firmware-qca9377-sdio wpad-openssl \
|
||||
kmod-usb-net-cdc-mbim kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi
|
||||
endef
|
||||
TARGET_DEVICES += ariaboard_photonicat
|
||||
|
||||
define Device/firefly_roc-rk3328-cc
|
||||
DEVICE_VENDOR := Firefly
|
||||
DEVICE_MODEL := ROC-RK3328-CC
|
||||
|
Loading…
x
Reference in New Issue
Block a user