OpenWRT 빌드환경 구축 (CentOS 6.5 x86_64)
OpenWRT 빌드환경 구축 (CentOS 6.5 x86_64) 더 읽기"
1) Bootloader (uboot, redboot, adam2, grub, …) 2) Linux kernel starts, tries to find the mtd partition called “rootfs”, mounts it 3) Linux executes /etc/preinit 4) Preinit waits a few seconds for failsafe triggering 5) Preinit mounts or initializes the jffs2 overlay 6) Preinit loads kernel modules specified in /etc/modules.d/ 7) Preinit executes hotplug2, a
▤ RT305x 타겟보드를 기준으로 설명. ■ OpenWRT BuildRoot 다운로드 git clone git://git.openwrt.org/openwrt.git ▷종류 별12.09 branch (Attitude Adjustment)git clone git://git.openwrt.org/12.09/openwrt.gitgit clone git://git.openwrt.org/12.09/packages.git ■ 디렉토리를 이동한다. cd openwrt ■ feeds feeds는 OpenWRT 패키지의 업데이트/다운로드/빌드 스크립트.설정파일 : ./feeds.conf.default 최신버전으로 패키지 목록을 업데이트 한다.’-a’ 는 특정 패키지가 아닌 모든 패키지를 의미한다. ./scripts/feeds update -a./scripts/feeds install -a ■ OpenWRT 나만의
■ 가용한 포트와 상태 보기 # swconfig dev rt305x showGlobal attributes: enable_vlan: 1 alternate_vlan_disable: 0Port 0: disable: 0 doubletag: 0 untag: 1 led: 5 lan: 1 recv_bad: 0 recv_good: 0 pvid: 1 link: port:0 link:downPort 1: disable: 0 doubletag: 0 untag: 1 led: 5 lan: 1 recv_bad: 0 recv_good: 21375 pvid: 1 link: port:1 link:up
1. libelf 설치 wget -P /tmp http://192.168.1.2/libelf_0.8.13-1_ramips.ipkopkg install /tmp/libelf_0.8.13-1_ramips.ipk 2. pure-ftpd 설치 wget -P /tmp http://192.168.1.2/pure-ftpd_1.0.32-3_ramips.ipkopkg install /tmp/pure-ftpd_1.0.32-3_ramips.ipk 3. root 패스워드 변경 passwd root이후로는 ssh로만 접속가능 4. /etc/init.d/pure-ftpd restart orpure-ftpd -B 5. /etc/init.d/pure-ftpd enable
wget http://192.168.1.2/openwrt-ramips-rt305x-rt-g32-b1-squashfs-sysupgrade.bin -P /tmpmtd -r write /tmp/openwrt-ramips-rt305x-rt-g32-b1-squashfs-sysupgrade.bin firmwaresysupgrade -v /tmp/openwrt-ramips-rt305x-rt-g32-b1-squashfs-sysupgrade.bin make image PROFILE=”RTG32B1″ PACKAGES=” \base-files \busybox \dnsmasq \dropbear \firewall \hotplug2 \ip \iptables \iw \kernel \kmod-button-hotplug \kmod-cfg80211 \kmod-crypto-aes \kmod-crypto-arc4 \kmod-crypto-core \kmod-eeprom-93cx6 \kmod-gpio-button-hotplug \kmod-input-core \kmod-input-gpio-keys-polled \kmod-input-polldev \kmod-ipt-conntrack \kmod-ipt-core \kmod-ipt-nat \kmod-ipt-nathelper \kmod-leds-gpio \kmod-lib-crc-ccitt \kmod-lib-crc-itu-t \kmod-mac80211 \kmod-nls-base \kmod-ppp \kmod-pppoe \kmod-pppox \kmod-rt2800-lib \kmod-rt2800-pci \kmod-rt2x00-lib \kmod-rt2x00-pci \kmod-rt2x00-soc \libc \libgcc \libgcrypt \libgpg-error
wget http://192.168.1.2/openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-factory.binsysupgrade -v /tmp/openwrt-ar71xx-generic-tl-wr740n-v4-squashfs-factory.bin # origmake image PROFILE=TLWR740 PACKAGES=”base-files busybox dnsmasq dropbear firewall \hotplug2 iptables iw jshn kernel kmod-ath kmod-ath9k kmod-ath9k-common kmod-cfg80211 \kmod-crypto-aes kmod-crypto-arc4 kmod-crypto-core kmod-gpio-button-hotplug \kmod-ipt-conntrack kmod-ipt-core kmod-ipt-nat kmod-ipt-nathelper kmod-leds-gpio \kmod-ledtrig-default-on kmod-ledtrig-netdev kmod-ledtrig-timer -kmod-ledtrig-usbdev kmod-lib-crc-ccitt \kmod-mac80211 kmod-nls-base kmod-ppp kmod-pppoe kmod-pppox -kmod-usb-core -kmod-usb-ohci \-kmod-usb2 kmod-wdt-ath79 libblobmsg-json libc libgcc libip4tc libiwinfo libiwinfo-lua libjson \liblua libnl-tiny libubox
■ 시험 환경 – OpenBSDWAN IP: 10.10.10.51LAN IP : 192.168.10.254LAN Network : 192.168.10.0/24Test PC : 192.168.10.2 – OpenWRT RouterWAN IP : 10.10.10.250LAN IP : 192.168.1.1LAN Network : 192.168.1.0/24Test PC : 192.168.1.2 ■ OpenWRT Router 설정 ▶ /etc/config/ipsec # /etc/config/ipsecconfig ‘ipsec’ option ‘zone’ ‘vpn’ list listen ” config ‘remote’ ‘acme’ option ‘enabled’ ‘1’ option ‘gateway’ ‘10.10.10.51’
OpenWRT StrongSwan IPSec VPN 설정 더 읽기"
OpenWRT SDK 경로 : /home/hasu0707/ar71xx/sdk ■ 준비 작업 $ cd /home/hasu0707/ar71xx/sdk$ make prereq —————————————————————————– ■ /home/hasu0707/ar71xx/sdk/package/hello/src/hello.c—————————————————————————– #include <stdio.h> int main(int argc, char *argv[]){ printf(“Hello, world\n”); return 0;} —————————————————————————– ■ /home/hasu0707/ar71xx/sdk/package/hello/src/Makefile—————————————————————————– hello : hello.c ${CC} -o hello hello.cclean : rm -f hello —————————————————————————– ■ /home/hasu0707/ar71xx/sdk/package/hello/Makefile—————————————————————————– include $(TOPDIR)/rules.mk # Name and release number of this packagePKG_NAME:=helloPKG_RELEASE:=1PKG_VERSION:=0.0.1PKG_CAT:=zcat # This specifies
▷ O/S : CentOS 6.5 x86_64▷ 타겟시스템 : ar71xx▷ SDK 디렉토리 : /home/hasu0707/ar71xx/sdk▷ 테스트 파일 : /home/hasu0707/test/hello.c ■ 필요한 라이브러리 설치 sudo yum -y install glibc.i686sudo yum -y install libstdc++.i686 ■ SDK를 다운로드 http://downloads.openwrt.org/ http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/OpenWrt-SDK-ar71xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 ■ ~/.bash_profile 편집 (밑에 추가) export STAGING_DIR=/home/hasu0707export TOOLCHAIN_DIR=${STAGING_DIR}/toolchainexport PATH=$PATH:$HOME/bin:${TOOLCHAIN_DIR}/binexport AR=${TOOLCHAIN_DIR}/bin/mipsel-openwrt-linux-uclibc-arexport AS=${TOOLCHAIN_DIR}/bin/mipsel-openwrt-linux-uclibc-asexport LD=${TOOLCHAIN_DIR}/bin/mipsel-openwrt-linux-uclibc-ldexport NM=${TOOLCHAIN_DIR}/bin/mipsel-openwrt-linux-uclibc-nmexport CC=mipsel-openwrt-linux-uclibc-gccexport CPP=mipsel-openwrt-linux-uclibc-cppexport GCC=mipsel-openwrt-linux-uclibc-gccexport CXX=mipsel-openwrt-linux-uclibc-g++export RANLIB=mipsel-openwrt-linux-uclibc-ranlibexport LDFLAGS=”-static”export CFLAGS=”-Os
1. file 소스 코드 다운로드 (ftp://ftp.astron.com/pub/file/) 2. ./configure –prefix=/usr && make install 3. rm -f /usr/lib64/libmagic* 4. cp -f /usr/lib/libmagic* /usr/lib64/
CentOS x86_64에 libmagic 최신버전 설치 더 읽기"