개발

make 변수 문법

출처 : http://blog.daum.net/english_100/10 6. 변수 사용법   변수란 문자열을 함유하고 있는 makefile 내에 정의된 이름이다. 이 값은 타깃이나 prerequisite, recipe 등 makefile의 다른 부분에서 치환되어 쓰이게 된다. 변수나 함수는 recipe 에서만 제외하고 makefile을 읽어들일 때 ‘=’의 오른쪽 부분이나 define 지시자의 몸통부분의 값으로 펼쳐진다. 변수에는 파일이름, 컴파일러에게 건네줄 옵션, 실행할 프로그램, 검색할 디렉토리 등등 상상할 수 있는 […]

make 변수 문법 더 읽기"

OpenWRT 이미지 빌드

export KERNEL_SRC_DIR=/home/hasu0707/ib/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_rt305xexport ROOTFS_SRC_DIR=/home/hasu0707/ib/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/root-ramipsexport TOOLCHAIN_BIN_DIR=/home/hasu0707/ib/staging_dir/host/binexport DTS_DIR=/home/hasu0707/ib/target/linux/ramips/dtsexport OUTPUT_DIR=/home/hasu0707/ib/bin/ramips cp -fv ${KERNEL_SRC_DIR}/vmlinux.elf ${OUTPUT_DIR}/openwrt-ramips-rt305x-vmlinux.elfcp -fv ${KERNEL_SRC_DIR}/vmlinux ${OUTPUT_DIR}/openwrt-ramips-rt305x-vmlinux.bin ${TOOLCHAIN_BIN_DIR}/lzma e \${KERNEL_SRC_DIR}/vmlinux \-lc1 -lp2 -pb2 \${KERNEL_SRC_DIR}/vmlinux.bin.lzma cp -fv ${KERNEL_SRC_DIR}/uImage.lzma ${OUTPUT_DIR}/openwrt-ramips-rt305x-uImage.bin ${TOOLCHAIN_BIN_DIR}/mksquashfs4 \${ROOTFS_SRC_DIR} \${KERNEL_SRC_DIR}/root.squashfs \-nopad -noappend -root-owned -comp xz -Xpreset 9 \-Xe -Xlc 0 -Xlp 2 -Xpb 2  -b 256k -p ‘/dev d 755 0 0’ \-p ‘/dev/console c 600 0 0

OpenWRT 이미지 빌드 더 읽기"

kernel compile

export LINUX_SRC_DIR=/home/hasu0707/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_rt305x/linux-3.10.36export INCLUDE_DIR=/home/hasu0707/openwrt/staging_dir/host/includeexport OUTPUT_DIR=/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_rt305x make -C ${LINUX_SRC_DIR} \HOSTCFLAGS=”-O2 -I${INCLUDE_DIR} -Wall -Wmissing-prototypes -Wstrict-prototypes” \CROSS_COMPILE=”mipsel-openwrt-linux-uclibc-” \ARCH=”mips” \KBUILD_HAVE_NLS=no \CONFIG_SHELL=”/bin/bash” \V=” mipsel-openwrt-linux-uclibc-objcopy \-O binary \-R .reginfo \-R .notes \-R .note \-R .comment \-R .mdebug \-R .note.gnu.build-id \-S ${OUTPUT_DIR}/linux-3.10.36/vmlinux \${OUTPUT_DIR}/vmlinux mipsel-openwrt-linux-uclibc-objcopy \-R .reginfo \-R .notes \-R .note \-R .comment \-R .mdebug \-R .note.gnu.build-id \-S ${OUTPUT_DIR}/linux-3.10.36/vmlinux \${OUTPUT_DIR}/vmlinux.elf

kernel compile 더 읽기"

firmware-mod-kit의 펌웨어(bin) 추출과정 설명

■ firmware-mod-kit의 펌웨어(bin) 추출과정 설명 firmware-mod-kit(https://code.google.com/archive/p/firmware-mod-kit/downloads)의 extract-firmware.sh의 동작과정을 설명한다. ■ 필요한 프로그램 fmk/src/binwalk-1.0/src/bin/binwalk-script fmk/unsquashfs_all.sh ■ 추출 과정 1. 쉘스크립트 변수 정의 BINWALK="/opt/fmk/src/binwalk-1.0/src/bin/binwalk-script -v -m /opt/fmk/src/binwalk-1.0/src/binwalk/magic/binwalk" UNSQUASHFS="/opt/fmk/unsquashfs_all.sh" 2. 펌웨어 정보 추출 ${BINWALK} -f bininfo.txt test.bin test.bin의 정보를 bininfo.txt로 출력한다. 정상적으로 실행되면 아래와 같은 내용이 bininfo.txt에 들어있다. Firmware Mod Kit (extract) 0.99, (c)2011-2013 Craig Heffner, Jeremy Collake

firmware-mod-kit의 펌웨어(bin) 추출과정 설명 더 읽기"

dts 파일 컴파일

dts – device tree source textdtb – device tree blob ~/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_rt305x/linux-3.10.36/scripts/dtc/dtc \-O dtb \-o ~/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_rt305x/SR-K100.dtb \~/openwrt/target/linux/ramips/dts/SR-K100.dts

dts 파일 컴파일 더 읽기"

OpenWRT Boot Sequence

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

OpenWRT Boot Sequence 더 읽기"

OpenWRT BuildRoot 빌드 방법

▤ 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 나만의

OpenWRT BuildRoot 빌드 방법 더 읽기"

OpenWRT VLAN 설정

■ 가용한 포트와 상태 보기 # 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

OpenWRT VLAN 설정 더 읽기"

OpenWRT에 pure-ftpd 설치하기

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

OpenWRT에 pure-ftpd 설치하기 더 읽기"

ipTIME N604M

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

ipTIME N604M 더 읽기"

TP-Link TL-WR740N

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

TP-Link TL-WR740N 더 읽기"

OpenWRT StrongSwan IPSec VPN 설정

■ 시험 환경 – 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 Package 제작

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

OpenWRT Package 제작 더 읽기"

OpenWRT Cross Compile

▷ 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

OpenWRT Cross Compile 더 읽기"

위로 스크롤