lfs-uefi: fix efivar-37 FTBFS
[linux_from_scratch_hints.git] / lfs70armhint.txt
blobb84cdd5f8aa368737dd131903e610b3d9c2f3cef
1 AUTHOR: Jimmy Anderson <jimmy.anderson1057@gmail.com>
3 DATE: 2011-11-10
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: How to build LFS 7.0 for ARM
9 DESCRIPTION:
11 This hint describes how to build LFS version 7.0 on an ARM system.
13 Most of the LFS book instructions also work, as is, for building an ARM
14 LFS system.   But not all of them.   A few deviations from the instructions 
15 found in the LFS books are needed to build an ARM LFS system.
17 This hint does not describe how to build the ARM kernel or boot
18 loader.   There is a number of variations of bootloader and kernel
19 configurations used on ARM systems.  This hint doesn't try to 
20 address that and so the bootloading and kernel building portions of
21 LFS on ARM are left as an exercise for the reader.  
23 This hint is specifically tested with LFS 7.0 only.   Building other
24 versions of LFS for ARM might be similar to that described in this
25 hint but be aware that this hint is only tested to work with LFS 7.0.
27 ATTACHMENTS:
29 The attachment is a diff of the LFS 7.0 book which contains the 
30 changes to the user command changes that are needed to build for ARM. 
31 The instructions in this hint should be sufficient for building ARM.
32 However the attachment may be useful so the reader more clearly 
33 understands what needs to be done differently for building on the ARM 
34 architecture.  The user could also use the attachment to create 
35 a version of the book which can be used by jhalfs to do an 
36 automated build of an ARM lfs system.
38 PREREQUISITES:
40 An ARM machine running the proper tool set is required to build LFS.   
41 This hint was tested specifically on a Seagate Dockstar which has
42 Arch Linux ARM installed (version approx 8/2011 -- Arch Linux uses a 
43 'rolling release' model).   Crux ARM 2.6 or 2.7 will also likely work
44 as an LFS ARM build host but was not specifically tested.
46 Familiarity with building LFS for x86 machines.  The reader ought to
47 have built LFS for x86 at least once prior to attempting a build for
48 ARM.
50 You will need to download the following additional (besides those
51 already listed in the book...) tarballs to build LFS 7.0 for ARM:
53 u-boot-2011.06.tar.bz2:
55 wget ftp://ftp.denx.de/pub/u-boot/u-boot-2011.06.tar.bz2
57 glibc-ports-2.14.1.tar.bz2:
59 wget http://ftp.gnu.org/gnu/libc/glibc-ports-2.14.1.tar.bz2
62 HINT:
64 Always follow the instructions in the LFS book exactly as written 
65 except for the deviations as described in this hint...
67 JHALFS can be used to build LFS for ARM but the user must download
68 the LFS book, apply the needed ARM changes to it, and then point JHALFS
69 at the modified book to use as a 'working copy'.  Also jhalfs internally
70 generates it's own version of LFS_TARGET that does not work for ARM
71 (at least not the eabi version of ARM) and so, if using jhalfs, you 
72 must change the jhalfs source to make it set LFS_TARGET for ARM as 
73 you need it to be set.   jhalfs is usable for building LFS ARM but 
74 some tweaking is needed to make it work.
76 ----------------------------------------------------------
77 In chapter 4, set your LFS TARGET as needed for ARM:
79 LFS_TGT=$(uname -m)-lfs-linux-gnueabi
81 This specific ARM target builds the 'eabi' version of the system.   
82 Other possible ARM targets exist and may work also but were not tried.  
83 The 'eabi' target, seems to be a more recent and preferred 
84 ARM target.   So, that target is what this hint was developed with.
85 ----------------------------------------------------------
87 ----------------------------------------------------------
88 In chapter 5, gcc pass1, add the ARM include files linux-eabi.h
89 and linux-elf.h to the list of include files to be modified.  i.e.:
91 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h -o -name linux-eabi.h -o -name linux-elf.h)
92 ----------------------------------------------------------
94 ----------------------------------------------------------
95 In chapter 5, glibc, right after unpacking and cd'ing into the
96 glibc source directory, unpack the glibc ports tarball as 
97 follows:
99 tar xvfj ../glibc-ports-2.14.1.tar.bz2; mv glibc-ports-2.14.1 ports
100 ----------------------------------------------------------
102 ----------------------------------------------------------
103 And again, in chapter 6, glibc, unpack the glibc ports tarball as 
104 done in chapter 5.
105 ----------------------------------------------------------
107 ----------------------------------------------------------
108 In chapter 6, zlib, omit '-mstackrealign' from the
109 definition of CFLAGS.   It is an unsupported compiler option on
110 ARM.   
111 ----------------------------------------------------------
113 ----------------------------------------------------------
114 In chapter 6, grub, always skip building grub.
115 It is not needed on ARM and typically will not even compile for 
116 ARM.  You can skip the download of the grub tarball if you like.
117 ----------------------------------------------------------
119 ----------------------------------------------------------
120 At the end of chapter 6, build and install the 'mkimage' tool from 
121 the Das u-boot package:
123 tar xvfj u-boot-2011.06.tar.bz2
124 cd u-boot-2011.06
125 make tools-all
126 cp tools/mkimage /usr/bin
127 cd .. ;rm -fr u-boot-2011.06
129 U-boot is often used as the bootloader on ARM boards.    The 'mkimage' 
130 tool is needed when building a kernel that is will be booted by u-boot.
131 Thus, the mkimage utility is typically needed for building ARM kernels.   If 
132 your kernel build does not utilize the 'mkimage' utility, then you
133 can just skip it.   (Although mkimage is a quick build and 
134 it does no harm even when not needed...).
135 ----------------------------------------------------------
139 Be prepared for a long build.   On a 1.2Ghz ARM system it took 
140 about 48 hours of continuous building to complete the build of 
141 LFS 7.0 (including all final system test suites...).   
143 The test suites in an ARM build have more failures than is seen
144 when building for X86.  However, the resulting system runs without any
145 obvious problems.   
148 ACKNOWLEDGEMENTS:
150 The excellent work of the LFS development team.
152 CHANGELOG:
153 [2011-11-10]
154   * Initial hint.