logo

한국어

OpenWRT 빌드환경 구축 (Ubuntu)

관리자 2018.04.16 15:58 조회 수 : 93

1. SDK 다운로드 (toolchain 포함)

http://downloads.openwrt.org/ 에서 원하는 target에 대한 SDK를 다운로드.

예) bcm53xx target에 대한 SDK 다운로드 링크
http://downloads.openwrt.org/releases/17.01.4/targets/bcm53xx/generic/lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz

다운 로드 후 아래의 명령으로 압축을 해제한다.

export SDKFILE=lede-sdk-17.01.4-bcm53xx_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64
tar xJf ${SDKFILE}.tar.xz
ln -s ${SDKFILE}/ sdk
rm -f ${SDKFILE}.tar.xz

2. 환경변수 설정

~/.profile에 추가한다.

export OPENWRT_ARCH=arm
export OPENWRT_TARGET=bcm53xx
export OPENWRT_BASE_DIR=/work

export OPENWRT_SRC_DIR=${OPENWRT_BASE_DIR}/openwrt
export STAGING_DIR=${OPENWRT_BASE_DIR}/sdk/staging_dir/toolchain-arm_cortex-a9_gcc-5.4.0_musl-1.1.16_eabi
export PATH=${PATH}:${HOME}/bin:${STAGING_DIR}/bin:${OPENWRT_BASE_DIR}/fmk
export AR=${STAGING_DIR}/bin/${OPENWRT_ARCH}-openwrt-linux-ar
export AS=${STAGING_DIR}/bin/${OPENWRT_ARCH}-openwrt-linux-as
export LD=${STAGING_DIR}/bin/${OPENWRT_ARCH}-openwrt-linux-ld
export NM=${STAGING_DIR}/bin/${OPENWRT_ARCH}-openwrt-linux-gcc-nm
export CC=${OPENWRT_ARCH}-openwrt-linux-gcc
export CPP=${OPENWRT_ARCH}-openwrt-linux-cpp
export GCC=${OPENWRT_ARCH}-openwrt-linux-gcc
export CXX=${OPENWRT_ARCH}-openwrt-linux-c++
export RANLIB=${OPENWRT_ARCH}-openwrt-linux-ranlib
export LDFLAGS="-static"
export CFLAGS="-Os -s"

3. ubuntu에 필요한 패키지 설치
apt-get update
apt-get install -y git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev ccache gettext xsltproc wget liblzma-dev python-magic
apt-get install -y binwalk
apt-get install -y qemu
apt-get install -y subversion mercurial

4. openwrt 소스코드 업데이트
unset AR AS LD NM CC CP GCC CXX RANLIB LDFLAGS CFLAGS
git clone https://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
#make menuconfig

5. Firmware Mod Kit 설치
unset AR AS LD NM CC CP GCC CXX RANLIB LDFLAGS CFLAGS
git clone https://github.com/rampageX/firmware-mod-kit.git
mv firmware-mod-kit fmk
cd fmk/src
./configure
make
cd ../../
번호 제목 날짜 조회 수
8 OpenWRT VLAN 설정 2014.05.14 229
7 OpenWRT에 pure-ftpd 설치하기 2014.05.04 32
6 ipTIME N604M 2014.05.03 178
5 TP-Link TL-WR740N 2014.05.03 44
4 OpenWRT StrongSwan IPSec VPN 설정 file 2014.05.02 135
3 OpenWRT Package 제작 2014.05.02 55
2 OpenWRT Cross Compile 2014.05.01 328
1 CentOS x86_64에 libmagic 최신버전 설치 2014.04.25 18