Ref. https://linuxspot.tistory.com/45

make 는 실제로 소스를 컴파일하는 명령어입니다. make install은 make 명령어를 통해 빌드된 바이너리와 라이브러리를 prefix(configure 스크립트의 옵션 중 하나)로 지정된 폴더에 설치하는 명령어입니다. 

 

현재 개발중인 소스에 Autotools를 적용하려면 다음의 두 파일을 작성해야 됩니다. 

 

'Makefile.am'                 An input to automake  

'configure.ac'                 An input to autoconf

Makefile.am은 automake 명령어의 입력으로 사용되는데, automake는 Makefile.am을 기반으로 Makefile.in 파일을 생성합니다. Makefile.in은 Makefile을 생성하기위한 템플릿이라고 보면 될 것 같습니다. 

 

configure.ac는 autoconf 명령어의 입력으로 사용되는 파일입니다. 내부적으로 복잡한 과정을 거치지만 결과적으로 configure 스크립트를 생성하게 됩니다. configure.ac의 경우 autoscan 이라는 명령어를 통해 configure.scan 이라는 기본 파일을 생성할 수 있습니다. 일반적으로 configure.scan 파일을 configure.ac로 복사한 후 필요한 옵션들을 추가하는 방법을 사용합니다.

 

 

1.code 작성

2.autotool

  • $autoscan
  • configure.scan에서 아래내용을 수정후 파일명을 configure.ac로 변경
  • Makefile.am 생성
  • $autoreconf --install
  • $./configure
  • make

 

Example) Hello1

Tutorial

Learning the GNU developement tools에 나와있는 예제를 바탕으로 간단한 tutorial을 소개하겠습니다. (http://autotoolset.sourceforge.net/tutorial.html#SEC50)

작업 디레토리를 hello로 생성 한 뒤, 아래의 파일들을 생성합니다. 

 

hello/Makefile.am

SUBDIRS = src

 

hello/src/hello.c 

#include <stdio.h>

 

int main(void)

{

printf("Hello autotools\n");

return 0;

}

 

hello/src/Makefile.am

bin_PROGRAMS = hello

hello_SOURCES = hello.c

 

hello 폴더에 있는 Makefile.am은 SUBDIRS 변수를 이용해 source가 있는 하위 디렉토리(src)를 설정합니다. 여러 폴더에 소스가 있는 경우 상위 폴더에서 위와 같이 작성하면 빌드시 재귀적으로 Makefile이 수행 됩니다. 

 

src 폴더의 Makefile.am는 실제 컴파일 될 소스와 target을 작성합니다. 위의 경우 실행파일 hello를 생성할 것이며 hello 바이너리를 생성하기 위한 source로 hello.c 파일을 컴파일 한다는 의미입니다. 

 

이제 configure.ac 파일을 만들기 위해서 autoscan 명령어를 입력합니다. 

 

hello $] autoscan 

 

autoscan 입력 후 configure.scan 파일이 생성된 것을 확인할 수 있습니다. 

 

hello $] ls 

autoscan.log  configure.scan  Makefile.am  src

 

configure.scan 파일을 configure.ac로 복사한 후, 편집기로 configure.ac 파일에 다음을 추가합니다.

 

 

[configure.scan]

 

[configure.ac]

#                                               -*- Autoconf -*-

# Process this file with autoconf to produce a configure script.

 

AC_PREREQ(2.61)

AC_INIT(hello, 1.0, bug@repot-address.com)

AM_INIT_AUTOMAKE(hello, 1.0)

AC_CONFIG_SRCDIR([src/hello.c])

AC_CONFIG_HEADER([config.h])

 

# Checks for programs.

AC_PROG_CC

 

# Checks for libraries.

 

# Checks for header files.

 

# Checks for typedefs, structures, and compiler characteristics.

 

# Checks for library functions.

 

AC_CONFIG_FILES([Makefile

                  src/Makefile])

AC_OUTPUT

 

'잘좀하자 개발 > Yocto' 카테고리의 다른 글

[AutoTool] Troubleshooting  (0) 2019.10.17
[AutoTool] #1 Install  (0) 2019.10.17
[Bitbake] CMD  (0) 2019.10.17
[BitBake] Tutorial  (0) 2019.03.12
Posted by kissuu
,

