openWRT Cross compile

 1export STAGING_DIR=/home/airren/openwrt/staging_dir/toolchain-x86_64_gcc-8.4.0_musl
 2
 3
 4export TOOLCHAIN_DIR=$STAGING_DIR
 5export TOOLCHAIN_PATH=$TOOLCHAIN_DIR/bin
 6export CXX=$TOOLCHAIN_PATH/g++-uc
 7export AR=$TOOLCHAIN_PATH/x86_64-openwrt-linux-musl-ar
 8export CXXFLAGS="-O2"
 9
10
11export CROSSCOMPILE_PATH=$TOOLCHAIN_DIR/usr
12# export CFLAGS="-I$CROSSCOMPILE_PATH/jhhhhinclude"
13
14
15export LDCFLAGS="-L$TOOLCHAIN_DIR/usr/lib -lz"
16export LD_LIBRARY_PATH=$TOOLCHAIN_DIR/usr/lib
17export PATH=$TOOLCHAIN_PATH:$PATH
1./autogen.sh --build=x86_64-pc-linux-gnu --host=i486-openwrt-linux
2./autogen.sh --build=x86_64-pc-linux-gnu --host=x86_64-openwrt-linux
3
4make CC=i486-openwrt-linux-gcc LD=i486-openwrt-linux-ld
5make CC=x86_64-openwrt-linux-gcc LD=x86_64-openwrt-linux-ld

build openwrt in a docker

 1apt update
 2apt install -y git wget  build-essential gawk gcc-multilib flex git gettext libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev
 3
 4apt update
 5apt install build-essential ccache ecj fastjar file g++ gawk \
 6gettext git java-propose-classpath libelf-dev libncurses5-dev \
 7libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \
 8python-distutils-extra python3-setuptools python3-dev rsync subversion \
 9swig time xsltproc zlib1g-dev 
10
11
12
13
14# Update the feeds
15./scripts/feeds update -a
16./scripts/feeds install -a
17
18# Configure the firmware image and the kernel
19make menuconfig