
prerequisite$ sudo apt install build-essential git autoconf bison flex texinfo \
help2man gawk libtool-bin libncurses5-dev
$ git clone https://github.com/crosstool-ng/crosstool-ng.git
$ cd crosstool-ng
$ git checkout crosstool-ng-1.26.0
$ ./bootstrap
$ ./configure --enable-local
$ make


./ct-ng list-samples로 툴체인 리스트를 조회할 수 있다.$ ./ct-ng list-samples


arm-cortexa9_neon-linux-gnueabihf 툴체인 설치해보자../ct-ng list-samples에
가 있다. 이 것을 설치해본다../ct-ng arm-cortexa9_neon-linux-gnueabihf
기본적인 설정이 .config에 저장되었다../ct-ng menuconfig를 사용한다.ct-ng menuconfig$ ./ct-ng menuconfig

LOG_DEBUG: DEBUG로 맞춘다. 최대 로그 레벨을 바꾼다./ 키를 눌러 검색하자.

1 번 누르자.
enter키 누르자.
EXTRA로 되어 있는데, DEBUG에서 space바를 누르자.

Save에서 .config에 덮어씌워야 설정이 저장된다.Save에서 space바 누르자.
.config에 덮어씌울꺼냐고 묻는다. Enter 누르자.

여기서 변경하고 싶은 타겟 벤더명 설정한다.hello로 변경

arm-linux로 변경


uClib-ng로 설정해보자.Debug facilities설정

strace설정 해보자..config에 설정을 잘 넣었다면, $ ./ct-ng build를 이용해 툴체인을 빌드한다.
홈 디렉토리에 x-tools디렉토리가 생성된다.



export PATH=$PATH:$HOME/x-tools/arm-hello-linux-uclibcgnueabihf/bin

sample.c$ arm-linux-gcc -o sample sample.c
file 명령어로 바이너리를 찍어보면 ELF 32-bit LSB executable, ARM으로 되어 있다.
당연히 실행은 안되는데, arm용 바이너리이며, /lib/ld-uClibc.so.0은 Target Sysroot에 있다.