配置环境 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \ git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev \ libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev \ libssl-dev libtool lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 \ python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo \ uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev sudo vi /etc/wsl.conf[interop] appendWindowsPath = false New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow proxy_port=7890 proxy_host=$(ip route | awk '/default/ {print $3}' ) export all_proxy="socks5://${proxy_host} :${proxy_port} "
获取源码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 git clone --depth=1 https://github.com/coolsnowwolf/lede.git git clone --depth=1 https://github.com/unifreq/openwrt_packit.git cd ledegit pull ./scripts/feeds update -a ./scripts/feeds install -a
开始编译 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 cp ../openwrt_packit/files/openwrt_config_demo/arm64-r23.10.31-20231031-huge.config .configmake menuconfig make download V=s -j8 make V=s -j$(nproc ) make clean make dirclean make distclean
固件配置 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 > Target System > QEMU ARM Virtual Machine > Subtarget > QEMU ARMv8 Virtual Machine (cortex-a53) > Target Profile > Default > Target System > Arm SystemReady (EFI) compliant > Subtarget > 64-bit (armv8) machines > Target Profile > Generic EFI Boot > Target Images > tar.gz > Base system > dnsmasq-full > Base system > wireless-tools > Network > WirelessAPD > hostapd-common > Network > WirelessAPD > wpad-basic > Network > WirelessAPD > wpa-cli > Network > iw > Libraries > libpam > Kernel modules > Wireless Drivers > kmod-mt7916-firmware > LuCI > Collections > luci > LuCI > Modules > luci-compat > LuCI > Modules > Translations > Chinese Simplified (zh_Hans) > LuCI > Protocols > luci-proto-modemmanager > Utilities > Disc > lsblk > Utilities > Disc > blkid > Utilities > Disc > parted > Utilities > Shells > bash > Utilities > Filesystem > btrfs-progs > Utilities > Filesystem > e2fsprogs > Languages > Perl > perl-http-date > Languages > Perl > perlbase-file > Languages > Perl > perlbase-getopt > Languages > Perl > perlbase-unicode
生成镜像 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 sudo apt install btrfs-progs dosfstools uuid-runtime fdisk parted gawkcp lede/bin/targets/armvirt/64/openwrt-armvirt-64-generic-rootfs.tar.gz openwrt_packit/cd openwrt_packit/cat > openwrt_packit/whoami <<EOF WHOAMI=leux OPENWRT_VER="R23.12.23" DISTRIB_REVISION="r20265-f85a79bcb4" DISTRIB_DESCRIPTION="OpenWrt 22.03.6 r20265-f85a79bcb4" RK3588_KERNEL_VERSION="5.10.160-rk3588-flippy-2405a" KERNEL_PKG_HOME="/home/leux/openwrt_packit/kernel" OP_ROOT_TGZ="openwrt-armvirt-64-generic-rootfs.tar.gz" EOF cp boot-5.10.160-rk3588-flippy-2311b.tar.gz openwrt_packit/kernel/cp modules-5.10.160-rk3588-flippy-2311b.tar.gz openwrt_packit/kernel/cp dtb-rockchip-5.10.160-rk3588-flippy-2311b.tar.gz openwrt_packit/kernel/cp header-5.10.160-rk3588-flippy-2311b.tar.gz openwrt_packit/kernel/sudo ./mk_rk3588_h88k-v3.shcp openwrt_packit/output/openwrt_rk3588_h88k-v3_R23.12.23_k5.10.160-rk3588-flippy-2311b.img /mnt/d/test/sudo rm -rf openwrt_packit/tmp/ openwrt_packit/output/ openwrt_packit/openwrt-armvirt-64-generic-rootfs.tar.gzrm /mnt/d/test/*
编译相关
修改默认主题为 Argon
修改 lede/feeds/luci/collections/luci/Makefile
将 +luci-theme-bootstrap
替换成 +luci-theme-argon
关于LEDE源码编译构建后WEB管理后台无法打开
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 错误显示:daemon.err uhttpd[5343]: Failed to initialize ustream-ssl 问题原因:是由于LEDE将openssl升级到3.0导致的,回滚到v1.1.1可解决问题 方法一:无需替换openssl,修改/etc/config/uhttpd文件中注释掉2行 listen_https 再重启即可解决 方法二:删除自带的3.0,使用持续更新的istore的openssl来顶替 cd lede/package/libs/ && rm -rf openssl/cp -r istoreos/package/libs/openssl/ openssl/方法三:也可以通过git回退到openssl未升级3.0时再编译 git log --pretty=oneline 7494eb16185a176de226f55e842cadf94f1c5a11 openssl: bump to 3.0.10 a2a0e5b9f6ce420398487ea29a85b0b0c49c9087 ipq-wifi: bump to latest git HEAD git checkout a2a0e5b9f6ce420398487ea29a85b0b0c49c9087
lean的源经常开倒车又不做测试就把源码发出来了!所以遇到一些包错误直接用官方版本替换对应源码包即可
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Disabling debugger Disabling profiler checking for x86_64-pc-linux-gnu-xml2-config... /home/leux/lede/staging_dir/hostpkg/bin/x86_64-pc-linux-gnu-xml2-config configure: error: Could not find libxml2 anywhere, check ftp://xmlsoft.org/. make[3]: *** [Makefile:167: /home/leux/lede/build_dir/hostpkg/libxslt-1.1.34/.configured] Error 1 make[3]: Leaving directory '/home/leux/lede/feeds/packages/libs/libxslt' time : package/feeds/packages/libxslt/host-compile#3.10#5.57#9.81 ERROR: package/feeds/packages/libxslt [host] failed to build. make[2]: *** [package/Makefile:114: package/feeds/packages/libxslt/host/compile] Error 1 make[2]: Leaving directory '/home/leux/lede' make[1]: *** [package/Makefile:110: /home/leux/lede/staging_dir/target-aarch64_generic_musl/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/leux/lede' make: *** [/home/leux/lede/include/toplevel.mk:231: world] Error 2 leux@B650:~/lede$ rm -rf lede/package/feeds/packages/libxslt/*cp -r openwrt/package/feeds/packages/libxslt/* lede/package/feeds/packages/libxslt/make package/feeds/packages/libxslt/host/compile V=s
二次修改rootfs
1 2 3 4 5 6 7 8 9 mount /root/rootfs.img /mnt/root/ cd /mnt/root/tar -czvf /mnt/nvme0n1p1/openwrt-armvirt-64-generic-rootfs.tar.gz ./* tar -czvf /home/leux/openwrt_packit/openwrt-armvirt-64-generic-rootfs.tar.gz ./*
打包相关
系统镜像构建脚本的大多数操作都在 openwrt_packit/public_funcs
文件的函数中定义
1 2 3 4 5 6 7 8 9 10 11 12 13 Base on OpenWrt ${OPENWRT_VER} by lean & lienol >> etc/banner
构建脚本 mk_rk3588_h88k-v3.sh
文件末尾执行的函数作用如下,不需要可注释掉
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 copy_supplement_files extract_glibc_programs adjust_docker_config adjust_openssl_config adjust_qbittorrent_config adjust_getty_config adjust_samba_config adjust_nfs_config "mmcblk0p4" adjust_openssh_config adjust_openclash_config use_xrayplug_replace_v2rayplug create_fstab_config adjust_turboacc_config adjust_ntfs_config adjust_mosdns_config patch_admin_status_index_html adjust_kernel_env copy_uboot_to_fs write_release_info write_banner config_first_run create_snapshot "etc-000" write_uboot_to_disk clean_work_env
Flippy固件默认分区布局
分区
路径
大 小
挂 载 点
u-boot
或者是分区表
4MB~16MB
boot
/dev/mmcblk0p1
128MB~512MB
/boot
主rootfs
/dev/mmcblk0p2
720MB~1GB
/
副rootfs
/dev/mmcblk0p3
720MB~1GB
/mnt/xx
数据分区
/dev/mmcblk0p4
>=5GB
/mnt/yy
一半内存
/dev/shm
内存的一半
/tmp
注:每次在线升级后,副rootfs变成主rootfs,主rootfs变成副rootfs
注:个人数据,下载数据,docker数据可放数据分区
如果你用的不是LEDE而是OPENWRT官方,那么如下可以供你参考
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 cat > /home/leux/openwrt_packit/whoami <<EOF WHOAMI=leux OPENWRT_VER="v22.03.6" DISTRIB_REVISION="r20265-f85a79bcb4" DISTRIB_DESCRIPTION="OpenWrt 22.03.6 r20265-f85a79bcb4" RK3588_KERNEL_VERSION="5.10.160-rk3588-flippy-2405a" KERNEL_PKG_HOME="/home/leux/openwrt_packit/kernel" OP_ROOT_TGZ="openwrt-armvirt-64-default-rootfs.tar.gz" EOF cat > /home/leux/openwrt_packit/whoami <<EOF WHOAMI=leux OPENWRT_VER="v23.05.3" DISTRIB_REVISION="r23809-234f1a2efa" DISTRIB_DESCRIPTION="OpenWrt 23.05.3 r23809-234f1a2efa" RK3588_KERNEL_VERSION="5.10.160-rk3588-flippy-2405a" KERNEL_PKG_HOME="/home/leux/openwrt_packit/kernel" OP_ROOT_TGZ="openwrt-armsr-armv8-generic-rootfs.tar.gz" EOF copy_supplement_files adjust_getty_config create_fstab_config adjust_kernel_env write_uboot_to_disk function copy_supplement_files () {...... [ -n "$WIRELESS_CONFIG " ] && [ -f $WIRELESS_CONFIG ] && cp -v $WIRELESS_CONFIG etc/config/ [ -n "$NETWORK_SERVICE_PATCH " ] && [ -f $NETWORK_SERVICE_PATCH ] && patch -p1 < $NETWORK_SERVICE_PATCH [ -n "$BOARD_HOME " ] && [ -d $BOARD_HOME ] && cp -v $BOARD_HOME /* ./etc/board.d/ ...... } < > kmod-ath10k <*> kmod-ath10k-ct < > kmod-ath10k-ct-smallbuffers < > kmod-ath10k-smallbuffers < > kmod-libertas-sdio < > kmod-libertas-spi <*> kmod-libertas-usb <*> kmod-mwifiex-pcie < > kmod-mwifiex-sdio sed -i 's/downloads.openwrt.org/mirrors.ustc.edu.cn\/openwrt/g' /etc/opkg/distfeeds.conf
将根文件系统由 btrfs
改为 ext4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 # 对 mk_rk3588_h88k-v3.sh 中的修改如下: @@ -128,12 +128,12 @@ ROOTFS_MB=1024 SIZE=$((SKIP_MB + BOOT_MB + ROOTFS_MB + 1)) create_image "$TGT_IMG" "$SIZE" -create_partition "$TGT_DEV" "gpt" "$SKIP_MB" "$BOOT_MB" "ext4" "0" "-1" "btrfs" -make_filesystem "$TGT_DEV" "B" "ext4" "MMC_BOOT" "R" "btrfs" "MMC_ROOTFS1" +create_partition "$TGT_DEV" "gpt" "$SKIP_MB" "$BOOT_MB" "ext4" "0" "-1" "ext4" +make_filesystem "$TGT_DEV" "B" "ext4" "BOOT" "R" "ext4" "ROOT" mount_fs "${TGT_DEV}p1" "${TGT_BOOT}" "ext4" -mount_fs "${TGT_DEV}p2" "${TGT_ROOT}" "btrfs" "compress=zstd:${ZSTD_LEVEL}" -echo "创建 /etc 子卷 ..." -btrfs subvolume create $TGT_ROOT/etc +mount_fs "${TGT_DEV}p2" "${TGT_ROOT}" "ext4" +# echo "创建 /etc 子卷 ..." +# btrfs subvolume create $TGT_ROOT/etc extract_rootfs_files extract_rockchip_boot_files @@ -144,8 +144,8 @@ sed -e '/rootflags=/d' -i armbianEnv.txt cat >> armbianEnv.txt <<EOF rootdev=UUID=${ROOTFS_UUID} -rootfstype=btrfs -rootflags=compress=zstd:${ZSTD_LEVEL} +rootfstype=ext4 EOF echo "armbianEnv.txt -->" echo " # 对 public_funcs 中函数 create_fstab_config 的修改如下: @@ -935,7 +935,7 @@ EOF elif [ ! -z "${BOOT_UUID}" ];then cat > ./etc/fstab <<EOF -UUID=${ROOTFS_UUID} / btrfs compress=zstd:${ZSTD_LEVEL} 0 1 +UUID=${ROOTFS_UUID} / ext4 noatime,errors=remount-ro 0 1 UUID=${BOOT_UUID} /boot ext4 noatime,errors=remount-ro 0 2 #tmpfs /tmp tmpfs defaults,nosuid 0 0 EOF