From 0a764481ed3e80c4fdc596530bb790899efcf1be Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Thu, 7 Jun 2018 11:24:05 -0700 Subject: sdk-manual: Review edits to the "Autotools-Based Projects" section. Autotools is simpler now as it uses "autoreconf" to one-step a bunch of the existing tools such as aclocal and autoconf. I updated the figure to reflect the simpler flow and also the steps that accompany the figure. (From yocto-docs rev: 380cb1bb89003229befb4715e875586c798d6735) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- .../sdk-manual/figures/sdk-autotools-flow.png | Bin 45736 -> 50443 bytes documentation/sdk-manual/sdk-working-projects.xml | 101 ++++++++------------- 2 files changed, 40 insertions(+), 61 deletions(-) (limited to 'documentation/sdk-manual') diff --git a/documentation/sdk-manual/figures/sdk-autotools-flow.png b/documentation/sdk-manual/figures/sdk-autotools-flow.png index b5e6503967..ec6685f8b6 100644 Binary files a/documentation/sdk-manual/figures/sdk-autotools-flow.png and b/documentation/sdk-manual/figures/sdk-autotools-flow.png differ diff --git a/documentation/sdk-manual/sdk-working-projects.xml b/documentation/sdk-manual/sdk-working-projects.xml index d1249b83a9..f8be5c1528 100644 --- a/documentation/sdk-manual/sdk-working-projects.xml +++ b/documentation/sdk-manual/sdk-working-projects.xml @@ -50,13 +50,22 @@ $ mkdir $HOME/helloworld $ cd $HOME/helloworld - After setting up the directory, populate it with three - simple files needed for the flow. + After setting up the directory, populate it with files + needed for the flow. You need a project source file, a file to help with - configuration, and a file to help create the Makefile: + configuration, and a file to help create the Makefile, + and a README file: hello.c, - configure.ac, and - Makefile.am, respectively: + configure.ac, + Makefile.am, and + README, respectively. + + Use the following command to create an empty README + file, which is required by GNU Coding Standards: + + $ touch README + + Create the remaining three files as follows: hello.c: @@ -108,41 +117,26 @@ $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux - - Generate the Local aclocal.m4 Files: - The following command generates the local - aclocal.m4 files, which are used - later with the autoconf command: - - $ aclocal - - Create the configure Script: - The following command creates the - configure script: - - $ autoconf - - - - Generate Files Needed by GNU Coding - Standards: - GNU coding standards require certain files in order - for the project to be compliant. - This command creates those files: + Use the autoreconf command to + generate the configure script. - $ touch NEWS README AUTHORS ChangeLog - - - - Generate the Makefile.in File: - This command generates the - Makefile.in, which is used later - during cross-compilation: - - $ automake -a + $ autoreconf + The autoreconf tool takes care + of running the other Autotools such as + aclocal, + autoconf, and + automake. + + If you get errors from + configure.ac, which + autoreconf runs, that indicate + missing files, you can use the "-i" option, which + ensures missing auxiliary files are copied to the build + host. + Cross-Compile the Project: @@ -159,33 +153,18 @@ cross-toolchain by just passing the appropriate host option to configure.sh. The host option you use is derived from the name of the - environment setup script found in the directory in which you - installed the cross-toolchain. - For example, the host option for an ARM-based target that uses - the GNU EABI is + environment setup script found in the directory in which + you installed the cross-toolchain. + For example, the host option for an ARM-based target that + uses the GNU EABI is armv5te-poky-linux-gnueabi. You will notice that the name of the script is environment-setup-armv5te-poky-linux-gnueabi. Thus, the following command works to update your project and rebuild it using the appropriate cross-toolchain tools: - $ ./configure --host=armv5te-poky-linux-gnueabi \ - --with-libtool-sysroot=sysroot_dir + $ ./configure --host=armv5te-poky-linux-gnueabi --with-libtool-sysroot=sysroot_dir - - If the configure script results in - problems recognizing the - --with-libtool-sysroot=sysroot-dir - option, regenerate the script to enable the support by - doing the following and then run the script again: - - $ libtoolize --automake - $ aclocal -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal [-I dir_containing_your_project-specific_m4_macros] - $ autoconf - $ autoheader - $ automake -a - - Make and Install the Project: @@ -215,12 +194,12 @@ Execute Your Project: - To execute the project in the shell, simply enter - the name. - You could also copy the binary to the actual target - hardware and run the project there as well: + To execute the project, you would need to run it on your + target hardware. + If your target hardware happens to be your build host, + you could run the project as follows: - $ ./hello + $ ./tmp/usr/local/bin/hello As expected, the project displays the "Hello World!" message. -- cgit v1.2.3-54-g00ecf