基于lede开发自己的路由器系统openWrt

丁少华 / 2024-01-30 / 原文

搭建linux环境

教程载这里,点击查看

安装编译依赖

更新软件包

sudo apt update -y

可能会存在如下报错:

dsh@debian:~$ sudo apt update -y
忽略:1 cdrom://[Debian GNU/Linux 12.4.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20231210-17:57] bookworm InRelease
错误:2 cdrom://[Debian GNU/Linux 12.4.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20231210-17:57] bookworm Release
  请使用 apt-cdrom,通过它可以让 APT 识别该盘片。apt-get upgdate 不能被用来加入新的盘片。
正在读取软件包列表... 完成
E: 仓库 “cdrom://[Debian GNU/Linux 12.4.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20231210-17:57] bookworm Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

这是因为我们默认的源在debain的光盘里,但是安装完debain系统光盘已经拔走了。所以我们去源配置文件/etc/apt/sources.list将从光盘索取源的配置注释掉,并且增加一些软件源即可。配置完重启下电脑,不然 可能不生效。

# deb cdrom:[Debian GNU/Linux 12.4.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20231210-17:57]/ bookworm main non-free-firmware
deb https://mirrors.huaweicloud.com/debian/ bullseye main non-free contrib
deb https://mirrors.huaweicloud.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.huaweicloud.com/debian/ bullseye-backports main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main non-free contrib
deb https://security.debian.org/debian-security bullseye-security main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ bullseye-updates main contrib
deb-src https://mirrors.huaweicloud.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main non-free contrib
deb-src https://security.debian.org/debian-security bullseye-security main non-free contrib

整体更新软件包

sudo apt full-upgrade -y

安装openWrt编译所需依赖

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

如果不出意外,还是出意外了

E: Unable to correct problems, you have held broken packages.