AutoTools 란 GNU Build System을 의미합니다. 유닉스와 비슷한 OS에서 source code를 빌드하는데 도움을 주는 프로그램 도구를 말합니다.

 

일반적으로 Autotools GNU 에서 제공하는 utility Autoconf, AutoMake, Libtool 말합니다.

이번 포스트의 주제는 Autotools 설치하는 방법에 대해서 포스팅 하겠습니다

GNU에서 꾸준히 업데이트를 해주고 있기 때문에 독자께서 읽으시는 때의 버젼은 제가 이글을 작성하는 시점보다 개선된 프로그램을 설치하는 것이 좋겠습니다.

프로그램의 버젼확인을 다음에서 할수 있습니다.

1. autoconf

http://ftp.gnu.org/gnu/autoconf/

2. automake

http://ftp.gnu.org/gnu/automake/

3. libtool

http://ftp.gnu.org/gnu/libtool/

 

출처: <http://nomorefaster.blogspot.com/2014/03/autotools.html>

'잘좀하자 개발 > Yocto' 카테고리의 다른 글

[AutoTool] Troubleshooting  (0) 2019.10.17
[AutoTool] #2 Tutorial  (0) 2019.10.17
[Bitbake] CMD  (0) 2019.10.17
[BitBake] Tutorial  (0) 2019.03.12
Posted by kissuu
,

WHAT

Option

CMD & Description

build

-c build

$ bitbake -c build [receipe]

To clean a single package, type

compile

 

$ bitbake -c compile -f [receipe]

 

참고)git에서 source tmp 받아두고 local에서 수정 build에도 유용

$ bitbake -c patch virtual/kernel

$ bitbake -c compile -f virtual/kernel

(option) $ bitbake -c install -f virtual/kernel

(option) $ bitbake -c package -f virtual/kernel

출처: <http://forum.falinux.com/zbxe/?mid=lecture_tip&page=4&l=tr&document_srl=828316&m=1>

 

 

 

 

clean

-c clean

$ bitbake -c clean [receipe]

To clean a single package, type

debugging

 -vDDD

 

$ bitbake -vDDD world

--debug           Increase the debug level. You can specify this more

                        than once. -D sets the debug level to 1, where only

                        bb.debug(1, ...) messages are printed to stdout; -DD

                        sets the debug level to 2, where both bb.debug(1, ...)

                        and bb.debug(2, ...) messages are printed; etc.

                        Without -D, no debug messages are printed. Note that

                        -D only affects output to stdout. All debug messages

                        are written to ${T}/log.do_taskname, regardless of the

                        debug level.

 

-s

--show-version

$ bitbake -s world

--show-versions   Show current and preferred versions of all recipes.

변수 정보

-e

$ bitbake -e emptytest > env.txt

Debugging?

 

$ bitbake -c devshell emptytest

 

Image 어디 있을까?

$bitbake -e [receipe] | grep ^S=

 

$ bitbake -e linux-quic | grep "DEPLOY_DIR_IMAGE"

$bitbake -e busybox | grep ^S=

Log

Where do I find build logs?

 

bitbake -e <recipename> | grep ^T=

 

출처: <https://wiki.yoctoproject.org/wiki/Technical_FAQ#Where_do_I_find_build_logs.3F>

 

 

Warning

WARNING: /data001/kisoo.bang/work/01.src/PRJ/sources/meta-[PRJ]/recipes-kernel/linux/linux-imx_4.9.88.bb: Variable do_test_print contains tabs, please remove these (/data001/kisoo.bang/work/01.src/PRJ/sources/meta-[PRJ]/recipes-kernel/linux/linux-imx_4.9.88.bb)

Tab 없애야

'잘좀하자 개발 > Yocto' 카테고리의 다른 글

[AutoTool] Troubleshooting  (0) 2019.10.17
[AutoTool] #2 Tutorial  (0) 2019.10.17
[AutoTool] #1 Install  (0) 2019.10.17
[BitBake] Tutorial  (0) 2019.03.12
Posted by kissuu
,