ubuntu22.04 交叉编译openwrt
国内源
vi /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
安装所需工具
sudo apt install build-essential libncurses5-dev zlib1g-dev
sudo apt install gawk gcc-multilib flex git gettext libssl-dev
sudo apt install python3-distutils
更新所需的库
进入openwrt-21.02.3
./scripts/feeds update -a
./scripts/feeds install -a
配置所需的模块 Target image选 iso(virtualbox 的vdi会报错)
make menuconfig
#编译:显示编译信息,-j2 使用2核编译
make V=s -j2
生成镜像的目录 openwrt-21.02.3/bin/targets/x86/64
应用helloword 编写
生成的ipk目录 openwrt-21.02.3/bin/packages/x86_64/base
openwrt配置
修改网络为dhcp /etc/config/network
重启网络 /etc/init.d/network restart