|
本帖最后由 RGYiii 于 2024-7-29 20:03 编辑
目的:打包一个仅包含自定义插件的openwrt精简固件,我的插件需求如下图
由于没有空闲的板子做测试,以下步骤只保证能成功生成镜像,具体板子的适配要慢慢来。我也是个菜鸟,希望大家能多提建议!
测试步骤(全程用时只要30分钟左右):
安装Ubuntu Server 20.04.6 LTS,用非root用户登陆系统,最好全程科学上网。
一、用immortalwrt-imagebuilder生成rootfs基础包。
1.更新系统并安装依赖
sudo apt update -y
sudo apt full-upgrade -y
sudo apt install -y build-essential libncurses-dev zlib1g-dev gawk git gettext libssl-dev xsltproc rsync wget unzip python3 python3-distutils
2.下载 immortalwrt-imagebuilder 工具 23.05.3
wget https://downloads.immortalwrt.or ... Linux-x86_64.tar.xz && \
tar -J -x -f immortalwrt-imagebuilder-23.05.3-armsr-armv8.Linux-x86_64.tar.xz && \
mv immortalwrt-imagebuilder-23.05.3-armsr-armv8.Linux-x86_64 23.05.3 && \
cd 23.05.3
3.忽略一些镜像格式,减少打包时间
sed -i "s|CONFIG_TARGET_ROOTFS_CPIOGZ=.*|# CONFIG_TARGET_ROOTFS_CPIOGZ is not set|g" .config && \
sed -i "s|CONFIG_TARGET_ROOTFS_EXT4FS=.*|# CONFIG_TARGET_ROOTFS_EXT4FS is not set|g" .config && \
sed -i "s|CONFIG_TARGET_ROOTFS_SQUASHFS=.*|# CONFIG_TARGET_ROOTFS_SQUASHFS is not set|g" .config && \
sed -i "s|CONFIG_TARGET_IMAGES_GZIP=.*|# CONFIG_TARGET_IMAGES_GZIP is not set|g" .config
4.添加第三方的IPK
cd packages && \
wget https://github.com/zzsj0928/luci ... ushbot_3.60_all.ipk && \
wget https://github.com/ophub/luci-ap ... c_3.1.245-1_all.ipk && \
wget https://github.com/ophub/luci-ap ... n_3.1.245-1_all.ipk && \
cd ..
5.开始打包(官方插件会自动安装依赖)
make image ROOTFS_PARTSIZE="1024" PROFILE="generic" \
PACKAGES="luci-i18n-base-zh-cn luci-i18n-firewall-zh-cn luci-i18n-opkg-zh-cn \
perl-http-date perlbase-file perlbase-getopt perlbase-time perlbase-unicode perlbase-utf8 \
blkid fdisk lsblk parted attr btrfs-progs libzstd chattr dosfstools e2fsprogs f2fs-tools f2fsck lsattr mkf2fs xfs-fsck xfs-mkfs bsdtar pigz bash gawk getopt losetup tar uuidgen \
kmod-brcmfmac kmod-mac80211 wpa-cli wpad-basic \
luci-proto-3g luci-proto-ncm luci-proto-qmi block-mount kmod-fs-exfat kmod-fs-ext4 kmod-fs-ntfs3 kmod-usb-acm kmod-usb-core kmod-usb-dwc2 kmod-usb-dwc2-pci kmod-usb-dwc3 kmod-usb-hid kmod-usb-net-ipheth kmod-usb-net-rndis kmod-usb-net-sierrawireless kmod-usb-ohci kmod-usb-ohci-pci kmod-usb-printer kmod-usb-serial-ftdi kmod-usb-serial-option kmod-usb-serial-sierrawireless kmod-usb-storage kmod-usb-storage-extras kmod-usb-storage-uas kmod-usb-uhci kmod-usb-wdm kmod-usb2 kmod-usb2-pci kmod-usb3 usbmuxd pciutils usb-modeswitch usbids usbutils coremark \
kmod-rtw88-8822be \
luci-i18n-alist-zh-cn luci-i18n-amlogic-zh-cn luci-i18n-amule-zh-cn luci-i18n-aria2-zh-cn luci-i18n-autoreboot-zh-cn luci-i18n-ddns-go-zh-cn luci-i18n-diskman-zh-cn luci-i18n-dockerman-zh-cn luci-i18n-filebrowser-zh-cn luci-i18n-hd-idle-zh-cn luci-i18n-passwall-zh-cn luci-app-pushbot luci-i18n-qbittorrent-zh-cn luci-i18n-samba4-zh-cn luci-i18n-transmission-zh-cn luci-i18n-vlmcsd-zh-cn luci-proto-wireguard \
mdadm kmod-md-raid456 kmod-md-linear sing-box xray-core \
"
二、用ophub的脚本二次打包
1.安装依赖
sudo apt install -y ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison btrfs-progs build-essential bzip2 ca-certificates ccache cmake coreutils cpio curl device-tree-compiler fastjar flex g++-multilib gawk gcc-multilib gettext git git-core gperf gzip haveged help2man intltool jq 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 libz-dev lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pigz pkgconf python2.7 python3 python3-pip python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools swig tar texinfo uglifyjs unzip upx upx-ucl vim wget xmlto xsltproc xxd xz-utils yasm zip zlib1g-dev zstd
2.下载脚本
cd .. && \
git clone --depth 1 https://github.com/ophub/amlogic-s9xxx-openwrt.git && \
cd amlogic-s9xxx-openwrt && \
mkdir openwrt-armvirt
3.复制rootfs.tar.gz文件
cd .. && \
cp -r 23.05.3/bin/targets/armsr/armv8/immortalwrt-23.05.3-armsr-armv8-generic-rootfs.tar.gz amlogic-s9xxx-openwrt/openwrt-armvirt && \
cd amlogic-s9xxx-openwrt
4.最终打包
sudo ./make -b tpm312 -k 6.1.y
#其它设备示例
#sudo ./make -b smart-am40 -k 6.1.y
#sudo ./make -b tvi3315a -k 6.1.y
#sudo ./make -b s905d -k 6.6.y
5.生成的固件在目录“amlogic-s9xxx-openwrt/openwrt/out”下。
命令显示有问题,建议下载附件阅读
用imagebuilder打包自定义的openwrt精简固件.zip
(2.36 KB, 下载次数: 2)
|
评分
-
查看全部评分
|