diff options
| author | Scott Rifenbark <srifenbark@gmail.com> | 2018-06-07 11:24:05 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-06-15 11:26:47 +0100 |
| commit | 0a764481ed3e80c4fdc596530bb790899efcf1be (patch) | |
| tree | f4da425e0daeee3f5b0ab93cc726519a505f872c /documentation | |
| parent | b15903d61b40f43b29b2a8cf24ec6fb449e53d32 (diff) | |
| download | poky-0a764481ed3e80c4fdc596530bb790899efcf1be.tar.gz | |
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 <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
| -rw-r--r-- | documentation/mega-manual/figures/sdk-autotools-flow.png | bin | 45736 -> 50443 bytes | |||
| -rw-r--r-- | documentation/sdk-manual/figures/sdk-autotools-flow.png | bin | 45736 -> 50443 bytes | |||
| -rw-r--r-- | documentation/sdk-manual/sdk-working-projects.xml | 101 |
3 files changed, 40 insertions, 61 deletions
diff --git a/documentation/mega-manual/figures/sdk-autotools-flow.png b/documentation/mega-manual/figures/sdk-autotools-flow.png index b5e6503967..ec6685f8b6 100644 --- a/documentation/mega-manual/figures/sdk-autotools-flow.png +++ b/documentation/mega-manual/figures/sdk-autotools-flow.png | |||
| Binary files differ | |||
diff --git a/documentation/sdk-manual/figures/sdk-autotools-flow.png b/documentation/sdk-manual/figures/sdk-autotools-flow.png index b5e6503967..ec6685f8b6 100644 --- a/documentation/sdk-manual/figures/sdk-autotools-flow.png +++ b/documentation/sdk-manual/figures/sdk-autotools-flow.png | |||
| Binary files 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 @@ | |||
| 50 | $ mkdir $HOME/helloworld | 50 | $ mkdir $HOME/helloworld |
| 51 | $ cd $HOME/helloworld | 51 | $ cd $HOME/helloworld |
| 52 | </literallayout> | 52 | </literallayout> |
| 53 | After setting up the directory, populate it with three | 53 | After setting up the directory, populate it with files |
| 54 | simple files needed for the flow. | 54 | needed for the flow. |
| 55 | You need a project source file, a file to help with | 55 | You need a project source file, a file to help with |
| 56 | configuration, and a file to help create the Makefile: | 56 | configuration, and a file to help create the Makefile, |
| 57 | and a README file: | ||
| 57 | <filename>hello.c</filename>, | 58 | <filename>hello.c</filename>, |
| 58 | <filename>configure.ac</filename>, and | 59 | <filename>configure.ac</filename>, |
| 59 | <filename>Makefile.am</filename>, respectively: | 60 | <filename>Makefile.am</filename>, and |
| 61 | <filename>README</filename>, respectively.</para> | ||
| 62 | |||
| 63 | <para> Use the following command to create an empty README | ||
| 64 | file, which is required by GNU Coding Standards: | ||
| 65 | <literallayout class='monospaced'> | ||
| 66 | $ touch README | ||
| 67 | </literallayout> | ||
| 68 | Create the remaining three files as follows: | ||
| 60 | <itemizedlist> | 69 | <itemizedlist> |
| 61 | <listitem><para> | 70 | <listitem><para> |
| 62 | <emphasis><filename>hello.c</filename>:</emphasis> | 71 | <emphasis><filename>hello.c</filename>:</emphasis> |
| @@ -109,40 +118,25 @@ | |||
| 109 | </literallayout> | 118 | </literallayout> |
| 110 | </para></listitem> | 119 | </para></listitem> |
| 111 | <listitem><para> | 120 | <listitem><para> |
| 112 | <emphasis>Generate the Local <filename>aclocal.m4</filename> Files:</emphasis> | ||
| 113 | The following command generates the local | ||
| 114 | <filename>aclocal.m4</filename> files, which are used | ||
| 115 | later with the <filename>autoconf</filename> command: | ||
| 116 | <literallayout class='monospaced'> | ||
| 117 | $ aclocal | ||
| 118 | </literallayout> | ||
| 119 | </para></listitem> | ||
| 120 | <listitem><para> | ||
| 121 | <emphasis>Create the <filename>configure</filename> Script:</emphasis> | 121 | <emphasis>Create the <filename>configure</filename> Script:</emphasis> |
| 122 | The following command creates the | 122 | Use the <filename>autoreconf</filename> command to |
| 123 | <filename>configure</filename> script: | 123 | generate the <filename>configure</filename> script. |
| 124 | <literallayout class='monospaced'> | ||
| 125 | $ autoconf | ||
| 126 | </literallayout> | ||
| 127 | </para></listitem> | ||
| 128 | <listitem><para> | ||
| 129 | <emphasis>Generate Files Needed by GNU Coding | ||
| 130 | Standards:</emphasis> | ||
| 131 | GNU coding standards require certain files in order | ||
| 132 | for the project to be compliant. | ||
| 133 | This command creates those files: | ||
| 134 | <literallayout class='monospaced'> | 124 | <literallayout class='monospaced'> |
| 135 | $ touch NEWS README AUTHORS ChangeLog | 125 | $ autoreconf |
| 136 | </literallayout> | ||
| 137 | </para></listitem> | ||
| 138 | <listitem><para> | ||
| 139 | <emphasis>Generate the <filename>Makefile.in</filename> File:</emphasis> | ||
| 140 | This command generates the | ||
| 141 | <filename>Makefile.in</filename>, which is used later | ||
| 142 | during cross-compilation: | ||
| 143 | <literallayout class='monospaced'> | ||
| 144 | $ automake -a | ||
| 145 | </literallayout> | 126 | </literallayout> |
| 127 | The <filename>autoreconf</filename> tool takes care | ||
| 128 | of running the other Autotools such as | ||
| 129 | <filename>aclocal</filename>, | ||
| 130 | <filename>autoconf</filename>, and | ||
| 131 | <filename>automake</filename>. | ||
| 132 | <note> | ||
| 133 | If you get errors from | ||
| 134 | <filename>configure.ac</filename>, which | ||
| 135 | <filename>autoreconf</filename> runs, that indicate | ||
| 136 | missing files, you can use the "-i" option, which | ||
| 137 | ensures missing auxiliary files are copied to the build | ||
| 138 | host. | ||
| 139 | </note> | ||
| 146 | </para></listitem> | 140 | </para></listitem> |
| 147 | <listitem><para> | 141 | <listitem><para> |
| 148 | <emphasis>Cross-Compile the Project:</emphasis> | 142 | <emphasis>Cross-Compile the Project:</emphasis> |
| @@ -159,33 +153,18 @@ | |||
| 159 | cross-toolchain by just passing the appropriate host | 153 | cross-toolchain by just passing the appropriate host |
| 160 | option to <filename>configure.sh</filename>. | 154 | option to <filename>configure.sh</filename>. |
| 161 | The host option you use is derived from the name of the | 155 | The host option you use is derived from the name of the |
| 162 | environment setup script found in the directory in which you | 156 | environment setup script found in the directory in which |
| 163 | installed the cross-toolchain. | 157 | you installed the cross-toolchain. |
| 164 | For example, the host option for an ARM-based target that uses | 158 | For example, the host option for an ARM-based target that |
| 165 | the GNU EABI is | 159 | uses the GNU EABI is |
| 166 | <filename>armv5te-poky-linux-gnueabi</filename>. | 160 | <filename>armv5te-poky-linux-gnueabi</filename>. |
| 167 | You will notice that the name of the script is | 161 | You will notice that the name of the script is |
| 168 | <filename>environment-setup-armv5te-poky-linux-gnueabi</filename>. | 162 | <filename>environment-setup-armv5te-poky-linux-gnueabi</filename>. |
| 169 | Thus, the following command works to update your project | 163 | Thus, the following command works to update your project |
| 170 | and rebuild it using the appropriate cross-toolchain tools: | 164 | and rebuild it using the appropriate cross-toolchain tools: |
| 171 | <literallayout class='monospaced'> | 165 | <literallayout class='monospaced'> |
| 172 | $ ./configure --host=armv5te-poky-linux-gnueabi \ | 166 | $ ./configure --host=armv5te-poky-linux-gnueabi --with-libtool-sysroot=<replaceable>sysroot_dir</replaceable> |
| 173 | --with-libtool-sysroot=<replaceable>sysroot_dir</replaceable> | ||
| 174 | </literallayout> | 167 | </literallayout> |
| 175 | <note> | ||
| 176 | If the <filename>configure</filename> script results in | ||
| 177 | problems recognizing the | ||
| 178 | <filename>--with-libtool-sysroot=</filename><replaceable>sysroot-dir</replaceable> | ||
| 179 | option, regenerate the script to enable the support by | ||
| 180 | doing the following and then run the script again: | ||
| 181 | <literallayout class='monospaced'> | ||
| 182 | $ libtoolize --automake | ||
| 183 | $ aclocal -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal [-I <replaceable>dir_containing_your_project-specific_m4_macros</replaceable>] | ||
| 184 | $ autoconf | ||
| 185 | $ autoheader | ||
| 186 | $ automake -a | ||
| 187 | </literallayout> | ||
| 188 | </note> | ||
| 189 | </para></listitem> | 168 | </para></listitem> |
| 190 | <listitem><para> | 169 | <listitem><para> |
| 191 | <emphasis>Make and Install the Project:</emphasis> | 170 | <emphasis>Make and Install the Project:</emphasis> |
| @@ -215,12 +194,12 @@ | |||
| 215 | </para></listitem> | 194 | </para></listitem> |
| 216 | <listitem><para> | 195 | <listitem><para> |
| 217 | <emphasis>Execute Your Project:</emphasis> | 196 | <emphasis>Execute Your Project:</emphasis> |
| 218 | To execute the project in the shell, simply enter | 197 | To execute the project, you would need to run it on your |
| 219 | the name. | 198 | target hardware. |
| 220 | You could also copy the binary to the actual target | 199 | If your target hardware happens to be your build host, |
| 221 | hardware and run the project there as well: | 200 | you could run the project as follows: |
| 222 | <literallayout class='monospaced'> | 201 | <literallayout class='monospaced'> |
| 223 | $ ./hello | 202 | $ ./tmp/usr/local/bin/hello |
| 224 | </literallayout> | 203 | </literallayout> |
| 225 | As expected, the project displays the "Hello World!" | 204 | As expected, the project displays the "Hello World!" |
| 226 | message. | 205 | message. |
