Bootstrap

ubuntu24部署openwrt编译环境

系统ubuntu24.04

#安装依赖项
sudo apt-get update
sudo apt-get install -y gcc binutils bzip2 flex python3 perl make \
findutils grep diffutils unzip gawk dpkg-dev subversion libz-dev libc6-dev
#顺道安装其他工具
sudo apt-get install -y build-essential libssl-dev libreadline-dev zlib1g-dev \
libncurses5-dev libbz2-dev libsqlite3-dev wget curl llvm git

#下载源码
git clone https://github.com/openwrt/openwrt.git

#切换到需要的分支
git checkout -b kmiot_init f6429577c5110fe3ad5575c797e884e87027726c


./scripts/feeds update -a


./scripts/feeds install -a


make menuconfig

make

版本过新处理方法

Build dependency: Please install the GNU C Compiler (gcc) 4.8 or later
Build dependency: Please install the GNU C++ Compiler (g++) 4.8 or later
Build dependency: Please install the 'file' package

apt-get install gcc-9 g++-9
export CC=/usr/bin/gcc-9
export CXX=/usr/bin/g++-9



apt-get install -y file
# 下载源码压缩包
wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
# 解压
tar -xJf Python-2.7.18.tar.xz

cd Python-2.7.18
# 设置编译选项并写入 Makefile
./configure
# 编译
make

sudo make install

wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
tar -jxvf gcc-4.8.2.tar.bz2

cd gcc-4.8.2


#wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.gz
#tar -xzf gcc-4.8.5.tar.gz
#cd gcc-4.8.5

./contrib/download_prerequisites

mkdir build && cd build

#生成Makefile文件
../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib

#编译(耗时一两个小时)
make -j$(nproc)

sudo make install

;