arm-linux-gnueabihf로 ezboot build 할 때 Makefile 작성법

xaliver의 이미지

안녕하세요.
저는 '도전! 임베디드 OS 만들기'라는 책을 바탕으로 ARM용 OS를 만들려고 합니다.
그런데 첫 빌드부터 막혀서 진행을 못 하고 있네요..;

책이 2009년도 출간되다 보니 컴파일러 버젼도 옛날 것이고 해서 최근 arm-linux-gnueabihf-4.8로 빌드를 해 보고 싶습니다.

그래서 아래와 같이 Makefile을 작성하였는데요.

CC = arm-linux-gnueabihf-gcc-4.8
LD = arm-linux-gnueabihf-ld
OC = arm-linux-gnueabihf-objcopy

CFLAGS = -nostdinc -I. -I../include
CFLAGS += -Wall -Wstrict-prototypes -Wno-trigraphs -O2
CFLAGS += -fno-strict-aliasing -fno-common -pipe
CFLAGS += -mcpu=xscale -msoft-float -fno-builtin

LDFLAGS = -static -nostdlib -nostartfiles -nodefaultlibs -p -X -T ./main-ld-script

OCFLAGS = -O binary -R .note -R .comment -S

all: karlinux.c
$(CC) -C $(CFLAGS) -o entry.o entry.S
$(CC) -C $(CFLAGS) -o gpio.o gpio.c
$(CC) -C $(CFLAGS) -o time.o time.c
$(CC) -C $(CFLAGS) -o vsprintf.o vsprintf.c
$(CC) -C $(CFLAGS) -o printf.o printf.c
$(CC) -C $(CFLAGS) -o string.o string.c
$(CC) -C $(CFLAGS) -o serial.o serial.c
$(CC) -C $(CFLAGS) -o lib1funcs.o lib1funcs.S
$(CC) -C $(CFLAGS) -o karlinux.o karlinux.c
$(LD) $(LDFLAGS) -o karlinux_elf entry.o gpio.o time.o vsprintf.o printf.o string.o serial.o lib1funcs.o karlinux.o
$(OC) $(OCFLAGS) karlinux_elf karlinux_img

clean:
rm *.o
rm karlinux_elf
rm karlinux_img

첫번째 entry.S에서 부터 main을 찾을 수 없다고 합니다.

xaliver@ubuntu:~/Documents/bootloader/Karlinux/main$ make
arm-linux-gnueabihf-gcc-4.8 -C -nostdinc -I. -I../include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mcpu=xscale -msoft-float -fno-builtin -o entry.o entry.S
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/crt1.o: In function `_start':
(.text+0x28): undefined reference to `main'
/tmp/ccWTaTQZ.o: In function `_ram_entry':
(.text+0x0): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
xaliver@ubuntu:~/Documents/bootloader/Karlinux/main$

분명히 karlinux.c 파일에 ina main(void) 함수가 존재하는데 저런 에러가 나네요.

Makefile 어디가 문제인지 잘 모르겠습니다.

일단 책에 나와있는 대로 작성했고 최근 4.8에서 자동으로 enable 된다는 내용은 지웠습니다.
(-mapcs-32, -mshort-load-bytes)

혹시 Makefile을 잘 알고 계신 분이 있다면 도움 부탁드립니다.

감사합니다.

익명 사용자의 이미지

-c 옵션이 전부 빠졌습니다. 책 다시 읽어보세요.

xaliver의 이미지

소문자를 대문자로 오타를 냈네요..
다행히 이제 build가 되네요.
감사합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.