4 @setfilename gllfsc-pentium4-1.7.info
5 @settitle GNU/Linux-libre from source code for Pentium 4
6 @c Comment the following if you want Letter format instead of A4 for
10 @c Book headers for PDF version
11 @setchapternewpage odd
12 @documentencoding UTF-8
15 This is edition 1.7 (last updated April 2020) of
16 @cite{GNU/Linux-libre from source code for Pentium 4}.
18 Copyright @copyright{} 2020 Christophe Jarry.
21 This document is based on the Chinese page
22 @url{http://zdbr.net.cn/download/Loongson64-@/2.0.htm}, which is
23 copyright @copyright{} 2009
24 @c Because TeX does not handle Chinese fonts automatically, we need to
32 His blog is on @url{http://blog.chinaunix.net/uid/436750.html}.
35 Various formats of this manual as well as its texinfo source are
37 @uref{http://cjarry.org/gnu-linux/gllfsc/pentium4/}.
40 Permission is granted to copy, distribute and/or modify this document
41 under the terms of the GNU Free Documentation License, Version 1.3
42 or any later version published by the Free Software Foundation;
43 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
44 Texts. A copy of the license is included in the section entitled ``GNU
45 Free Documentation License''.
49 Computer instructions in this manual are free software: you can
50 redistribute them and/or modify them under the terms of the GNU
51 General Public License as published by the Free Software Foundation,
52 either version 3 of the License, or (at your option) any later
55 Those instructions are distributed in the hope that they will be
56 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
57 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58 GNU General Public License for more details.
60 You should have received a copy of the GNU General Public License
61 along with this manual. If not, see <http://www.gnu.org/licenses/>.
66 @c @setchapternewpage odd
69 @title GNU/Linux-libre from source code
70 @subtitle for Pentium 4
71 @c @subtitle SUBTITLE-IF-ANY
72 @c @subtitle SECOND-SUBTITLE
73 @author Christophe Jarry
75 @c The following two commands
76 @c start the copyright page.
78 @vskip 0pt plus 1filll
84 @c Short table of contents
87 @c So the toc is printed at the start.
92 @top GNU/Linux-libre from source code for Pentium 4
94 This manual describes how to build a GNU/Linux-libre system from
95 source for Pentium 4 processor.
101 * Introduction:: What this document is all about.
102 * Prerequisites:: Useful knowledge before proceeding.
103 * Preliminary Work:: Preparing the build.
104 * Building the Cross-Compilation Toolchain:: Building the cross-
105 compilation Toolchain.
106 * Building the Cross-Compilation Tools:: Building the
107 cross-compilation Tools.
108 * Building the Target System:: How to build the target system.
109 * Configuration Files:: Creating configuration files
110 needed by the new system.
111 * Before Booting GLLFSC:: Final things to do before booting
113 * After Booting GLLFSC:: Some packages to install and
114 configuration to tweek in order
115 to extend the system.
116 * Further Readings:: Websites useful to know more.
117 @c * Thanks:: Thanks.
118 * GNU Free Documentation License:: Your rights and freedoms with the
120 * GNU General Public License:: Your rights and freedoms with the
126 @chapter Introduction
129 * GNU/Linux History:: A brief history of GNU/Linux.
130 * Purpose of this Document:: What this document is all about.
134 @node GNU/Linux History
135 @section GNU/Linux History
138 * GNU:: Presentation of the GNU project
139 * HURD:: Presentation of the HURD
140 * Linux:: Presentation of the kernel Linux
141 * Linux-libre:: Presentation of the kernel Linux-libre
142 * References:: Where to get more information
148 @acronym{GNU} (GNU's Not Unix) is a project launched by Richard
149 Stallman in 1984 with the goal of building an entirely free operating
150 system compatible with Unix@footnote{See
151 @uref{http://en.wikipedia.org/wiki/Unix}}. ``Free'' here means ``free
152 as in freedom''. In this context, a free operating system is an
153 operating system you can use and share in freedom. A core part of his
154 motivation is given in the GNU
155 Manifesto@footnote{@uref{http://www.gnu.org/gnu/manifesto.html}}:
158 I consider that the Golden Rule requires that if I like a program I
159 must share it with other people who like it. Software sellers want to
160 divide the users and conquer them, making each user agree not to share
161 with others. I refuse to break solidarity with other users in this
162 way. I cannot in good conscience sign a nondisclosure agreement or a
163 software license agreement. For years I worked within the Artificial
164 Intelligence Lab to resist such tendencies and other inhospitalities,
165 but eventually they had gone too far: I could not remain in an
166 institution where such things are done for me against my will.
168 So that I can continue to use computers without dishonor, I have
169 decided to put together a sufficient body of free software so that I
170 will be able to get along without any software that is not free. I
171 have resigned from the AI Lab to deny MIT any legal excuse to prevent
172 me from giving GNU away.
175 A program is free software if the program's user has the four
180 The freedom to run the program, for any purpose (freedom 0).
183 The freedom to study how the program works, and change it so it does
184 her computing as she wishes (freedom 1). Access to the source code is
185 a precondition for this.
188 The freedom to redistribute copies so she can help her neighbor
192 The freedom to distribute copies of her modified versions to others
193 (freedom 3). By doing this she can give the whole community a chance
194 to benefit from her changes. Access to the source code is a
195 precondition for this.
198 One of the most popular free software license is the GNU General
200 GPL@footnote{@uref{http://www.gnu.org/licenses/gpl.html}}).
202 The free software movement is supported by the Free Software
203 Foundation (FSF@footnote{@uref{http://www.fsf.org}}).
209 The @acronym{HURD} is an acronym for @acronym{HIRD} (HURD of
210 interfaces representing depth) of Unix-replacing daemons. It is the
211 GNU project's replacement for the Unix kernel. It is a collection of
212 servers that run on the Mach microkernel to implement file systems,
213 network protocols, file access control, and other features that are
214 implemented by the Unix kernel or similar kernels (such as Linux).
216 The purpose of the GNU HURD is to improve the user's freedom on her
217 operating system by allowing her to either add or remove a feature of
218 the kernel on the fly.
220 From early on, the HURD was developed to use GNU Mach as the
221 microkernel. This was a technical decision made by Richard Stallman,
222 who thought it would speed up the work by saving a large part of
223 it. He has admitted that he was wrong about that.
225 Nevertheless, development of the HURD is increasingly attracting
226 developers and GNU/HURD systems exist and are usable.
232 Linux is a monolithic kernel created by Linus Torvalds in 1991. Linus
233 Torvalds initially wrote a terminal emulator, which he used to access
234 the large UNIX servers of his university. He wrote the program
235 specifically for the hardware he was using and independent of an
236 operating system because he wanted to use the functions of his new PC
237 with an 80386 processor. This later became the kernel Linux.
239 Initially, Torvalds first published the kernel Linux under its own
240 licence, which had a restriction on commercial activity.
242 In the notes for the first release of the kernel Linux, Torvalds lists
243 the GNU software that is required to run Linux:
246 Sadly, a kernel by itself gets you nowhere. To get a working system
247 you need a shell, compilers, a library etc. [...] Most of the tools
248 used with linux are GNU software and are under the GNU copyleft.
251 In 1992, he suggested releasing the kernel under the GNU General
252 Public License. He first announced this decision in the release notes
253 of version 0.12. In the middle of December 1992 he published version
254 0.99 using the GNU GPL.
256 The kernel Linux is now a contribution of many professionals and
257 volonteers around the world.
261 @subsection Linux-libre
263 Linux, the kernel developed and distributed by Linus Torvalds et al,
264 contains non-Free Software@footnote{For more information about the
265 presence of proprietary firmware in the kernel Linux, read
266 @uref{http://www.fsfla.org/ikiwiki/anuncio/2010-03-Linux-2.6.33-libre.en}
268 @uref{http://www.gnu.org/@/distros/free-system-distribution-guidelines.html#nonfree-firmware}.},
269 i.e., software that does not respect your essential freedoms, and it
270 induces you to install additional non-Free Software that it doesn't
274 Linux-libre@footnote{@uref{http://www.fsfla.org/ikiwiki/selibre/linux-libre/index.en.html}}
275 is a project to maintain and publish 100% Free distributions of Linux,
276 suitable for use in Free System Distributions@footnote{For a full list
277 of free as in freedom GNU/Linux distributions, see
278 @uref{http://www.gnu.org/distros/}.}, removing software that is
279 included without source code, with obfuscated or obscured source code,
280 under non-Free Software licenses, that do not permit you to change the
281 software so that it does what you wish, and that induces or requires
282 you to install additional pieces of non-Free Software.
286 @subsection References
288 For more information on the GNU project and its relation with the
289 kernel Linux, you can read @uref{http://www.gnu.org/gnu/thegnuproject.html}
290 and @uref{http://www.gnu.org/gnu/gnu-linux-faq.html}.
292 For more information on the history of the HURD, I recommend you to
293 read @uref{http://www.h-online.com/open/features/GNU-HURD-Altered-visions-and-lost-promise@/-1030942.html}.
295 For more information on the HURD, read @uref{http://www.gnu.org/software/hurd/}.
297 For more information on the early versions of the kernel Linux, read
298 @uref{https://www.cs.cmu.edu/~awb/linux.history.html}.
301 @node Purpose of this Document
302 @section Purpose of this Document
304 One day I found a Dell Optiplex 745 minitower with a Pentium 4 CPU in
305 a municipal waste. I just replaced the button battery and the computer
306 was able to boot. I decided to adapt the work I did for the Lemote
307 Yeeloong 8133: GNU/Linux@footnote{Note: in this document, we use the
308 term ``GNU/Linux'' to name the entire system and ``Linux'' to name the
309 kernel. For more information, read
310 @uref{http://www.gnu.org/gnu/why-gnu-linux.html}.} Libre from Source
311 Code for Pentium 4 was born.
315 @chapter Prerequisites
318 * Definitions:: Definitions of important notions used to build the
320 * Commands:: Help on commands
328 * sysroot:: @option{sysroot}
329 * Toolchain:: What a Toolchain is.
330 * build host target:: Understanding the meaning of the
331 @option{build}-@option{host}-@option{target}
333 * FHS:: The Filesystem Hierarchy Standard.
338 @subsection @option{sysroot}
340 The traditional way of building a GNU/Linux operating system consists
341 on building a (cross-) compilation toolchain to build a temporary
342 operating system which in turn will be used to build the target
343 system@footnote{@pxref{Further Readings} for more details}. This
344 requires almost as much time to complete the temporary system as to
345 build the target one. Using sysroot resolves this problem.
347 From GCC installation manual, under Cross-Compiler-Specific Options:
351 @itemx --with-sysroot=@var{dir}
352 Tells GCC to consider @var{dir} as the root of a tree that contains (a
353 subset of) the root filesystem of the target operating system. Target
354 system headers, libraries and run-time object files will be searched
355 in there. More specifically, this acts as if
356 @option{--sysroot=@var{dir}} was added to the default options of the
357 built compiler. The specified directory is not copied into the
358 install tree, unlike the options @option{--with-headers} and
359 @option{--with-libs} that this option obsoletes. The default value,
360 in case @option{--with-sysroot} is not given an argument, is
361 @option{$@{gcc_tooldir@}/sys-root}. If the specified directory is a
362 subdirectory of @option{$@{exec_prefix@}}, then it will be found
363 relative to the GCC binaries if the installation tree is moved.
365 This option affects the system root for the compiler used to build
366 target libraries (which runs on the build system) and the compiler
367 newly installed with @code{make install}; it does not affect the
368 compiler which is used to build GCC itself.
373 @subsection Toolchain
376 Wikipedia@footnote{@uref{http://en.wikipedia.org/wiki/Toolchain}}:
379 In software, a toolchain is the set of programming tools that are used
380 to create a product (typically another computer program or system of
381 programs). The tools may be used in a chain, so that the output of
382 each tool becomes the input for the next, but the term is used widely
383 to refer to any set of linked development tools.
385 A simple software development toolchain consists of a text editor for
386 editing source code, a compiler and linker to transform the source
387 code into an executable program, libraries to provide interfaces to
388 the operating system, and a debugger.
392 @node build host target
393 @subsection @option{build}, @option{host} and @option{target}
395 During a cross-compilation, @option{build} @option{host} and
396 @option{target} are among the most used options: understanding the
397 precise meaning of those parameters is very important. We could define
401 @item @option{--build=@var{platform on which the program is
403 @item @option{--host=@var{platform on which the program will run}},
404 @item @option{--target=@var{platform for which the program will create
408 Let's use GCC as an example to explain the role of those three
411 During GCC compilation, we use:
413 @samp{./configure --build=@var{build-platform}
414 --host=@var{host-platform} --target=@var{target-platform} [various
415 compilation parameters]}
417 So in those configuration parameters:
421 @option{--build} provides the name of the platform currently running.
422 If we were using an Intel Pentium processor to compile the system, our
423 @var{build-platform} would be something like @samp{i686-pc-linux-gnu}.
425 If this parameter is not specified, it will be guessed automatically.
428 @option{--host} represents the type of machine we are going to run GCC
429 on after the compilation succeeds. During a cross-compilation this has
430 to be specified, because the current machine can not know which
431 architecture we wish to target. We want to produce executables to run
432 on @emph{Pentium4}, but there is currently no way we can specify
433 @samp{Pentium4} directly; because of this we specify
434 @samp{i386-unknown-linux-gnu}.
436 @option{--host} can also be left unspecified, in that case,
437 @var{host-platform} would automatically define itself as
438 @var{build-platform}, but this is not cross-compilation anymore.
441 when @option{--build} and @option{--host} are different, configuration
442 files will maintain the cross-compilation mode.
446 @option{--target} defines the system for which compiler tools will
449 @var{target-platform} parameter is useful only for a limited number of
450 programs. Although this parameter is often present when issuing
451 @samp{./configure --help}, hardly any packages will need it.
453 This parameter is only useful for performing tasks with different
454 platforms; for instance, executable files compiled for different
455 platforms can have a totally different code.
458 If we summarize, we have:
461 @item @var{build-platform}: automatically guessed from platform in
462 use; has to be specified if not guessed.
464 @item @var{host-platform}: if unspecified, automatically equals
465 @var{build-platform}. When @var{build-platform} and
466 @var{host-platform} values are identical, it is a local compilation;
467 otherwise it is a cross-compilation.
469 @item @var{target-platform}: defines the system for which compiler
470 tools will create output; it equals @var{host-platform} if
471 unspecified. GCC, binutils, and programs related to the platform's
472 instructions have this parameter; most programs do not use this
480 The Filesystem Hierarchy Standard (FHS) has been created to specify
481 the location and use of main directories on a GNU/Linux operating
482 system. Common commands, user data, libraries have to be put inside a
483 specific directory given in the standard. During the build process,
484 some commands are used to comply with FHS.
490 Because most commands are common for a regular Unix user, only
491 uncommon commands are explained in this document. If you do not
492 understand a command that is not explained, you can use the
493 documentation available on your computer; in a terminal, typing
494 @samp{man @var{command}} should give you enough information. For GNU
495 software, @samp{info @var{package}} can also give additional
498 To know more about command line, I suggest you read "Introduction to
499 the Command Line" which is available on
500 @uref{http://flossmanuals.net/command-line/}.
503 @node Preliminary Work
504 @chapter Preliminary Work
507 In order to complete the first steps of this chapter, you will need to
508 have root permissions.
512 * Build Partition Creation:: Creating a partition for the build.
513 * Build User Creation:: Creating a user account dedicated to
515 * Work Directory Creation:: Creating the parent directory for the
517 * Partition Mount:: Mounting the partition dedicated to the
519 * Useful Directories Creation:: Creating the directories for downloads
521 * User Switch:: Switching to the user dedicated to the
523 * Environment Variables Setup:: Setting up the environment variables
524 of the target system.
525 * Downloads:: Downloading needed packages and
527 * Final Preparations:: Preparing the system for the build.
531 @node Build Partition Creation
532 @section Build Partition Creation
534 To dedicate the partition @file{/dev/sda1} to the system build, and to
535 define the filesystem to be used for it as @samp{ext3}:
538 mke2fs -t ext3 /dev/sda1
541 Option @option{-t} is followed by the type of filesystem to be
542 used. The filesystem @samp{ext3} is used as it is one of the most
543 common filesystem used with the kernel Linux.
546 @node Build User Creation
547 @section Build User Creation
549 To create the builder group, user and password:
553 useradd -s /bin/bash -g gllfsc -m -k /dev/null gllfsc
559 Option @option{-s} (or @option{--shell}) is used to define the created
560 user's default shell, here @file{/bin/bash}.
563 Option @option{-g} (or @option{--gid}) is used to define the group
564 name or number of the created user's initial login group, here
568 Option @option{-m} (or @option{--create-home}) does create the user's
569 home directory if it does not exist (@file{/home/@var{username}}).
572 Option @option{-k} (or @option{--skel}) is used to define the skeleton
573 directory to be copied in the user's home directory, here
574 @file{/dev/null}. @file{/dev/null} is a special file which, in this
575 case, will give no skeleton at all to @command{useradd}.
579 @node Work Directory Creation
580 @section Work Directory Creation
582 To create the directory @file{/gllfsc} in which the system will be
586 export TARGET_DIR="/gllfsc"
587 mkdir -pv ${TARGET_DIR}
590 @samp{export TARGET_DIR="/gllfsc"} sets the value of the variable
591 @env{TARGET_DIR} to @file{/gllfsc}, the directory in which the system
595 @node Partition Mount
596 @section Mounting Partition
598 To mount the hard drive partition, for instance @file{/dev/sda1}, used
602 mount /dev/sda1 ${TARGET_DIR}
606 @node Useful Directories Creation
607 @section Creating Compilation and Download Directories
610 mkdir -pv ${TARGET_DIR}/{build,download}
611 chown -Rv gllfsc ${TARGET_DIR}
616 @section Switching to the Build User
618 To login as the user that will build the system:
624 With the command @command{su}, it is possible to change the user
625 ID. The option @option{-} provides an environment similar to what the
626 user would expect had the user logged in directly.
629 @node Environment Variables Setup
630 @section Setting up Required Environment Variables
632 @file{~/.bash_profile} is a personal initialization file that is read
633 when Bash is invoked as an interactive login shell (@file{~} is the
634 location of the user's home directory). To write the content of the
635 file @file{~/.bash_profile}:
638 cat > ~/.bash_profile << 'EOF'
639 exec env -i HOME=${HOME} TERM=${TERM} PS1=${PS1} /bin/bash
643 The first line creates the file @file{~/.bash_profile} and opens it
644 for writing until @samp{@acronym{EOF}} (End Of File) is written in it.
646 The second line tells Bash to execute @file{/bin/bash} with the option
647 @option{-i} (or @option{--ignore-environment}) which will make Bash
648 start with an empty environment. Variables @env{HOME}, @env{TERM} and
649 @env{PS1} define respectively the home directory of the current user,
650 the terminal used and the primary prompt string displayed.
652 @file{~/.bashrc} is a personal initialization file that is read when
653 Bash is invoked as an interactive shell but not a login one. To write
654 the content of the file @file{~/.bashrc}:
657 export TARGET_DIR=/gllfsc
658 cat > ~/.bashrc << EOF
661 #alias make='make -j5'
662 export PS1='\[\e[35m\]\A-\W\[\e[00m\]$ '
664 export TARGET_DIR=/gllfsc
665 export BUILD_DIR="${TARGET_DIR}/build"
666 export DOWNLOAD_DIR="${TARGET_DIR}/download"
667 export CROSS_HOST="$(echo $MACHTYPE |\
668 sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
669 export CROSS_TARGET="i686-unknown-linux-gnu"
672 export MARCH="pentium4"
673 export PATH=${TARGET_DIR}/cross-tools/bin:/bin:/usr/bin
677 source ~/.bash_profile
680 @samp{set +h} tells Bash to not locate nor remember commands (hash) as
681 they are looked up for execution.
683 @samp{umask 022} sets Bash process' file creation mask to
684 @samp{022}. This results in permissions of `755' for those files.
686 @samp{alias make='make -j5'} tells Bash to replace every call of
687 @samp{make} by @samp{make -j5}. This is useful for multiple-cores CPUs
688 as it parallelizes tasks.
690 @samp{export PS1='\[\e[35m\]\A-\W\[\e[00m\]$ '} sets the primary
691 prompt strings. The primary prompt strings are the strings you see
692 before the commands you type in the terminal. The part @samp{\A-\W}
693 means that the time, in 24-hour HH:MM format and the basename of
694 @env{$PWD} will be displayed separated by a `-', as in
695 @samp{19:33-bin}. The part @samp{\$} adds a dollar sign at the end,
696 @samp{\[\e[35m\]} colors the strings in purple and @samp{\[\e[00m\]}
697 gets the original color back. For other colors, you can browse
698 @uref{http://en.wikipedia.org/wiki/ANSI_escape_code}.
700 @env{LC_ALL} is a macro used to define a single locale to overwrite
701 other @env{LC_*} and @env{LANG} environment variables so that
702 language, numeric values, time and other locale-dependant values have
703 all the same value. It is set to the standard POSIX locale.
705 @samp{export BUILD_DIR="$@{TARGET_DIR@}/build"} sets the environment
706 variable @env{BUILD_DIR} to the value of @samp{$@{TARGET_DIR@}/build}
707 which is @samp{/gllfsc/build} in this document.
709 The value of variable @env{CROSS_HOST} equals the value of variable
710 @env{MACHTYPE} of the current machine (for instance
711 @samp{i686-pc-linux-gnu}) modulo the second word, which is replaced by
712 @samp{cross} (i.e. @samp{i486-cross-linux-gnu}).
714 The value of variable @env{CROSS_TARGET} equals the value of variable
715 @env{MACHTYPE} of the machine for which the system is built (i.e.
716 @samp{i686-unknown-linux-gnu}).
718 The variable @env{MABI} defines the @acronym{ABI} (Application Binary
719 Interface) for which the system will be built. @option{-mabi} is an
720 option of GCC. n32/64 are for 64-bit CPUs only. 64 has 64-bit pointers
721 and long integers, whereas n32 has 32-bit pointers and long integers.
722 This does not apply to pentium 4 machines.
724 The variable @env{MARCH} defines the architecture for which the system
725 will be built. @option{-march} is an option of @acronym{GCC} (GNU
726 Compiler Collection).
728 The variable @env{PATH} contains a colon-separated list of directories
729 in which the shell looks for commands. The shell will first look for
730 commands in @file{$@{TARGET_DIR@}/cross-tools/bin}, then, if the
731 command was not found, in @file{/bin} and finally in @file{/usr/bin}.
733 @command{unset} command removes the variable associated, here
734 @env{CFLAGS} and @env{CXXFLAGS}. Those variables are used by GCC as
735 extra flags given to the C compiler and the C++ compiler
738 Finally @samp{source ~/.bash_profile} reads and executes the content
739 of the file @file{~/.bash_profile}.
746 * Packages Download:: List of packages to be downloaded.
747 * Patches Download:: List of patches to be downloaded.
751 @node Packages Download
752 @subsection Downloading Packages
754 The packages listed below are those used in this document. You can try
755 other versions but you will need a recent version of Binutils, GCC and
756 the kernel Linux in order to build GLLFSC.
758 Download those files under @env{$@{DOWNLOAD_DIR@}} (which is
759 @file{/gllfsc/download} in this document).
762 If you have trouble with a savannah mirror, you can have a full list
763 of them at @uref{http://download.savannah.gnu.org/mirmon/savannah/}.
764 If you have trouble with a GNU mirror, you can have a full list
765 of them at @uref{http://www.gnu.org/prep/ftp.html}.
770 Autoconf: @uref{http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz}.
773 Automake: @uref{http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz}.
776 Bash: @uref{http://ftpmirror.gnu.org/bash/bash-4.2.tar.gz}.
779 Binutils: @uref{http://ftpmirror.gnu.org/binutils/binutils-2.24.tar.bz2}.
782 Bison: @uref{http://ftpmirror.gnu.org/bison/bison-2.7.tar.gz}.
785 Bootscripts: @uref{http://ftp.clfs.org/pub/clfs/conglomeration/bootscripts@/-cross@/-lfs/@/bootscripts-cross-lfs-2.0.0.tar.xz}.
788 Bzip2: @uref{http://downloads.sourceforge.net/bzip2/bzip2-1.0.6.tar.gz}.
791 CA-Certificates: @uref{http://anduin.linuxfromscratch.org/sources/other/certdata.txt}.
794 Coreutils: @uref{http://ftpmirror.gnu.org/coreutils/coreutils-8.19.tar.xz}.
797 DHCPCD: @uref{https://roy.marples.name/downloads/dhcpcd/dhcpcd-6.1.0.tar.bz2}.
800 Diffutils: @uref{http://ftpmirror.gnu.org/diffutils/diffutils-3.3.tar.xz}.
803 E2fsprogs: @uref{http://downloads.sourceforge.net/e2fsprogs/e2fsprogs-1.42.8.tar@/.gz}.
806 File: @uref{ftp://ftp.astron.com/pub/file/file-5.16.tar.gz}.
809 Findutils: @uref{http://ftpmirror.gnu.org/findutils/findutils-4.4.2.tar.gz}.
812 Flex: @uref{http://downloads.sourceforge.net/flex/flex-2.5.37.tar.bz2}.
815 Gawk: @uref{http://ftpmirror.gnu.org/gawk/gawk-4.1.0.tar.gz}.
818 GCC: @uref{http://ftpmirror.gnu.org/gcc/gcc-4.7.3/gcc-4.7.3.tar.bz2}.
821 Gdbm: @uref{http://ftp.gnu.org/gnu/gdbm/gdbm-1.11.tar.gz}.
824 Gettext: @uref{http://ftpmirror.gnu.org/gettext/gettext-0.18.3.1.tar.gz}.
827 Glibc: @uref{http://ftpmirror.gnu.org/glibc/glibc-2.18.tar.bz2}.
830 Gmp: @uref{http://ftpmirror.gnu.org/gmp/gmp-5.1.3.tar.bz2}.
833 Grep: @uref{http://ftpmirror.gnu.org/grep/grep-2.15.tar.xz}.
836 Groff: @uref{http://ftpmirror.gnu.org/groff/groff-1.22.2.tar.gz}.
839 GRUB: @uref{http://ftpmirror.gnu.org/grub/grub-2.00.tar.gz}.
842 Gzip: @uref{http://ftpmirror.gnu.org/gzip/gzip-1.6.tar.gz}.
845 Iana-Etc: @uref{http://sethwklein.net/iana-etc-2.30.tar.bz2}.
848 Inetutils: @uref{http://ftpmirror.gnu.org/inetutils/inetutils-1.9.1.tar.gz}.
851 Iproute2: @uref{https://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-3.10.0@/.tar.bz2}.
854 Kbd: @uref{http://ftp.altlinux.org/pub/people/legion/kbd/kbd-2.0.1.tar.gz}.
857 Kmod: @uref{https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-15.tar.gz}.
860 Less: @uref{http://www.greenwoodsoftware.com/less/less-458.tar.gz}.
863 Libpipeline: @uref{http://download.savannah.gnu.org/releases/libpipeline/@/libpipeline-1.3.0.tar.gz}.
866 Libtasn1: @uref{http://ftpmirror.gnu.org/libtasn1/libtasn1-3.4.tar.gz}.
869 Libtool: @uref{http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz}.
872 Linux-Libre @footnote{The kernel Linux is shipped with proprietary
873 firmware. The version called Linux-Libre exists without them, it is
874 available for download at
875 @uref{http://www.fsfla.org/ikiwiki/selibre/linux-libre/}.}.
876 @uref{http://linux-libre.fsfla.org/pub/linux-libre/releases/3.10-gnu/@/linux-libre-3.10-gnu.tar.xz}.
879 Lynx: @uref{http://invisible-mirror.net/archives/lynx/tarballs/lynx2.8.8dev.16.tar@/.bz2}.
882 M4: @uref{http://ftpmirror.gnu.org/m4/m4-1.4.17.tar.bz2}.
885 Make: @uref{http://ftpmirror.gnu.org/make/make-4.0.tar.bz2}.
888 Man-db: @uref{http://download.savannah.gnu.org/releases/man-db/man-db-2.6.7.1.tar@/.xz}.
891 Man-Pages: @uref{https://www.kernel.org/pub/linux/docs/man-pages/Archive/man-pages-@/3.54.tar.bz2}.
894 Mpc: @uref{http://ftpmirror.gnu.org/mpc/mpc-1.0.1.tar.gz}.
897 Mpfr: @uref{http://ftpmirror.gnu.org/mpfr/mpfr-3.1.2.tar.bz2}.
900 Nano: @uref{http://ftpmirror.gnu.org/nano/nano-2.3.2.tar.gz}.
903 Ncurses: @uref{http://ftpmirror.gnu.org/ncurses/ncurses-5.9.tar.gz}.
906 Openssl: @uref{ftp://ftp.openssl.org/source/old/1.0.1/openssl-1.0.1i.tar.gz}.
909 Patch: @uref{http://ftpmirror.gnu.org/patch/patch-2.7.1.tar.bz2}.
912 Perl: @uref{http://www.cpan.org/src/5.0/perl-5.18.1.tar.gz}.
915 Procps: @uref{http://procps.sourceforge.net/procps-3.2.8.tar.gz}.
918 Psmisc: @uref{https://sourceforge.net/projects/psmisc/files/psmisc/psmisc-22.20.tar@/.gz}.
921 Readline: @uref{http://ftpmirror.gnu.org/readline/readline-6.2.tar.gz}.
924 Runit: @uref{http://smarden.org/runit/runit-2.1.2.tar.gz}
927 Sed: @uref{http://ftpmirror.gnu.org/sed/sed-4.2.2.tar.bz2}.
930 Shadow: @uref{https://src.fedoraproject.org/repo/pkgs/shadow-utils/shadow-4.1.4.3@/.tar.bz2/b8608d8294ac88974f27b20f991c0e79/shadow-4.1.4.3.tar.bz2}.
933 Sysvinit: @uref{http://download.savannah.gnu.org/releases/sysvinit/sysvinit-2.88dsf@/.tar.bz2}.
936 Tar: @uref{http://ftpmirror.gnu.org/tar/tar-1.27.1.tar.bz2}.
939 Texinfo: @uref{http://ftpmirror.gnu.org/texinfo/texinfo-4.13a.tar.gz}.
942 Tzcode: @uref{http://www.iana.org/time-zones/repository/releases/tzcode2013h.tar@/.gz}.
945 Tzdata: @uref{http://www.iana.org/time-zones/repository/releases/tzdata2013h.tar@/.gz}.
948 Udev: @uref{https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-175.tar.gz}.
951 Util-Linux: @uref{https://www.kernel.org/pub/linux/utils/util-linux/v2.24/util-@/linux-2.24.tar.bz2}.
954 Wireless_tools: @uref{http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.29.tar.gz}.
957 Wpa_supplicant: @uref{http://w1.fi/releases/wpa_supplicant-2.0.tar.gz}.
960 Wget: @uref{http://ftpmirror.gnu.org/wget/wget-1.14.tar.gz}.
963 XZ-Utils: @uref{https://tukaani.org/xz/xz-5.0.8.tar.bz2}.
966 Zlib: @uref{http://www.zlib.net/fossils/zlib-1.2.8.tar.gz}.
970 @node Patches Download
971 @subsection Downloading Patches
973 Patches and configuration files location:
977 @uref{http://cjarry.org/gnu-linux/gllfsc/pentium4/gllfsc-pentium4-1.7-patches@/.tar.gz}. After
978 having downloaded this file under @env{$@{DOWNLOAD_DIR@}}, execute
979 the following commands to extract its content:
983 tar xvf gllfsc-pentium4-1.7-patches.tar.gz
990 @uref{http://dev.lemote.com/cgit/linux-official.git/commit/?h=linux-3.6@/&id=94fe1f0a7d2e3042fa7fadfd15da71b9d0c11809}
991 describes the changes to be made to the kernel in order to add support
992 for Chinese fonts in console. The patch applies to Linux 3.6.
993 Be aware though that applying this patch to the kernel may make
994 characters that are both non-@acronym{CJK} (Chinese Japanese Korean)
995 and non-ASCII unreadable (accented letters, cyrillic, etc.).
999 @uref{http://microcai.gsalex.net/old/archives/2011/01/fbcon_UNICODE_font_support.html}
1000 is useful for users who want support for @acronym{CJK} (Chinese
1001 Japanese Korean) characters under the (non-graphical) terminal. It
1002 gives access to a git@footnote{@uref{http://git-scm.com/}} repository
1003 with kernel patches@footnote{The patches to use with version 3.5 of
1004 the kernel are the first four on
1005 @uref{http://repo.or.cz/w/linux-2.6/cjktty.git/shortlog/refs/heads/3.5-utf8}.}
1006 that permit direct rendering of UTF-8 characters under the framebuffer
1007 environment. Be aware though that applying those CJK patches to the
1008 kernel may make characters that are both non-CJK and non-ASCII
1009 unreadable (accented letters, cyrillic, etc.).
1013 @uref{http://www.fsfla.org/svn/fsfla/software/linux-libre/lemote/gnewsense/tags/@/2.6.36-libre-lemote_0lxo/100gnu+freedo.patch}
1014 this patch adds a picture of a GNU beside Freedo, Freedo being the
1015 mascot of Linux-Libre. The image can be seen on
1016 @uref{http://www.fsfla.org/ikiwiki/selibre/linux-libre/100gnu+freedo}.
1019 @uref{http://linux-libre.fsfla.org/pub/linux-libre/releases/3.10.7-gnu/patch-3.10-@/gnu-3.10.7-gnu.xz}
1020 this patch updates linux-libre-3.10 to linux-libre-3.10.7.
1024 @node Final Preparations
1025 @section Final Preparations
1028 * Target Filesystem Hierarchy Creation:: Creating the directories of
1030 * Needed Files Creation:: Creating files for needed
1031 user, groups and log.
1035 @node Target Filesystem Hierarchy Creation
1036 @subsection Target Filesystem Hierarchy Creation
1041 # /usr is required for cmake, python and ruby at least
1044 mkdir -v bin include lib share src
1050 mkdir -v boot dev etc home local mnt proc root run static sys var
1051 mkdir -v cross-tools libexec
1055 ln -sv usr/include include
1057 ln -sv usr/lib lib32
1058 ln -sv usr/lib lib64
1059 ln -sv usr/share share
1061 install -dv -m 0777 tmp
1063 install -dv -m 1777 var
1065 mkdir -v cache local lock log mail run spool
1066 mkdir -pv lib/misc lib/locate
1069 install -dv -m 0750 root
1072 mkdir -v bin include lib src
1077 mkdir -v doc info locale man misc terminfo zoneinfo
1078 mkdir -v man/man{1..8}
1080 ln -sv share/man man
1084 The command @samp{install -dv -m 1777 var} creates the directory
1085 @file{var} with the permissions to read, write and execute for
1086 everyone. The '1' in @samp{1777} is the sticky bit which allows
1087 deletion of the file or directory having this attribute only for the
1088 owner of the file or directory.
1090 The command @samp{ln -svf lib lib64} creates a symbolic link (option
1091 @option{-s}) with the name @file{lib64} which will point to
1095 @node Needed Files Creation
1096 @subsection Creating needed user, groups and log files
1099 cat > ${TARGET_DIR}/etc/passwd << EOF
1100 root::0:0:root:/root:/bin/bash
1104 The file @file{/etc/passwd} contains one line for each user account,
1105 with seven fields delimited by colons. These fields are:
1112 optional encrypted password;
1121 user name or comment field;
1124 user home directory;
1127 optional user command interpreter.
1132 cat > ${TARGET_DIR}/etc/group << EOF
1152 The file @file{/etc/group} is a text file which defines the groups on
1153 the system. There is one entry per line, with the following format:
1154 @samp{group_name:password:GID:user_list}.
1158 touch ${TARGET_DIR}/var/run/utmp \
1159 ${TARGET_DIR}/var/log/{btmp,lastlog,wtmp}
1160 chmod -v 664 ${TARGET_DIR}/var/run/utmp \
1161 ${TARGET_DIR}/var/log/lastlog
1165 @node Building the Cross-Compilation Toolchain
1166 @chapter Building the Cross-Compilation Toolchain
1168 In this chapter, the cross-compilation toolchain is built as well as
1169 core components of the target system. Those will then be used to build
1173 * Target Linux-Header:: Linux-Header for target system.
1174 * Cross Binutils:: Binutils for cross-compilation.
1175 * Cross GCC:: GCC for cross-compilation (C support only).
1176 * Target glibc:: glibc for target system.
1177 * Cross GCC CXX:: GCC for cross-compilation (C and C++ support).
1181 @node Target Linux-Header
1182 @section Target Linux-Header
1184 In this document, the kernel used is version 3.10.7 of Linux-libre. I
1185 stick to this version because some changes made in the kernel since
1186 3.14 require the non-free firmware of the radeon driver earlier at
1187 boot: without the firmware, the screen will remain blank on a machine
1188 that requires it, making the computer unusable.@footnote{See
1189 @uref{https://bugzilla.kernel.org/show_bug.cgi?id=77861} for details.}
1190 I think version 3.10.7 of Linux-libre is usable on such a machine
1191 without the non-free firmware of the radeon driver.
1193 You need Patch, Make and GCC on your system to compile this program
1194 from source. Under gNewSense 4.0, try @samp{sudo apt-get install patch
1195 make gcc-4.4} and then @samp{sudo ln -sv gcc-4.4 /usr/bin/gcc}.
1198 # 14 minutes mostly to compress the kernel with xz
1201 tar xf ${DOWNLOAD_DIR}/linux-libre-3.10-gnu.tar.xz \
1203 cd ${BUILD_DIR}/linux-3.10
1204 unxz ${DOWNLOAD_DIR}/patch-3.10-gnu-3.10.7-gnu.xz
1205 patch -Np1 -i ${DOWNLOAD_DIR}/patch-3.10-gnu-3.10.7-gnu
1208 # About 2 minutes for the following command (490 MB)
1209 tar -cf linux-libre-3.10.7-gnu.tar linux-3.10
1211 # About 12 minutes for the following command (68 MB)
1212 # (requires ~800 MB of RAM)
1213 xz -9 linux-libre-3.10.7-gnu.tar
1215 mv linux-libre-3.10.7-gnu.tar.xz ${DOWNLOAD_DIR}
1220 make ARCH=i386 headers_check
1221 make ARCH=i386 INSTALL_HDR_PATH=dest headers_install
1222 cp -rv dest/include/* ${TARGET_DIR}/include
1228 @samp{14 minutes} is the time it takes to build the package on Dell
1229 Optiplex 745 with a Pentium 4 processor.
1231 The command @samp{make mrproper} cleans the sources.
1233 We need to specify @samp{ARCH=i386} as we are cross-compiling.
1236 @node Cross Binutils
1237 @section Cross Binutils
1239 GNU Binutils (GNU binary utilities) is a collection of programs for
1240 manipulating binaries.
1244 tar xf ${DOWNLOAD_DIR}/binutils-2.24.tar.bz2 -C ${BUILD_DIR}
1245 cd $BUILD_DIR/binutils-2.24
1246 mkdir -pv ../binutils-build
1247 cd ../binutils-build
1249 ../binutils-2.24/configure \
1250 --prefix=${TARGET_DIR}/cross-tools \
1251 --build=${CROSS_HOST} \
1252 --host=${CROSS_HOST} \
1253 --target=${CROSS_TARGET} \
1254 --enable-64-bit-bfd \
1255 --with-sysroot=${TARGET_DIR} \
1261 cp -v ../binutils-2.24/include/libiberty.h \
1262 ${TARGET_DIR}/include
1264 rm -rf binutils-build
1265 rm -rf binutils-2.24
1269 @samp{CC="gcc"} and @samp{AR="ar"} are flags that tell the
1270 @file{configure} script to use the local commands @command{gcc} as the
1271 C compiler and @command{ar} as the program that handles archives.
1273 @option{--prefix=$@{TARGET_DIR@}/cross-tools} tells the configure
1274 script to install architecture-independant files in
1275 @file{$@{TARGET_DIR@}/cross-tools}.
1277 The option @option{--enable-64-bit-bfd} enables 64 bit for
1278 @acronym{BFD} (the Binary File Descriptor).
1280 @option{--with-sysroot=@env{$@{TARGET_DIR@}}} tells Binutils to
1281 consider @env{$@{TARGET_DIR@}} as the root of a tree that contains (a
1282 subset of) the root filesystem of the target operating system. Target
1283 system headers, libraries and run-time object files will be searched
1286 The @option{--enable-nls} option enables Native Language Support
1287 (NLS), which lets Binutils output diagnostics in languages other than
1288 American English. Native Language Support is enabled by default if not
1289 doing a canadian cross build. The @option{--disable-nls} option
1292 The option @option{--enable-shared} is used to build shared versions
1293 of libraries, if shared libraries are supported on the target
1294 platform. Use @option{--disable-shared} to build only static
1297 @c cp -v ../binutils-2.22/include/libiberty.h \
1298 @c ${TARGET_DIR}/include
1302 @section Cross GCC (C support only)
1304 GCC is the GNU compiler collection. It can compile many languages, of
1305 which only C and C++ will be enabled in this document.
1307 In this section, we build a minimal GCC in order to build glibc.
1310 to build GMP (a GCC dependency), you need a version of GCC different
1311 from 4.3.2 on your system@footnote{@uref{https://gmplib.org/#STATUS}}:
1315 GCC 4.3.2 miscompiles GMP on 64-bit machines; please use a different
1316 gcc version (e.g., gcc 4.3.1 and gcc 4.3.3 both work properly). We
1317 have not been able to find any workaround for this gcc bug.
1318 Unfortunately, Debian 5.0 has decided to stay with this trouble gcc
1319 version, resulting in that many users strike this bug.
1322 I recommend installing @samp{gcc-4.4} on gNewSense 4.0 to avoid this
1327 tar xf ${DOWNLOAD_DIR}/gcc-4.7.3.tar.bz2 -C ${BUILD_DIR}
1328 cd ${BUILD_DIR}/gcc-4.7.3
1329 tar xf ${DOWNLOAD_DIR}/gmp-5.1.3.tar.bz2
1331 tar xf ${DOWNLOAD_DIR}/mpc-1.0.1.tar.gz
1333 tar xf ${DOWNLOAD_DIR}/mpfr-3.1.2.tar.bz2
1335 # Fix undefined reference to `__stack_check_guard' when compiling glibc:
1336 sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
1337 mkdir -pv ../gcc-build
1339 ../gcc-4.7.3/configure \
1340 --prefix=${TARGET_DIR}/cross-tools \
1341 --build=${CROSS_HOST} \
1342 --host=${CROSS_HOST} \
1343 --target=${CROSS_TARGET} \
1344 --with-sysroot=${TARGET_DIR} \
1345 --disable-multilib \
1350 --enable-languages=c \
1351 --with-mpfr-include="${BUILD_DIR}/gcc-4.7.3/mpfr/src" \
1352 --with-mpfr-lib="${BUILD_DIR}/gcc-build/mpfr/src/.libs" \
1353 --disable-decimal-float
1354 # fixes bid_decimal_globals: fenv.h: No such file or directory
1357 make all-target-libgcc
1359 make install-target-libgcc
1366 @option{--disable-multilib} specifies that multiple target libraries
1367 to support different target variants@footnote{Such as different ABI,
1368 for instance n32 and 64.}, calling conventions, etc@:. should not be
1369 built. The default is to build a predefined set of them.
1371 @option{--with-newlib} specifies that @samp{newlib} is being used as
1372 the target C library.
1374 @option{--disable-threads} specifies that threading support should be
1377 @option{--enable-languages=c} specifies that only the C compiler and
1378 its runtime libraries should be built.
1380 @c --with-abi=${MABI}
1382 @c --with-mpfr-include="${BUILD_DIR}/gcc-4.7.3/mpfr/src" \
1383 @c --with-mpfr-lib="${BUILD_DIR}/gcc-build/mpfr/src/.libs"
1384 @c to avoid error: libmpfr not found or uses a different ABI (including static vs shared).
1386 GCC provides a low-level runtime library, @file{libgcc.a} or
1387 @file{libgcc_s.so.1} on some platforms. GCC generates calls to
1388 routines in this library automatically, whenever it needs to perform
1389 some operation that is too complicated to emit inline code for. This
1390 is built with @samp{make all-target-libgcc} and installed with
1391 @samp{make install-target-libgcc}
1395 @section Target glibc
1397 Glibc is the GNU C library. It provides macros, type definitions, and
1398 functions for tasks like string handling, mathematical computations,
1399 input/output processing, memory allocation and several other operating
1402 You need Gawk on your system to compile this program from
1403 source. Under gNewSense 4.0, try @samp{sudo apt-get install gawk}.
1407 tar xf ${DOWNLOAD_DIR}/glibc-2.18.tar.bz2 -C ${BUILD_DIR}
1408 cd ${BUILD_DIR}/glibc-2.18
1409 sed -i.orig '4775s/3.79\* | 3.\[89\]\*/& | 4.0/' configure
1410 sed -i.orig "s/ -lgcc_eh\| -lgcc_s//g" Makeconfig
1411 #echo "" > ports/sysdeps/mips/mips64/n64/Makefile
1412 #echo "" > ports/sysdeps/mips/mips64/n32/Makefile
1413 #echo "" > ports/sysdeps/mips/mips32/Makefile
1414 #sed -i "/default) machine=/s/n32/${MABI}/g" \
1415 # ports/sysdeps/mips/preconfigure
1416 mkdir -pv ../glibc-build
1419 cat > config.cache << EOF
1420 libc_cv_c_cleanup=yes
1421 libc_cv_slibdir=/lib
1424 cat > configparms << EOF
1425 install_root=${TARGET_DIR}
1430 CC="${CROSS_TARGET}-gcc -march=${MARCH}" \
1431 AR="${CROSS_TARGET}-ar" \
1432 RANLIB="${CROSS_TARGET}-ranlib" \
1433 ../glibc-2.18/configure \
1435 --libexecdir=/lib/glibc \
1436 --build=${CROSS_HOST} \
1437 --host=${CROSS_TARGET} \
1441 --enable-kernel=3.10 \
1443 --with-binutils=${TARGET_DIR}/cross-tools/bin \
1444 --with-headers=${TARGET_DIR}/include \
1445 --enable-obsolete-rpc \
1446 --cache-file=config.cache
1457 cat > ${TARGET_DIR}/etc/nsswitch.conf << EOF
1458 # Begin /etc/nsswitch.conf
1472 # End /etc/nsswitch.conf
1475 cat > ${TARGET_DIR}/etc/ld.so.conf << EOF
1476 # Begin /etc/ld.so.conf
1480 # End /etc/ld.so.conf
1484 @c @samp{sed -i.orig "s/\ -lgcc_eh\|\ -lgcc_s//g" Makeconfig}
1486 @c Glibc uses @samp{n32} ABI by default with MIPS. To use @env{MABI}
1487 @c instead, we do the following:
1490 @c echo "" > ports/sysdeps/mips/mips64/n64/Makefile
1491 @c echo "" > ports/sysdeps/mips/mips64/n32/Makefile
1492 @c echo "" > ports/sysdeps/mips/mips32/Makefile
1493 @c sed -i "/default) machine=/s/n32/${MABI}/g" \
1494 @c ports/sysdeps/mips/preconfigure
1498 Contents of the files above.
1500 cat mips64/n64/Makefile
1501 # `long double' is a distinct type we support.
1502 long-double-fcts = yes
1504 ifeq ($(filter -mabi=64,$(CC)),)
1508 cat mips64/n32/Makefile
1509 # `long double' is a distinct type we support.
1510 long-double-fcts = yes
1512 ifeq ($(filter -mabi=n32,$(CC)),)
1517 ifeq ($(filter -mabi=32,$(CC)),)
1521 grep 'default)' preconfigure
1523 default) machine=mips/mips64/n32 mips_config_abi=n32 ;;
1527 The file @file{config.cache} is used to attribute values to variables
1528 of the configure script.
1530 @samp{libc_cv_forced_unwind=yes} is used to avoid the error message
1531 @samp{error: forced unwind support is required}.
1533 @samp{libc_cv_c_cleanup=yes} is used to avoid the error message
1534 @samp{error: the compiler must support C cleanup handling}.
1536 @samp{libc_cv_slibdir=/lib} defines @file{/lib} as the directory in
1537 which the C library of the target system will be installed, instead of
1538 @file{/lib64} or @file{/lib32}.
1540 You can install glibc somewhere other than where you configured it to
1541 go by setting the @code{install_root} variable on the command line for
1542 @samp{make install}. The value of this variable is prepended to all
1543 the paths for installation. This is useful when setting up a chroot
1544 environment or preparing a binary distribution. The directory should
1545 be specified with an absolute file name.
1547 Files listed in @samp{install-lib} are installed in the directory
1548 specified by @samp{libdir} in @file{configparms} or @file{Makeconfig}.
1552 CC="${CROSS_TARGET}-gcc -march=${MARCH}" \
1553 AR="${CROSS_TARGET}-ar" \
1554 RANLIB="${CROSS_TARGET}-ranlib"
1557 @samp{CC="$@{CROSS_TARGET@}-gcc -march=$@{MARCH@}"}
1558 sets @code{CC} to the cross-compiler for the target's architecture,
1559 processor and ABI we configured the library for. @code{AR} and
1560 @code{RANLIB} are set to cross-compiling versions of @code{ar} and
1561 @code{ranlib} as the native tools are not configured to work with
1562 object files for the target we configured for.
1564 @option{--prefix=} tells the @file{configure} script to install
1565 glibc in the root directory (@file{/}) of the target system.
1567 @c @option{--libexecdir=/lib/glibc} tells the configure script to
1568 @c install glibc executables inside @file{/lib/glibc}.
1570 Unlike previous builds, @option{--host} now equals
1571 @env{$@{CROSS_TARGET@}} instead of @env{$@{CROSS_HOST@}}. This is
1572 because we are building the glibc version that the target system will
1573 use. We won't have to build it later.
1575 Profiling can be of help to optimize a program by analysing memory
1576 use, the usage of particular instructions, etc. Option
1577 @option{--disable-profile} is used to disable this.
1579 Option @option{--enable-add-ons} is used to enable all the add-on
1580 packages in the main source directory, which includes the glibc-ports
1581 used to support the MIPS architecture.
1583 The option @option{--with-tls} tells the configure script to use
1584 @acronym{TLS} (thread-local storage). Thread-local storage is a
1585 computer programming method that uses memory local to a thread.
1587 The @samp{3.10} parameter given to option @option{--enable-kernel}
1588 describes the smallest version of the Linux kernel the generated
1589 library is expected to support. The higher the version number is, the
1590 less compatibility code is added, and the faster the code gets.
1592 Option @option{--with-__thread} enables threads in glibc.
1594 The option @option{--with-binutils=$@{TARGET_DIR@}/cross-tools/bin}
1595 tells the @file{configure} script to use the binutils (assembler and
1596 linker) built in the cross-compilation toolchain process.
1598 @option{--with-headers=$@{TARGET_DIR@}/include} indicates the
1599 location of the kernel Linux' headers.
1601 @option{--enable-obsolete-rpc} tells the @file{configure} script to
1602 install remote procedure call (RPC) headers. Those may be required by
1605 @option{--cache-file=config.cache} specifies the file in which cache
1606 variables are listed for @file{configure}.
1608 The file @file{$@{TARGET_DIR@}/etc/nsswitch.conf} contains the
1609 configuration of @acronym{NSS} (Name Service Switch). NSS is a facility
1610 in Unix-like operating systems that provides a variety of sources for
1611 common configuration databases and name resolution mechanisms. These
1612 sources include local operating system files (such as
1613 @file{/etc/passwd}, @file{/etc/group}, and @file{/etc/hosts}), the
1614 Domain Name System (DNS), the Network Information Service (NIS), and
1617 @c Purpose of the file @file{$@{TARGET_DIR@}/etc/ld.so.conf}
1621 @section Cross GCC (C and C++ support)
1623 In this section, we build a complete cross-compiler with support for C
1628 tar xf ${DOWNLOAD_DIR}/gcc-4.7.3.tar.bz2 -C ${BUILD_DIR}
1629 cd ${BUILD_DIR}/gcc-4.7.3
1630 tar xf ${DOWNLOAD_DIR}/gmp-5.1.3.tar.bz2
1632 tar xf ${DOWNLOAD_DIR}/mpc-1.0.1.tar.gz
1634 tar xf ${DOWNLOAD_DIR}/mpfr-3.1.2.tar.bz2
1636 mkdir -v ../gcc-build
1638 ../gcc-4.7.3/configure \
1639 --prefix=${TARGET_DIR}/cross-tools \
1640 --build=${CROSS_HOST} \
1641 --host=${CROSS_HOST} \
1642 --target=${CROSS_TARGET} \
1643 --with-sysroot=${TARGET_DIR} \
1646 --enable-__cxa_atexit \
1647 --disable-multilib \
1649 --enable-long-long \
1650 --enable-threads=posix \
1651 --enable-languages=c,c++ \
1652 --with-mpfr-include="${BUILD_DIR}/gcc-4.7.3/mpfr/src" \
1653 --with-mpfr-lib="${BUILD_DIR}/gcc-build/mpfr/src/.libs"
1662 @option{--enable-__cxa_atexit} enables @code{__cxa_atexit}, rather
1663 than @code{atexit}, to register C++ destructors for local statics and
1664 global objects. This is essential for fully standards-compliant
1665 handling of destructors, but requires @code{__cxa_atexit} in libc.
1667 @option{--enable-c99} enables support for the C99 standard.
1669 @option{--enable-long-long} enables support for @code{long long int}
1672 @c @option{--enable-threads=posix}
1675 @node Building the Cross-Compilation Tools
1676 @chapter Building the Cross-Compilation Tools
1679 * Cross File:: File for cross-compilation.
1680 * Cross Groff:: Groff for cross-compilation.
1681 * Cross Shadow:: Shadow for cross-compilation.
1682 * Cross M4:: M4 for cross-compilation.
1683 * Cross Ncurses:: Ncurses for cross-compilation.
1684 * Cross Cleaning:: Cleaning up the cross-compilation toolchain.
1691 The command @command{file} is used to determine the type of a file:
1692 text, executable or data.
1696 tar xf ${DOWNLOAD_DIR}/file-5.16.tar.gz -C ${BUILD_DIR}
1697 cd ${BUILD_DIR}/file-5.16
1699 --prefix=${TARGET_DIR}/cross-tools
1711 Groff is the GNU version of the roff document formatting system which
1712 is used to produce man pages.
1714 You need G++ on your system to compile this program from source. Under
1715 gNewSense 4.0, try @samp{sudo apt-get install g++-4.4} and then
1716 @samp{sudo ln -sv g++-4.4 /usr/bin/g++}.
1721 tar xf ${DOWNLOAD_DIR}/groff-1.22.2.tar.gz -C ${BUILD_DIR}
1722 cd ${BUILD_DIR}/groff-1.22.2
1725 --prefix=${TARGET_DIR}/cross-tools \
1734 @samp{PAGE=A4} defines the default format of pages for printed output.
1736 @option{--without-x} disables the dependancy on the X window system.
1742 The package contains programs to handle users, groups and passwords in
1743 a secure way: passwords are encrypted.
1747 tar xf ${DOWNLOAD_DIR}/shadow-4.1.4.3.tar.bz2 -C ${BUILD_DIR}
1748 cd ${BUILD_DIR}/shadow-4.1.4.3
1749 patch -Np1 -i ${DOWNLOAD_DIR}/shadow-4.1.4.3-sysroot_hacks-1.patch
1751 # 's/bindir)\/\$\$i/bindir)\/mips64el-unknown-linux-gnu-\$\$i/' \
1754 echo "shadow_cv_passwd_dir=${TARGET_DIR}/bin" > config.cache
1755 echo "ac_cv_func_lckpwdf=no" >> config.cache
1757 --prefix=${TARGET_DIR}/cross-tools \
1758 --sbindir=${TARGET_DIR}/cross-tools/bin \
1759 --sysconfdir=${TARGET_DIR}/etc \
1764 --program-prefix=${CROSS_TARGET}- \
1765 --cache-file=config.cache
1766 sed -i.orig "/PASSWD_PROGRAM/s/passwd/${CROSS_TARGET}-&/" config.h
1770 rm -rf shadow-4.1.4.3
1774 @c @samp{shadow_cv_passwd_dir=$@{TARGET_DIR@}/bin}
1775 @c @samp{ac_cv_func_lckpwdf=no}
1777 The patch @file{shadow-4.1.4.3-sysroot_hacks-1.patch} is used so that
1778 shadow can be built with the sysroot method. Because we use this
1779 patch, @samp{shadow_cv_passwd_dir=$@{TARGET_DIR@}/bin} and
1780 @samp{ac_cv_func_lckpwdf=no} have to be added in @file{config.cache}
1781 in order for the @file{configure} script not to test the
1782 functionalities associated.
1784 @c @option{--sbindir=$@{TARGET_DIR@}/cross-tools/bin}
1786 @c @option{--sysconfdir=$@{TARGET_DIR@}/etc}
1788 @option{--without-audit}, @option{--without-libpam} and
1789 @option{--without-selinux} disable support for auditing, @acronym{PAM}
1790 (Pluggable authentication modules) and @acronym{SELinux}
1791 (Security-Enhanced Linux). We do not need those extra features.
1793 @option{--program-prefix=$@{CROSS_TARGET@}-} prepends the value of
1794 @env{CROSS_TARGET} (that is @samp{i386-unknown-linux-gnu} in this
1795 document) to installed program names for cross-compilation.
1797 @c @samp{sed -i.orig "/PASSWD_PROGRAM/s/passwd/$@{CROSS_TARGET@}-&/"
1798 @c config.h} is used to avoid the error message
1804 Bison 2.5 requires M4 to be built.
1806 GNU M4 is a package containing an implementation of the m4 macro
1807 language. GNU M4 is used in GNU Autoconf' @file{configure} files.
1811 tar xf ${DOWNLOAD_DIR}/m4-1.4.17.tar.bz2 -C ${BUILD_DIR}
1812 cd ${BUILD_DIR}/m4-1.4.17
1814 --prefix=${TARGET_DIR}/cross-tools
1826 GNU ncurses contains a library used to write text-based user
1827 interfaces in a terminal-independent manner.
1831 tar xf ${DOWNLOAD_DIR}/ncurses-5.9.tar.gz -C ${BUILD_DIR}
1832 cd ${BUILD_DIR}/ncurses-5.9
1834 --prefix=${TARGET_DIR}/cross-tools \
1838 install -m755 progs/tic ${TARGET_DIR}/cross-tools/bin
1844 @option{--without-shared} is used to avoid building the whole library
1845 as only @command{tic} is installed.
1848 @node Cross Cleaning
1849 @section Cleaning up Cross-Compilation Toolchain
1851 In order to save some space, binaries and libraries of
1852 cross-compilation tools can be stripped out.
1855 incorrect cleaning arguments used against library files can lead to
1856 library files breaking. For this reason, be careful of the command
1857 arguments. If you are not comfortable with this, you can skip this
1858 section as it will have no effect on the process of building the
1864 cd ${TARGET_DIR}/cross-tools
1865 strip --strip-all bin/*
1866 strip --strip-debug lib/*
1870 @option{--strip-all} removes all symbols. This command reduces the
1871 size of the @file{bin} directory's content from 26 MB to 9 MB.
1873 @option{--strip-debug} removes debugging symbols only. This command
1874 reduces the size of the @file{lib} directory's content from 13 MB to
1878 @node Building the Target System
1879 @chapter Building the Target System
1881 After having set up the cross-compilation toolchain and tools, the
1882 operating system for the target machine is built in this chapter.
1885 * Environment Setup:: Setting up the environment.
1886 * Man Pages:: Building Man Pages.
1887 * Zlib:: Building Zlib.
1888 * Binutils:: Building Binutils.
1889 * GMP:: Building GMP.
1890 * MPFR:: Building MPFR.
1891 * MPC:: Building MPC.
1892 * GCC:: Building GCC.
1893 * Sed:: Building Sed.
1894 * E2fsprogs:: Building E2fsprogs.
1895 * Coreutils:: Building Coreutils.
1896 * iana-etc:: Building iana-etc.
1898 * Bison:: Building Bison.
1899 * Ncurses:: Building Ncurses.
1900 * Procps:: Building Procps.
1901 * Libtool:: Building Libtool.
1902 * Readline:: Building Readline.
1903 * Autoconf:: Building Autoconf.
1904 * Automake:: Building Automake.
1905 * Bash:: Building Bash.
1906 * Bzip2:: Building Bzip2.
1907 * DHCPCD:: Building DHCPCD.
1908 * Diffutils:: Building Diffutils.
1909 * File:: Building File.
1910 * Findutils:: Building Findutils.
1911 * Flex:: Building Flex.
1912 * Gawk:: Building Gawk.
1913 * Gdbm:: Building Gdbm.
1914 * Gettext:: Building Gettext.
1915 * Grep:: Building Grep.
1916 * Groff:: Building Groff.
1917 * Gzip:: Building Gzip.
1918 * Inetutils:: Building Inetutils.
1919 * Iproute2:: Building Iproute2.
1920 * Kbd:: Building Kbd.
1921 * Kmod:: Building Kmod.
1922 * Less:: Building Less.
1923 * Libpipeline:: Building Libpipeline.
1924 * Make:: Building Make.
1925 * Man-db:: Building Man-db.
1926 * Nano:: Building Nano.
1927 * Patch:: Building Patch.
1928 * Psmisc:: Building Psmisc.
1929 * Shadow:: Building Shadow.
1930 * Sysvinit:: Building Sysvinit.
1931 * Tar:: Building Tar.
1932 * Texinfo:: Building Texinfo.
1933 * Udev:: Building Udev.
1934 * Util-Linux:: Building Util-Linux.
1935 * XZ-Utils:: Building XZ-Utils.
1936 * Bootscripts:: Building Bootscripts.
1937 * Kernel:: Building the Kernel.
1941 @node Environment Setup
1942 @section Setting up the Environment
1944 Because this chapter is about the build of the target system and not
1945 the build of the cross-compilation toolchain and tools anymore, we
1946 need to update some environment variables.
1948 For more convenience, we can set environment variables up in the
1949 @file{~/.bashrc} file, so that this setup is preserved when logging
1954 cat >> ~/.bashrc << EOF
1955 export CC="${CROSS_TARGET}-gcc -march=${MARCH}"
1956 export CXX="${CROSS_TARGET}-g++ -march=${MARCH}"
1957 export AR="${CROSS_TARGET}-ar"
1958 export AS="${CROSS_TARGET}-as"
1959 export RANLIB="${CROSS_TARGET}-ranlib"
1960 export LD="${CROSS_TARGET}-ld"
1961 export STRIP="${CROSS_TARGET}-strip"
1963 source ~/.bash_profile
1966 @env{CC} is the flag that indicates the C compiler to be used,
1967 @env{CXX} the C++ compiler, @env{AR} the archiver, @env{AS} the
1968 assembler, @env{RANLIB} the archives' index generator, @env{LD} the
1969 linker and @env{STRIP} the program for stripping.
1971 All the programs to be used are prefixed with
1972 @samp{$@{CROSS_TARGET@}-} in order to use the cross-compilation
1973 toolchain instead of the toolchain of the host.
1979 The man-pages package documents the kernel Linux and C library's
1980 interfaces that are used by user-space programs.
1984 tar xf ${DOWNLOAD_DIR}/man-pages-3.54.tar.bz2 -C ${BUILD_DIR}
1985 cd ${BUILD_DIR}/man-pages-3.54
1986 make prefix=${TARGET_DIR} install
1988 rm -rf man-pages-3.54
1992 The option @option{prefix=$@{TARGET_DIR@}} is used to install the man
1993 pages on the target directory instead of the @file{/usr} directory of
2000 Zlib is a compression/decompression library.
2004 tar xf ${DOWNLOAD_DIR}/zlib-1.2.8.tar.gz -C ${BUILD_DIR}
2005 cd ${BUILD_DIR}/zlib-1.2.8
2009 make prefix=${TARGET_DIR} install
2015 In order to build zlib by cross-compilation, the flag @env{AR} has to
2016 be equal to @samp{$@{AR@}}.
2022 GNU Binutils (GNU binary utilities) is a collection of programs for
2023 manipulating binaries.
2027 tar xf ${DOWNLOAD_DIR}/binutils-2.24.tar.bz2 -C ${BUILD_DIR}
2028 cd ${BUILD_DIR}/binutils-2.24
2029 mkdir -pv ../binutils-build
2030 cd ../binutils-build
2031 ../binutils-2.24/configure \
2033 --build=${CROSS_HOST} \
2034 --host=${CROSS_TARGET} \
2035 --target=${CROSS_TARGET} \
2036 --enable-64-bit-bfd \
2040 make DESTDIR=${TARGET_DIR} tooldir= install
2041 cp -v ../binutils-2.24/include/libiberty.h ${TARGET_DIR}/include
2043 rm -rf binutils-build
2044 rm -rf binutils-2.24
2048 The option @option{--host} is now set to @env{CROSS_TARGET} because
2049 the host that will run this build will be the target system.
2051 @c @samp{make tooldir=}
2052 @c @samp{make DESTDIR=$@{TARGET_DIR@} tooldir= install}
2058 @acronym{GMP} (GNU multiple precision arithmetic library) is required
2063 tar xf ${DOWNLOAD_DIR}/gmp-5.1.3.tar.bz2 -C ${BUILD_DIR}
2064 cd ${BUILD_DIR}/gmp-5.1.3
2066 --host=${CROSS_TARGET} \
2070 make DESTDIR=${TARGET_DIR} install
2071 rm -v ${TARGET_DIR}/lib/lib{gmp,gmpxx}.la
2077 The option @option{--enable-cxx} enables support for the C++ language.
2079 The files @file{$@{TARGET_DIR@}/lib/lib@{gmp,gmpxx@}.la} are removed
2080 to avoid the following error when building MPFR:
2081 @samp{/lib/libgmp.so: could not read symbols: File in wrong format}.
2087 GNU @acronym{MPFR} (Multiple Precision Floating-Point Reliably) is a
2088 portable C library for arbitrary-precision binary floating-point
2089 computation with correct rounding.
2093 tar xf ${DOWNLOAD_DIR}/mpfr-3.1.2.tar.bz2 -C ${BUILD_DIR}
2094 cd ${BUILD_DIR}/mpfr-3.1.2
2096 --host=${CROSS_TARGET} \
2099 make DESTDIR=${TARGET_DIR} install
2100 rm -v ${TARGET_DIR}/lib/libmpfr.la
2106 The file @file{$@{TARGET_DIR@}/lib/libmpfr.la} is removed to avoid the
2107 following error when building MPC:
2108 @samp{/lib/libmpfr.so: could not read symbols: File in wrong format}.
2114 GNU @acronym{MPC} (Multiple Precision Complex Library) is a C library
2115 for the arithmetic of complex numbers with arbitrarily high precision
2116 and correct rounding of the result.
2120 tar xf ${DOWNLOAD_DIR}/mpc-1.0.1.tar.gz -C ${BUILD_DIR}
2121 cd ${BUILD_DIR}/mpc-1.0.1
2123 --host=${CROSS_TARGET} \
2126 make DESTDIR=${TARGET_DIR} install
2136 GCC is the GNU Compiler Collection.
2140 tar xf ${DOWNLOAD_DIR}/gcc-4.7.3.tar.bz2 -C ${BUILD_DIR}
2141 cd ${BUILD_DIR}/gcc-4.7.3
2142 sed -i.orig 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
2143 sed -i.orig 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
2144 mkdir -v ../gcc-build
2146 ../gcc-4.7.3/configure \
2149 --build=${CROSS_HOST} \
2150 --host=${CROSS_TARGET} \
2151 --target=${CROSS_TARGET} \
2153 --enable-threads=posix \
2154 --enable-__cxa_atexit \
2156 --enable-long-long \
2157 --disable-multilib \
2158 --enable-clocale=gnu \
2159 --enable-languages=c,c++ \
2160 --disable-libstdcxx-pch
2162 make DESTDIR=${TARGET_DIR} install
2163 ln -sv gcc ${TARGET_DIR}/bin/cc
2170 @samp{sed -i.orig 's/install_to_$(INSTALL_DEST) //'
2171 libiberty/Makefile.in} is used as we already installed the library
2172 @file{libiberty.a} with Binutils.
2174 @c We use @samp{sed -i.orig 's@@\./fixinc\.sh@@-c true@@'
2175 @c gcc/Makefile.in} to avoid using fixincludes that may output errors if
2176 @c headers have been modified.
2178 Using @option{--enable-clocale=gnu} option ensures that the correct
2179 locale will automatically be chosen.
2181 Option @option{--disable-libstdcxx-pch} disables support for
2182 precompiled headers (PCH).
2184 The line @samp{ln -sv gcc $@{TARGET_DIR@}/bin/cc} creates a
2185 symbolic link @file{cc} that points on @file{gcc}.
2191 GNU sed is a stream editor: it is used to perform basic text
2192 transformations on an input stream (a file or input from a pipeline).
2196 tar xf ${DOWNLOAD_DIR}/sed-4.2.2.tar.bz2 -C ${BUILD_DIR}
2197 cd ${BUILD_DIR}/sed-4.2.2
2199 --build=${CROSS_HOST} \
2200 --host=${CROSS_TARGET} \
2204 make DESTDIR=${TARGET_DIR} install
2210 @c @option{--bindir=/bin} FHS?
2216 E2fsprogs is a package that contains tools to handle the ext2, ext3
2217 and ext4 filesystems.
2221 tar xf ${DOWNLOAD_DIR}/e2fsprogs-1.42.8.tar.gz -C ${BUILD_DIR}
2222 cd ${BUILD_DIR}/e2fsprogs-1.42.8
2226 --build=${CROSS_HOST} \
2227 --host=${CROSS_TARGET} \
2229 --with-root-prefix="" \
2232 make DESTDIR=${TARGET_DIR} install
2233 make DESTDIR=${TARGET_DIR} install-libs
2234 rm -v ${TARGET_DIR}/lib/lib{blkid,com_err,e2p,ext2fs,ss,uuid}.so
2236 rm -rf e2fsprogs-1.42.8
2240 @option{--with-root-prefix=""} is used to put e2fsprogs binaries
2241 inside @file{/sbin} instead of @file{@var{PREFIX}/sbin} which would be
2244 Option @option{--enable-elf-shlibs} enables e2fsprogs shared
2247 @samp{make DESTDIR=$@{TARGET_DIR@} install-libs} is used to install
2248 libraries, those are not installed with @samp{make
2249 DESTDIR=$@{TARGET_DIR@} install}.
2251 The sequence of commands that follows first removes symbolic links
2252 @file{$@{TARGET_DIR@}/lib/lib@{@/blkid,com_err,e2p,ext2fs,ss,uuid@}.so}
2253 which point on abolute paths
2254 @file{/lib/lib@{blkid,com_err,e2p,ext2fs,ss,uuid@}.so}. In order to
2255 use the libraries of the target operating system, we need to symlink
2256 @file{$@{TARGET_DIR@}/lib/lib@{blkid,com_err,e2p,ext2fs,ss,uuid@}.so}
2257 to their relative paths files.
2263 GNU coreutils (core utilities) includes the standard programs for text
2264 and file manipulation.
2266 On gNewSense Parkes, you need to install @file{xz-utils} to extract
2271 tar xf ${DOWNLOAD_DIR}/coreutils-8.19.tar.xz -C ${BUILD_DIR}
2272 cd ${BUILD_DIR}/coreutils-8.19
2273 cat > config.cache << EOF
2274 fu_cv_sys_stat_statfs2_bsize=yes
2275 gl_cv_func_mbrtowc_incomplete_state=yes
2276 gl_cv_func_mbrtowc_nul_retval=yes
2277 gl_cv_func_mbrtowc_null_arg=yes
2278 gl_cv_func_mbrtowc_retval=yes
2279 gl_cv_func_btowc_eof=yes
2280 gl_cv_func_wcrtomb_retval=yes
2281 gl_cv_func_wctob_works=yes
2282 gl_cv_func_fstatat_zero_flag=yes
2285 --build=${CROSS_HOST} \
2286 --host=${CROSS_TARGET} \
2288 --enable-install-program=hostname \
2289 --enable-no-install-program=kill,uptime \
2290 --cache-file=config.cache
2292 make DESTDIR=${TARGET_DIR} install
2294 rm -rf coreutils-8.19
2298 @c @samp{sed -i.orig '/strftime/s/\ LC_ALL//' man/help2man}
2300 The variables listed in the file @file{config.cache} are used in order
2301 to avoid that the @file{configure} script evaluate their values:
2302 otherwise the build may fail when cross-compiling.
2304 We use @option{--enable-install-program=hostname} to install the
2305 command @command{hostname} which is not built by default.
2307 We use @option{--enable-no-install-program=kill,uptime} in order not
2308 to install commands @command{kill} and @command{uptime}. Those
2309 commands will be installed by the package procps.
2315 The iana-etc package installs services and protocols using data from
2316 the Internet Assigned Numbers Authority (IANA).
2320 tar xf ${DOWNLOAD_DIR}/iana-etc-2.30.tar.bz2 -C ${BUILD_DIR}
2321 cd ${BUILD_DIR}/iana-etc-2.30
2323 make DESTDIR=${TARGET_DIR} install
2325 rm -rf iana-etc-2.30
2333 GNU M4 is a package containing an implementation of the m4 macro
2334 language. GNU M4 is used in GNU Autoconf' @file{configure} files.
2338 tar xf ${DOWNLOAD_DIR}/m4-1.4.17.tar.bz2 -C ${BUILD_DIR}
2339 cd ${BUILD_DIR}/m4-1.4.17
2341 --build=${CROSS_HOST} \
2342 --host=${CROSS_TARGET} \
2345 make DESTDIR=${TARGET_DIR} install
2355 GNU bison parser generator.
2359 tar xf ${DOWNLOAD_DIR}/bison-2.7.tar.gz -C ${BUILD_DIR}
2360 cd ${BUILD_DIR}/bison-2.7
2362 --build=${CROSS_HOST} \
2363 --host=${CROSS_TARGET} \
2365 echo '#define YYENABLE_NLS 1' >> config.h
2367 make DESTDIR=${TARGET_DIR} install
2373 @samp{echo '#define YYENABLE_NLS 1' >> config.h} is used to build
2374 @acronym{NLS} (native language support) inside bison.
2382 tar xf ${DOWNLOAD_DIR}/ncurses-5.9.tar.gz -C ${BUILD_DIR}
2383 cd ${BUILD_DIR}/ncurses-5.9
2385 --build=${CROSS_HOST} \
2386 --host=${CROSS_TARGET} \
2392 --with-build-cc="gcc -D_GNU_SOURCE" \
2395 make DESTDIR=${TARGET_DIR} install
2401 Option @option{--enable-widec} enables wide characters support in
2404 @c Option @option{--without-debug}
2406 Option @option{--without-ada} disables support for the Ada programming
2407 language inside ncurses.
2409 @c Option @option{--with-build-cc="gcc -D_GNU_SOURCE"}
2411 @c Option @option{--libdir=/lib}
2415 The command @samp{ln -sfv libncursesw.so $@{TARGET_DIR@}/lib/libncurses.so}
2416 creates the symlink @file{libcurses.so} so that programs that do not
2417 know @file{libncursesw.so} can be linked against it.
2420 @c ln -sfv ../../share/terminfo ${TARGET_DIR}/lib/terminfo
2426 The procps package contains utilities that give information about
2427 processes using the @file{/proc} filesystem. The package includes the
2428 commands @command{ps}, @command{top}, @command{vmstat}, @command{w},
2429 @command{kill}, @command{free}, @command{slabtop}, and
2434 ln -sv ncursesw/curses.h ${TARGET_DIR}/include/curses.h
2435 ln -sv ncursesw/ncurses.h ${TARGET_DIR}/include/ncurses.h
2436 ln -sv ncursesw/term.h ${TARGET_DIR}/include/term.h
2437 ln -sfv libncursesw.so ${TARGET_DIR}/lib/libncurses.so
2438 tar xf ${DOWNLOAD_DIR}/procps-3.2.8.tar.gz -C ${BUILD_DIR}
2439 cd ${BUILD_DIR}/procps-3.2.8
2441 # From http://lists.gnu.org/archive/html/bug-make/2010-07/msg00153.html
2442 sed '177s,\*/module.mk,proc/module.mk ps/proc.mk,' -i.orig Makefile
2448 DESTDIR=${TARGET_DIR} \
2451 install="install -D" \
2459 Option @option{CPPFLAGS= } is used so that the target system's ncurses
2460 library will be used, default value would have been
2461 @option{-I/include/ncurses}.
2464 Option @option{lib64=lib} makes the directory @file{/lib} the one
2465 where to put 64 bit libraries, default would be @file{/lib64}.
2467 Option @option{ldconfig= } is used in order not to use current host's
2470 Option @option{install="install -D"} is used so that all the files
2471 installed are owned by the current user. By default, all installed
2472 files are owned by root.
2478 GNU libtool is a generic library support script. It hides the
2479 complexity of using shared libraries behind a consistent, portable
2484 tar xf ${DOWNLOAD_DIR}/libtool-2.4.2.tar.gz -C ${BUILD_DIR}
2485 cd ${BUILD_DIR}/libtool-2.4.2
2487 --build=${CROSS_HOST} \
2488 --host=${CROSS_TARGET} \
2491 make DESTDIR=${TARGET_DIR} install
2493 rm -rf libtool-2.4.2
2501 The GNU Readline library provides a set of functions for use by
2502 applications that allow users to edit command lines as they are typed
2507 tar xf ${DOWNLOAD_DIR}/readline-6.2.tar.gz -C ${BUILD_DIR}
2508 cd ${BUILD_DIR}/readline-6.2
2510 --build=${CROSS_HOST} \
2511 --host=${CROSS_TARGET} \
2515 make DESTDIR=${TARGET_DIR} install
2516 make DESTDIR=${TARGET_DIR} install-doc
2522 @c sed -i 's:^SHLIB_LIBS=:SHLIB_LIBS=-lncursesw:' support/shobj-conf
2528 GNU autoconf is an extensible package of M4 macros that produce shell
2529 scripts to automatically configure software source code
2530 packages. These scripts can adapt the packages to many kinds of
2531 UNIX-like systems without manual user intervention.
2535 tar xf ${DOWNLOAD_DIR}/autoconf-2.69.tar.gz -C ${BUILD_DIR}
2536 cd ${BUILD_DIR}/autoconf-2.69
2538 --build=${CROSS_HOST} \
2539 --host=${CROSS_TARGET} \
2542 make DESTDIR=${TARGET_DIR} install
2544 rm -rf autoconf-2.69
2552 GNU automake is a tool for automatically generating @file{Makefile.in}
2553 files compliant with the GNU Coding
2554 Standards@footnote{@uref{http://www.gnu.org/prep/standards/}}.
2556 You need Autoconf on your system to compile this program from
2557 source. Under gNewSense 4.0, try @samp{sudo apt-get install autoconf}
2558 (version 2.69 here).
2562 tar xf ${DOWNLOAD_DIR}/automake-1.14.tar.gz -C ${BUILD_DIR}
2563 cd ${BUILD_DIR}/automake-1.14
2565 --build=${CROSS_HOST} \
2566 --host=${CROSS_TARGET} \
2569 make DESTDIR=${TARGET_DIR} install
2571 rm -rf automake-1.14
2579 GNU @acronym{Bash} (Bourne again shell) is an sh-compatible shell that
2580 incorporates useful features from the Korn shell (ksh) and C shell
2585 tar xf ${DOWNLOAD_DIR}/bash-4.2.tar.gz -C ${BUILD_DIR}
2586 cd ${BUILD_DIR}/bash-4.2
2587 cat > config.cache << EOF
2588 ac_cv_func_mmap_fixed_mapped=yes
2589 ac_cv_func_strcoll_works=yes
2590 ac_cv_func_working_mktime=yes
2591 bash_cv_func_sigsetjmp=present
2592 bash_cv_getcwd_malloc=yes
2593 bash_cv_job_control_missing=present
2594 bash_cv_printf_a_format=yes
2595 bash_cv_sys_named_pipes=present
2596 bash_cv_ulimit_maxfds=yes
2597 bash_cv_under_sys_siglist=yes
2598 bash_cv_unusable_rtsigs=no
2599 gt_cv_int_divbyzero_sigfpe=yes
2602 --build=${CROSS_HOST} \
2603 --host=${CROSS_TARGET} \
2606 --cache-file=config.cache \
2607 --without-bash-malloc \
2608 --with-installed-readline
2611 DESTDIR=${TARGET_DIR} \
2612 htmldir=/share/doc/bash-4.2 \
2614 ln -sv bash ${TARGET_DIR}/bin/sh
2620 The variables listed in the file @file{config.cache} are used in order
2621 to avoid that the @file{configure} script evaluate their values:
2622 otherwise the build may fail when cross-compiling.
2624 Option @option{--without-bash-malloc} tells the @file{configure}
2625 script not to use the @code{malloc} function shipped with
2626 Bash. Glibc's version will be used instead.
2628 Option @option{--with-installed-readline} tells the configure script
2629 to use the installed readline library instead of the one shipped with
2632 @samp{ln -sv bash $@{TARGET_DIR@}/bin/sh} creates a symlink @file{sh}
2639 Bzip2 is a package that contains utilities to compress and decompress
2640 files with a better original size/compressed size ratio than gzip.
2644 tar xf ${DOWNLOAD_DIR}/bzip2-1.0.6.tar.gz -C ${BUILD_DIR}
2645 cd ${BUILD_DIR}/bzip2-1.0.6
2646 sed -i -e "/^all:/s/ test//" Makefile
2647 sed -i -e 's:ln -s -f $(PREFIX)/bin/:ln -s :' Makefile
2649 -f Makefile-libbz2_so \
2659 PREFIX=${TARGET_DIR} \
2661 cp -av libbz2.so* ${TARGET_DIR}/lib
2662 ln -sv ../../lib/libbz2.so.1.0 ${TARGET_DIR}/lib/libbz2.so
2663 rm -v ${TARGET_DIR}/bin/{bunzip2,bzcat,bzip2}
2664 cp -v bzip2-shared ${TARGET_DIR}/bin/bzip2
2665 ln -sv bzip2 ${TARGET_DIR}/bin/bunzip2
2666 ln -sv bzip2 ${TARGET_DIR}/bin/bzcat
2672 @samp{sed -i.orig -e "/^all:/s/ test//" Makefile} is used to skip
2673 tests when building.
2675 @samp{sed -i -e 's:ln -s -f $(PREFIX)/bin/:ln -s :' Makefile} is used
2676 in order to have relative path symlinks instead of absolute ones.
2678 Option @option{-f Makefile-libbz2_so} is used to build shared
2681 Flags @env{CC}, @env{AR} and @env{RANLIB} are used so that bzip2 is
2682 built using cross-compilation tools instead of the host's ones.
2684 @samp{make clean} is used to clean up temporary files.
2686 The second build commands are used to build static libraries.
2689 cp -v bzip2-shared ${TARGET_DIR}/bin/bzip2
2690 cp -av libbz2.so* ${TARGET_DIR}/lib
2691 ln -sv ../../lib/libbz2.so.1.0 ${TARGET_DIR}/lib/libbz2.so
2692 rm -v ${TARGET_DIR}/bin/{bunzip2,bzcat,bzip2}
2693 ln -sv bzip2 ${TARGET_DIR}/bin/bunzip2
2694 ln -sv bzip2 ${TARGET_DIR}/bin/bzcat
2701 DHCPCD is a wrapper for the @acronym{DHCP} (Dynamic Host Configuration
2702 Protocol) client daemon.
2706 tar xf ${DOWNLOAD_DIR}/dhcpcd-6.1.0.tar.bz2 -C ${BUILD_DIR}
2707 cd ${BUILD_DIR}/dhcpcd-6.1.0
2709 --build=${CROSS_HOST} \
2710 --host=${CROSS_TARGET} \
2714 --dbdir=/var/lib/dhcpcd \
2715 --libexecdir=/lib/dhcpcd
2717 make DESTDIR=${TARGET_DIR} install
2723 @c Option @option{--bindir=/sbin} is used to comply with FHS?
2724 @c @option{--sysconfdir=/etc} @file{/etc} instead of ?
2725 @c @option{--dbdir=/var/lib/dhcpcd} @file{/var/lib/dhcpcd} instead of?
2726 @c @option{--libexecdir=/lib/dhcpcd} @file{/lib/dhcpcd} instead of ?
2732 GNU Diffutils is a package of several programs related to finding
2733 differences between files.
2737 tar xf ${DOWNLOAD_DIR}/diffutils-3.3.tar.xz -C ${BUILD_DIR}
2738 cd ${BUILD_DIR}/diffutils-3.3
2740 --build=${CROSS_HOST} \
2741 --host=${CROSS_TARGET} \
2744 make DESTDIR=${TARGET_DIR} install
2746 rm -rf diffutils-3.3
2756 tar xf ${DOWNLOAD_DIR}/file-5.16.tar.gz -C ${BUILD_DIR}
2757 cd ${BUILD_DIR}/file-5.16
2759 --build=${CROSS_HOST} \
2760 --host=${CROSS_TARGET} \
2763 make DESTDIR=${TARGET_DIR} install
2773 The GNU Find Utilities are typically used to provide directory search
2774 and file locating capabilities.
2778 tar xf ${DOWNLOAD_DIR}/findutils-4.4.2.tar.gz -C ${BUILD_DIR}
2779 cd ${BUILD_DIR}/findutils-4.4.2
2780 cat > config.cache << EOF
2781 gl_cv_func_wcwidth_works=yes
2782 gl_cv_header_working_fcntl_h=yes
2783 ac_cv_func_fnmatch_gnu=yes
2786 --build=${CROSS_HOST} \
2787 --host=${CROSS_TARGET} \
2789 --libexecdir=/lib/locate \
2790 --localstatedir=/var/lib/locate \
2791 --cache-file=config.cache
2793 make DESTDIR=${TARGET_DIR} install
2795 rm -rf findutils-4.4.2
2799 @c --libexecdir=/lib/locate
2800 @c --localstatedir=/var/lib/locate
2806 Flex is a tool for generating scanners. A scanner, sometimes called a
2807 tokenizer, is a program which recognizes lexical patterns in text.
2811 tar xf ${DOWNLOAD_DIR}/flex-2.5.37.tar.bz2 -C ${BUILD_DIR}
2812 cd ${BUILD_DIR}/flex-2.5.37
2813 # From http://sourceforge.net/p/flex/bugs/151/
2814 sed '1s/$/\n#undef malloc\n#undef realloc/' \
2815 -i.orig lib/realloc.c
2816 cat > config.cache << EOF
2817 ac_cv_path_M4="/bin/m4"
2820 --build=${CROSS_HOST} \
2821 --host=${CROSS_TARGET} \
2823 --cache-file=config.cache
2825 make DESTDIR=${TARGET_DIR} install
2826 ln -sv libfl.a ${TARGET_DIR}/lib/libl.a
2831 cat > ${TARGET_DIR}/bin/lex << EOF
2833 exec /bin/flex -l \$@
2835 chmod -v 755 ${TARGET_DIR}/bin/lex
2838 @file{config.cache} forces flex to use @file{/bin/m4} instead of
2839 @file{/gllfsc/cross-tools/bin/m4} on the target machine.
2841 For compatibility issues, we create the symlink @file{libl.a}.
2843 We then create target system's @file{/bin/lex} that will execute
2844 @command{flex} with option @option{-l} in order to behave with maximal
2845 compatibility like @command{lex}.
2848 @samp{sed -i.orig "s/-I@@includedir@@//g" Makefile.in} is used in
2849 order not to use host's headers in @file{/include} during
2853 @c Variables @samp{ac_cv_func_malloc_0_nonnull=yes} and
2854 @c @samp{ac_cv_func_realloc_0_nonnull=yes} are used to get rid of
2855 @c error message: @samp{}.
2857 @c We use option @option{-fPIC} passed to the cross-compiler in order to
2858 @c generate position-independent code (PIC).
2864 GNU awk (Gawk) is a program used to select particular records in a
2865 file and perform operations upon them.
2869 tar xf ${DOWNLOAD_DIR}/gawk-4.1.0.tar.gz -C ${BUILD_DIR}
2870 cd ${BUILD_DIR}/gawk-4.1.0
2872 '/check-recursive all-recursive/s/ check-for-shared-lib-support//' \
2873 extension/Makefile.in
2875 --build=${CROSS_HOST} \
2876 --host=${CROSS_TARGET} \
2880 make DESTDIR=${TARGET_DIR} install
2886 The sed expression is used to avoid the error @samp{Building the
2887 extensions is not supported on this platform}.
2893 GNU dbm is a library of database functions.
2897 tar xf ${DOWNLOAD_DIR}/gdbm-1.11.tar.gz -C ${BUILD_DIR}
2898 cd ${BUILD_DIR}/gdbm-1.11
2900 --build=${CROSS_HOST} \
2901 --host=${CROSS_TARGET} \
2904 make DESTDIR=${TARGET_DIR} install
2914 GNU gettext utilities are a set of tools that provides a framework to
2915 help packages produce multi-lingual messages.
2919 tar xf ${DOWNLOAD_DIR}/gettext-0.18.3.1.tar.gz -C ${BUILD_DIR}
2920 cd ${BUILD_DIR}/gettext-0.18.3.1
2921 cat > config.cache << EOF
2922 am_cv_func_iconv_works=yes
2923 gl_cv_func_wcwidth_works=yes
2924 gt_cv_func_printf_posix=yes
2925 gt_cv_int_divbyzero_sigfpe=yes
2928 --build=${CROSS_HOST} \
2929 --host=${CROSS_TARGET} \
2931 --cache-file=config.cache
2933 #cp gettext-tools/gnulib-lib/.libs/libgettextlib.la{,i}
2934 #cp gettext-tools/src/.libs/libgettextsrc.la{,i}
2935 make DESTDIR=${TARGET_DIR} install
2937 rm -rf gettext-0.18.3.1
2941 @c cp gettext-tools/gnulib-lib/.libs/libgettextlib.la{,i} ?
2942 @c cp gettext-tools/src/.libs/libgettextsrc.la{,i} ?
2948 GNU @command{grep} command searches one or more input files for lines
2949 containing a match to a specified pattern.
2953 tar xf ${DOWNLOAD_DIR}/grep-2.15.tar.xz -C ${BUILD_DIR}
2954 cd ${BUILD_DIR}/grep-2.15
2956 --build=${CROSS_HOST} \
2957 --host=${CROSS_TARGET} \
2960 --disable-perl-regexp
2962 make DESTDIR=${TARGET_DIR} install
2968 Option @option{--disable-perl-regexp} disables support of Perl-style
2969 regular expressions (regexp).
2975 Groff is the GNU version of the roff document formatting system which
2976 is used to produce man pages.
2980 tar xf ${DOWNLOAD_DIR}/groff-1.22.2.tar.gz -C ${BUILD_DIR}
2981 cd ${BUILD_DIR}/groff-1.22.2
2984 --build=${CROSS_HOST} \
2985 --host=${CROSS_TARGET} \
2991 make prefix=${TARGET_DIR} install
2992 ln -sv soelim ${TARGET_DIR}/bin/zsoelim
2993 ln -sv eqn ${TARGET_DIR}/bin/geqn
2994 ln -sv tbl ${TARGET_DIR}/bin/gtbl
3000 The variables @env{TROFFBIN=troff} and @env{GROFFBIN=groff} tell
3001 @command{make} to use @command{troff} and @command{groff} commands
3002 installed in the @ref{Building the Cross-Compilation Tools} to build
3005 The variable @env{GROFF_BIN_PATH} before @env{PATH} is checked for
3006 programs @command{groff} is calling (preprocessors, @command{troff},
3007 and output devices). If not set, it defaults to the directory where
3008 the @file{groff} binary is located.
3010 The symlinks are used for compatibility.
3016 GNU Gzip is a data compression program.
3020 tar xf ${DOWNLOAD_DIR}/gzip-1.6.tar.gz -C ${BUILD_DIR}
3021 cd ${BUILD_DIR}/gzip-1.6
3023 --build=${CROSS_HOST} \
3024 --host=${CROSS_TARGET} \
3027 make DESTDIR=${TARGET_DIR} install
3037 Inetutils is a collection of common network programs.
3041 tar xf ${DOWNLOAD_DIR}/inetutils-1.9.1.tar.gz -C ${BUILD_DIR}
3042 cd ${BUILD_DIR}/inetutils-1.9.1
3043 sed -i '/gets is a security hole/d' lib/stdio.in.h
3044 sed -i -e '/PATH_PROCNET_DEV/s/\ no//' paths
3046 --build=${CROSS_HOST} \
3047 --host=${CROSS_TARGET} \
3050 make DESTDIR=${TARGET_DIR} install
3052 rm -rf inetutils-1.9.1
3056 @samp{sed -i.orig '/gets is a security hole/d' lib/stdio.in.h} is used
3057 to fix the following error when issuing @samp{make}:
3058 @samp{./stdio.h:1030:1: error: 'gets' undeclared here (not in a
3061 @c It deletes the following line in lib/stdio.in.h:
3062 @c _GL_WARN_ON_USE (gets, ``gets is a security hole - use fgets instead'');
3064 @samp{sed -i.orig -e '/PATH_PROCNET_DEV/s/\ no//' paths} is used to
3065 fix the following error when issuing @samp{make}:
3066 @samp{'PATH_PROCNET_DEV' undeclared (first use in this function)}.
3072 Iproute2 is a collection of utilities for controlling TCP and UDP IP
3073 networking and traffic.
3075 You need Bison and Flex on your system to compile this program from
3076 source. Under gNewSense 4.0, try @samp{sudo apt-get install bison flex}.
3080 tar xf ${DOWNLOAD_DIR}/iproute2-3.10.0.tar.bz2 -C ${BUILD_DIR}
3081 cd ${BUILD_DIR}/iproute2-3.10.0
3082 sed -i.orig '/^TARGETS/s@arpd@@g' misc/Makefile
3084 DESTDIR=${TARGET_DIR} \
3086 DOCDIR=/share/doc/iproute2 \
3089 DESTDIR=${TARGET_DIR} \
3090 DOCDIR=/share/doc/iproute2 \
3094 rm -rf iproute2-3.10.0
3098 @samp{sed -i.orig '/^TARGETS/s@@arpd@@@@g' misc/Makefile} is used to
3099 disable the build of @command{arpd} as it requires Berkeley DB to be
3102 @env{DOCDIR} and @env{MANDIR} indicate the location in which the
3103 documentation and the manual pages will be installed,
3104 respectively. Those are no absolute paths but use the value of
3105 @env{DESTDIR} as a prefix.
3111 Kbd contains keytable files and keyboard utilities.
3113 You need Check on your system to compile this program from
3114 source. Under gNewSense 4.0, try @samp{sudo apt-get install check}.
3118 tar xf ${DOWNLOAD_DIR}/kbd-2.0.1.tar.gz -C ${BUILD_DIR}
3119 cd ${BUILD_DIR}/kbd-2.0.1
3121 # Do not check for CHECK:
3122 sed '14s/^/#/' -i.orig configure.ac
3123 autoconf configure.ac > configure
3125 sed -i.orig '/^SUBDIRS/s/ tests//' Makefile.am
3127 --build=${CROSS_HOST} \
3128 --host=${CROSS_TARGET} \
3132 make DESTDIR=${TARGET_DIR} install
3138 @samp{sed -i.orig '/SUBDIRS/s/ tests//' Makefile.in} is used to
3139 prevent files in the @file{tests} directory to be built.
3141 Option @option{--disable-vlock} disables the build of vlock. vlock
3142 needs PAM library headers to be present on the build system and is not
3143 necessary for us, so we do not build it.
3149 Kmod (previously known as module-init-tools) provide userspace-side
3150 assistance in loading kernel modules and their dependencies.
3152 You need Xsltproc on your system to compile this program from
3153 source. Under gNewSense 4.0, try @samp{sudo apt-get install xsltproc}.
3157 tar xf ${DOWNLOAD_DIR}/kmod-15.tar.gz -C ${BUILD_DIR}
3158 cd ${BUILD_DIR}/kmod-15
3159 zlib_CFLAGS="-I${TARGET_DIR}/include" \
3160 zlib_LIBS="-L${TARGET_DIR}/lib -lz" \
3162 --build=${CROSS_HOST} \
3163 --host=${CROSS_TARGET} \
3168 DESTDIR=${TARGET_DIR} \
3176 ln -sv kmod ${TARGET_DIR}/bin/lsmod
3177 ln -sv kmod ${TARGET_DIR}/bin/depmod
3178 ln -sv kmod ${TARGET_DIR}/bin/insmod
3179 ln -sv kmod ${TARGET_DIR}/bin/modprobe
3180 ln -sv kmod ${TARGET_DIR}/bin/modinfo
3181 ln -sv kmod ${TARGET_DIR}/bin/rmmod
3184 @samp{zlib_CFLAGS} and @samp{zlib_LIBS} are defined to avoid the error
3185 message: @samp{The pkg-config script could not be found or is too
3186 old. Make sure it is in your PATH or set the PKG_CONFIG environment
3187 variable to the full path to pkg-config. Alternatively, you may set
3188 the environment variables zlib_CFLAGS and zlib_LIBS to avoid the need
3189 to call pkg-config.}
3191 @option{--with-zlib} enables support for modules compressed with
3194 By default, installation uses @env{INSTALL=install-with-care} which
3195 checks if old utilities have not been destroyed. To avoid this check,
3196 we use @env{INSTALL=install}.
3202 Less is a file pager: it is used to view the content of a text file.
3206 tar xf ${DOWNLOAD_DIR}/less-458.tar.gz -C ${BUILD_DIR}
3207 cd ${BUILD_DIR}/less-458
3209 --build=${CROSS_HOST} \
3210 --host=${CROSS_TARGET} \
3213 make prefix=${TARGET_DIR} install
3221 @section Libpipeline
3223 Libpipeline is a C library for manipulating pipelines of subprocesses
3224 in a flexible and convenient way.
3227 tar xf ${DOWNLOAD_DIR}/libpipeline-1.3.0.tar.gz -C ${BUILD_DIR}
3228 cd ${BUILD_DIR}/libpipeline-1.3.0
3230 --build=${CROSS_HOST} \
3231 --host=${CROSS_TARGET} \
3234 make prefix=${TARGET_DIR} install
3236 rm -rf libpipeline-1.3.0
3244 GNU @command{make} utility determines automatically which pieces of a
3245 large program need to be recompiled, and issues the commands to
3250 tar xf ${DOWNLOAD_DIR}/make-4.0.tar.bz2 -C ${BUILD_DIR}
3251 cd ${BUILD_DIR}/make-4.0
3253 --build=${CROSS_HOST} \
3254 --host=${CROSS_TARGET} \
3257 make DESTDIR=${TARGET_DIR} install
3267 Man-db is an implementation of the standard Unix documentation system
3268 accessed using the man command. It uses a Berkeley DB database in
3269 place of the traditional flat-text whatis databases.
3272 # fix /lib/libpipeline.so: error adding symbols: File in wrong format
3273 rm ${TARGET_DIR}/lib/libgdbm.la
3274 rm ${TARGET_DIR}/lib/libpipeline.la
3276 tar xf ${DOWNLOAD_DIR}/man-db-2.6.7.1.tar.xz -C ${BUILD_DIR}
3277 cd ${BUILD_DIR}/man-db-2.6.7.1
3278 libpipeline_CFLAGS="-I${TARGET_DIR}/include" \
3279 libpipeline_LIBS="-L${TARGET_DIR}/lib -lpipeline" \
3281 --build=${CROSS_HOST} \
3282 --host=${CROSS_TARGET} \
3285 make DESTDIR=${TARGET_DIR} install
3287 rm -rf man-db-2.6.7.1
3290 sed -i 's/#\(DEFINE.*pager.*\)less -s/\1 less -isRc/' \
3291 ${TARGET_DIR}/etc/man_db.conf
3294 @samp{libpipeline_CFLAGS} and @samp{libpipeline_LIBS} are defined to
3295 avoid the error message: @samp{The pkg-config script could not be
3296 found or is too old. Make sure it is in your PATH or set the
3297 PKG_CONFIG environment variable to the full path to
3298 pkg-config. Alternatively, you may set the environment variables
3299 libpipeline_CFLAGS and libpipeline_LIBS to avoid the need to call
3302 The @command{sed} command is used to replace default pager with
3303 @command{less}. Option @option{-c} will cause @command{less} to
3304 display man pages faster as this option disables scrolling. Option
3305 @option{-R} will cause @command{less} to render colors in the man
3312 GNU nano is a lightweight text editor.
3316 tar xf ${DOWNLOAD_DIR}/nano-2.3.2.tar.gz -C ${BUILD_DIR}
3317 cd ${BUILD_DIR}/nano-2.3.2
3319 --build=${CROSS_HOST} \
3320 --host=${CROSS_TARGET} \
3323 '/CPPFLAGS/s@/usr/include/ncursesw@${TARGET_DIR}/include@' \
3324 `find . -iname 'Makefile'`
3326 make DESTDIR=${TARGET_DIR} install
3332 The sed expression is used to replace @file{/usr/include/ncursesw}
3333 with @file{$@{TARGET_DIR@}/include} in every file named
3334 @file{Makefile} in order to overcome the error
3335 @samp{/usr/include/ncursesw/ncurses.h:60:34: fatal error:
3336 ncursesw/ncurses_dll.h: No such file or directory}.
3339 commands in nano are displayed as in `^X'. The `^' character means
3340 @key{CTRL} key, so `^X' means @kbd{CTRL-X}.
3347 GNU patch takes a patch file containing a difference listing produced
3348 by the @command{diff} program and applies those differences to one or
3349 more original files, producing patched versions.
3353 tar xf ${DOWNLOAD_DIR}/patch-2.7.1.tar.bz2 -C ${BUILD_DIR}
3354 cd ${BUILD_DIR}/patch-2.7.1
3355 cat > config.cache << EOF
3356 ac_cv_path_ed_PROGRAM=ed
3357 ac_cv_func_strnlen_working=yes
3360 --build=${CROSS_HOST} \
3361 --host=${CROSS_TARGET} \
3363 --cache-file=config.cache
3365 make prefix=${TARGET_DIR} install
3375 This package contains utilities that use the proc filesystem.
3379 tar xf ${DOWNLOAD_DIR}/psmisc-22.20.tar.gz -C ${BUILD_DIR}
3380 cd ${BUILD_DIR}/psmisc-22.20
3381 cat > config.cache << EOF
3382 ac_cv_func_malloc_0_nonnull=yes
3383 ac_cv_func_realloc_0_nonnull=yes
3386 --build=${CROSS_HOST} \
3387 --host=${CROSS_TARGET} \
3389 --cache-file=config.cache
3391 make DESTDIR=${TARGET_DIR} install
3403 tar xf ${DOWNLOAD_DIR}/shadow-4.1.4.3.tar.bz2 -C ${BUILD_DIR}
3404 cd ${BUILD_DIR}/shadow-4.1.4.3
3406 echo "ac_cv_func_setpgrp_void=yes" > config.cache
3408 --build=${CROSS_HOST} \
3409 --host=${CROSS_TARGET} \
3416 --cache-file=config.cache \
3418 sed -i.orig '/man_MANS/s/$(man_nopam) //' man/ru/Makefile
3419 sed -i.orig 's/groups$(EXEEXT) //' src/Makefile
3420 for mkf in $(find man -name Makefile)
3422 sed -i.orig -e '/groups.1.xml/d' -e 's/groups.1 //' ${mkf}
3425 make DESTDIR=${TARGET_DIR} install
3426 sed -i.orig -e 's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \
3427 -e 's@/var/spool/mail@/var/mail@' \
3428 ${TARGET_DIR}/etc/login.defs
3429 ${CROSS_TARGET}-pwconv
3430 ${CROSS_TARGET}-grpconv
3432 rm -rf shadow-4.1.4.3
3436 @c echo "ac_cv_func_setpgrp_void=yes" > config.cache
3438 The option @option{--enable-man} is used to generate man pages.
3440 The first call of @command{sed} removes @var{$(man_nopam)} on the line
3441 with man_MANS in @file{man/ru/Makefile.am} in order for @samp{make
3442 install} to complete.
3444 The second call of @command{sed} disables the build of command
3445 @command{groups}, as coreutils already installed it.
3447 The last call of @command{sed} enables support for MD5 encrypted
3448 passwords and changes the mail default directory from
3449 @file{/var/spool/mail} to @file{/var/mail}.
3451 The @command{pwconv} command creates @file{shadow} file from file
3452 @file{passwd} and an optionally existing @file{shadow} file.
3454 The @command{grpconv} command creates @file{gshadow} file from file
3455 @file{group} and an optionally existing @file{gshadow} file.
3461 Sysvinit is the system-V style init process. Init is the first process
3462 started during booting. It is started by the kernel. Init continues
3463 running as a daemon until the system is shut down. It is the direct or
3464 indirect ancestor of all other processes and automatically adopts all
3470 tar xf ${DOWNLOAD_DIR}/sysvinit-2.88dsf.tar.bz2 -C ${BUILD_DIR}
3471 cd ${BUILD_DIR}/sysvinit-2.88dsf
3472 sed -i.orig -e 's@/dev/initctl@$(ROOT)&@g' \
3473 -e 's@\(mknod \)-m \([0-9]* \)\(.* \)p@\1\3p; chmod \2\3@g' \
3474 -e '/^ifeq/s/$(ROOT)//' \
3475 -e 's@/usr/lib@$(ROOT)/lib@' \
3478 make -C src ROOT=${TARGET_DIR} CC="${CC}"
3479 make -C src ROOT=${TARGET_DIR} INSTALL="install" install
3481 rm -rf sysvinit-2.88dsf
3484 cat > ${TARGET_DIR}/etc/inittab << EOF
3485 # Begin /etc/inittab
3489 si::sysinit:/etc/rc.d/init.d/rc sysinit
3491 l0:0:wait:/etc/rc.d/init.d/rc 0
3492 l1:S1:wait:/etc/rc.d/init.d/rc 1
3493 l2:2:wait:/etc/rc.d/init.d/rc 2
3494 l3:3:wait:/etc/rc.d/init.d/rc 3
3495 l4:4:wait:/etc/rc.d/init.d/rc 4
3496 l5:5:wait:/etc/rc.d/init.d/rc 5
3497 l6:6:wait:/etc/rc.d/init.d/rc 6
3499 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
3501 su:S016:once:/sbin/sulogin
3503 1:2345:respawn:/sbin/agetty --noclear tty1 9600
3504 2:2345:respawn:/sbin/agetty tty2 9600
3505 #3:2345:respawn:/sbin/agetty tty3 9600
3506 #4:2345:respawn:/sbin/agetty tty4 9600
3507 #5:2345:respawn:/sbin/agetty tty5 9600
3508 #6:2345:respawn:/sbin/agetty tty6 9600
3510 #c0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100
3516 The first call of @command{sed} replaces @file{/dev/initctl} with
3517 @file{$(ROOT)/dev/initctl}, and @file{/usr/lib} with
3518 @file{$(ROOT)/lib} among other things in order to install sysvinit
3519 on the target system.
3521 @samp{make -C src clobber} is used to clean up the @file{src}
3524 Then, we create the @file{inittab} file that describes which processes
3525 are started at bootup and during normal operation.
3527 The line @samp{#c0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100} is
3528 commented out (with @code{#}) in order to avoid the message:
3529 @samp{INIT: Id "c0" respawning too fast: disabled for 5 minutes} on
3536 GNU tar is an archiving utility: it stores and extracts files from a
3537 tape or disk archive.
3541 tar xf ${DOWNLOAD_DIR}/tar-1.27.1.tar.bz2 -C ${BUILD_DIR}
3542 cd ${BUILD_DIR}/tar-1.27.1
3544 --build=${CROSS_HOST} \
3545 --host=${CROSS_TARGET} \
3548 make DESTDIR=${TARGET_DIR} install
3558 GNU Texinfo is a documentation system that can produce both online
3559 information and a printed manual from a single source.
3561 You need Ncurses headers on your system to compile this program from
3562 source. Under gNewSense 4.0, try @samp{sudo apt-get install
3567 tar xf ${DOWNLOAD_DIR}/texinfo-4.13a.tar.gz -C ${BUILD_DIR}
3568 cd ${BUILD_DIR}/texinfo-4.13
3570 --build=${CROSS_HOST} \
3571 --host=${CROSS_TARGET} \
3573 make -C tools/gnulib/lib
3576 make DESTDIR=${TARGET_DIR} install
3581 cd ${TARGET_DIR}/share/info
3584 do install-info $f dir 2>/dev/null
3589 The first three calls of @command{make} make it possible to build
3590 Texinfo by cross-compilation.
3592 For Info to work, the @file{info} directory must contain a file that
3593 serves as a top level directory for the Info system. By convention,
3594 this file is called @file{dir}. We update this file for the target
3601 Udev is the dynamic device management of the kernel Linux.
3603 You need Gperf on your system to compile this program from
3604 source. Under gNewSense 4.0, try @samp{sudo apt-get install gperf}.
3608 tar xf ${DOWNLOAD_DIR}/udev-175.tar.gz -C ${BUILD_DIR}
3609 cd ${BUILD_DIR}/udev-175
3611 --build=${CROSS_HOST} \
3612 --host=${CROSS_TARGET} \
3614 --with-rootlibdir=/lib \
3615 --libexecdir=/lib/udev \
3616 --docdir=/share/doc/udev-175 \
3617 --disable-introspection \
3618 --with-pci-ids-path=no \
3619 --with-usb-ids-path=no \
3622 make DESTDIR=${TARGET_DIR} install
3623 install -dv ${TARGET_DIR}/lib/firmware
3624 ln -sv ../lib/udev/udevd ${TARGET_DIR}/sbin/udevd
3634 util-linux is a random collection of utilities for use with the kernel
3638 If you have trouble building util-linux, try to uninstall the package
3639 named libtinfo-dev. Then remove @file{$@{BUILD_DIR@}/util-linux-2.24}
3645 # fix /lib/libudev.so: error adding symbols: File in wrong format
3646 rm ${TARGET_DIR}/lib/libudev.la
3648 tar xf ${DOWNLOAD_DIR}/util-linux-2.24.tar.bz2 -C ${BUILD_DIR}
3649 cd ${BUILD_DIR}/util-linux-2.24
3651 --build=${CROSS_HOST} \
3652 --host=${CROSS_TARGET} \
3656 --disable-makeinstall-chown
3658 make DESTDIR=${TARGET_DIR} install
3660 rm -r util-linux-2.24
3664 Option @option{--enable-partx} enables the build and installation of
3665 the @command{addpart}, @command{delpart} and @command{partx} commands.
3667 Option @option{--disable-wall} disables the build of the
3668 @command{wall} command which is already provided by sysvinit.
3670 Option @option{--enable-write} enables the build and installation of
3671 the @command{write} command.
3673 Option @option{--disable-makeinstall-chown} disables the change of
3674 owner to root for installed programs.
3680 XZ Utils is a general-purpose data compression software with high
3685 tar xf ${DOWNLOAD_DIR}/xz-5.0.8.tar.bz2 -C ${BUILD_DIR}
3686 cd ${BUILD_DIR}/xz-5.0.8
3688 --build=${CROSS_HOST} \
3689 --host=${CROSS_TARGET} \
3692 make DESTDIR=${TARGET_DIR} install
3700 @section Bootscripts
3702 The bootscript archive contains scripts that manage services during
3703 system's bootup and shutdown.
3707 tar xf ${DOWNLOAD_DIR}/bootscripts-cross-lfs-2.0.0.tar.xz \
3709 cd ${BUILD_DIR}/bootscripts-cross-lfs-2.0-pre2
3710 make DESTDIR=${TARGET_DIR} install-bootscripts
3711 make DESTDIR=${TARGET_DIR} install-network
3713 rm -rf bootscripts-cross-lfs-2.0-pre2
3717 This installs basic bootscripts required for bootup and shutdown, and
3718 network-related bootscripts.
3724 Linux is a kernel aimed towards POSIX and Single UNIX Specification
3727 You need Bc and Lzma on your system to compile this program from
3728 source. Under gNewSense 4.0, try @samp{sudo apt-get install bc lzma}.
3732 You may need to install the package libncurses5-dev to build the
3739 tar xf ${DOWNLOAD_DIR}/linux-libre-3.10.7-gnu.tar.xz \
3741 cd ${BUILD_DIR}/linux-3.10
3745 The @command{sed} expression is used to avoid waiting 60 seconds for
3746 the binary-blob firmware to load at boot time, as those have been
3747 removed by the @file{deblob} script.
3752 cp arch/x86/configs/i386_defconfig .config
3753 #patch -Np1 -i ${DOWNLOAD_DIR}/100gnu+freedo.patch
3756 Then, if you want to change the configuration:
3759 make ARCH=i386 CROSS_COMPILE=${CROSS_TARGET}- menuconfig
3763 In order for GLLFSC to boot properly, you have to activate the two options
3768 > Generic Driver Options
3769 > [*] Maintain a devtmpfs fs to mount on /dev
3770 > [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs.
3774 The second option is for runit
3776 You can also disable bootup logos in
3777 _D_evice drivers > _G_raphics support > _B_ootup logo.
3779 # _F_ile systems : stay with ext4 even with an ext3 partition
3788 CROSS_COMPILE=${CROSS_TARGET}-
3791 CROSS_COMPILE=${CROSS_TARGET}- \
3792 INSTALL_MOD_PATH=${TARGET_DIR} \
3794 cp arch/x86/boot/bzImage ${TARGET_DIR}/boot/vmlinuz-3.10.7-gnu
3795 cp System.map ${TARGET_DIR}/boot/System.map
3796 cp .config ${TARGET_DIR}/boot/config
3802 because future compilation may need kernel sources, the compilation
3803 directory of the kernel should be preserved.
3807 @node Configuration Files
3808 @chapter Creating Required Configuration Files for the New System
3811 * Time Setup File:: File for time setup.
3812 * Bash Keyboard Setup:: Setting up keyboard function keys
3814 * Bash Startup Files:: Setting up Bash shell startup files.
3815 * Localhost Setup:: Setting up localhost.
3816 * hosts Setup:: Setting up @file{hosts} file.
3817 * Network Address Setup:: Setting up network address.
3818 * DNS Setup:: Setting up DNS.
3819 * fstab File Creation:: Creating @file{fstab} file.
3823 @node Time Setup File
3824 @section File for Time Setup
3827 #mkdir ${TARGET_DIR}/etc/sysconfig
3828 cat > ${TARGET_DIR}/etc/sysconfig/clock << EOF
3829 # Begin /etc/sysconfig/clock
3833 # End /etc/sysconfig/clock
3837 If you have trouble with the clock behaviour, do:
3840 mv ${TARGET_DIR}/etc/rc.d/rcsysinit.d/S15setclock \
3841 ${TARGET_DIR}/etc/rc.d/rcsysinit.d/K15setclock
3845 @node Bash Keyboard Setup
3846 @section Setting up Keyboard Function keys for the Shell
3848 Readline default configuration file is set:
3851 cat > ${TARGET_DIR}/etc/inputrc << EOF
3853 set convert-meta Off
3854 set horizontal-scroll-mode Off
3857 "\eOd": backward-word
3858 "\eOc": forward-word
3859 "\e[1~": beginning-of-line
3860 "\e[4~": end-of-line
3861 "\e[5~": beginning-of-history
3862 "\e[6~": end-of-history
3863 "\e[3~": delete-char
3864 "\e[2~": quoted-insert
3865 "\eOH": beginning-of-line
3867 "\e[H": beginning-of-line
3872 If @option{convert-meta} is set to @samp{on}, Readline will convert
3873 characters with the eighth bit set to an @sc{ascii} key sequence by
3874 stripping the eighth bit and prefixing an @key{ESC} character,
3875 converting them to a meta-prefixed key sequence.
3877 @option{horizontal-scroll-mode} set to @samp{off} means that the text
3878 of the lines being edited will be wrapped onto a new screen line when
3879 they are longer than the width of the screen, instead of being
3880 scrolled horizontally on a single screen line.
3884 @option{input-meta} If set to @samp{on}, Readline will enable
3885 eight-bit input (it will not clear the eighth bit in the characters it
3886 reads), regardless of what the terminal claims it can support.
3888 If @option{output-meta} is set to @samp{on}, Readline will display
3889 characters with the eighth bit set directly rather than as a
3890 meta-prefixed escape sequence.
3893 "\eOd": backward-word
3894 "\eOc": forward-word
3895 "\e[1~": beginning-of-line
3896 "\e[4~": end-of-line
3897 "\e[5~": beginning-of-history
3898 "\e[6~": end-of-history
3899 "\e[3~": delete-char
3900 "\e[2~": quoted-insert
3901 "\eOH": beginning-of-line
3903 "\e[H": beginning-of-line
3908 @node Bash Startup Files
3909 @section Setting up Bash Shell Startup Files
3912 cat > ${TARGET_DIR}/etc/profile << 'EOF'
3913 # Begin /etc/profile
3915 export LANG=en_US.UTF-8
3916 export INPUTRC=/etc/inputrc
3917 export PS1='\[\e[31m\]\A-\W\[\e[00m\]# '
3923 The environment variable @env{LANG} defines the default language that
3924 should be used on the system. @samp{en_US.UTF-8} means ``english''
3925 language, country ``US'' and @acronym{UTF-8} (UCS Transformation
3926 Format—8-bit) encoding (Unicode).
3928 @c For a full list, see???
3930 For explanations on @env{PS1}, @pxref{Environment Variables Setup}.
3933 @node Localhost Setup
3934 @section Localhost Setup
3937 echo "HOSTNAME=gllfsc" > ${TARGET_DIR}/etc/sysconfig/network
3942 @section Setting up @file{hosts} File
3945 cat > ${TARGET_DIR}/etc/hosts << EOF
3948 127.0.0.1 gllfsc localhost
3955 @node Network Address Setup
3956 @section Setting up Network Address
3958 You can choose to have a network static or dynamic address.
3961 * Network Static Address Setup:: Setting up Network Static Address.
3962 * Network Dynamic Address Setup:: Setting up Network Dynamic
3967 @node Network Static Address Setup
3968 @subsection Setting up Network Static Address
3971 cd ${TARGET_DIR}/etc/sysconfig/network-devices
3972 mkdir -v ifconfig.eth0
3973 cat > ifconfig.eth0/ipv4 << EOF
3979 BROADCAST=192.168.1.255
3985 @code{IP}, @code{GATEWAY}, @code{BROADCAST} addresses are set up
3986 according to one's situation.
3990 @node Network Dynamic Address Setup
3991 @subsection Setting up Network Dynamic Address
3994 cd ${TARGET_DIR}/etc/sysconfig/network-devices
3995 mkdir -v ifconfig.eth0
3996 cat > ifconfig.eth0/dhcpcd << EOF
4007 @section Setting up DNS
4010 cat > ${TARGET_DIR}/etc/resolv.conf << EOF
4011 # Begin /etc/resolv.conf
4013 nameserver your-main-DNS-address
4014 nameserver your-secondary-DNS-address
4016 # End /etc/resolv.conf
4021 @node fstab File Creation
4022 @section @file{fstab} File Creation
4024 The file @file{/etc/fstab} is used at boot to mount partitions under
4025 the requested directories.
4028 cat > ${TARGET_DIR}/etc/fstab << EOF
4031 # file system mount-point type options dump fsck order
4033 /dev/sda1 / ext3 defaults 0 0
4034 #/dev/sda7 /home ext3 defaults 0 0
4035 /dev/sda5 swap swap pri=1 0 0
4036 devtmpfs /dev dev defaults 0 0
4037 proc /proc proc defaults 0 0
4038 tmpfs /run run defaults 0 0
4039 sysfs /sys sysfs defaults 0 0
4040 devpts /dev/pts devpts gid=4,mode=620 0 0
4041 shm /dev/shm tmpfs defaults 0 0
4048 the name of the hard drive and the name of filesystem used here have
4049 to be modified to reflect @emph{your} real situation.
4053 @node Before Booting GLLFSC
4054 @chapter Before Booting GLLFSC
4057 * Archiving:: All the system archived in one
4059 * Recommendations:: Some tips.
4064 @section Archiving the System
4066 After the system has been completed, we use the command @command{exit}
4067 to logout as the @emph{gllfsc} user.
4069 Now, login as the @emph{root} user.
4071 Then fix the permissions on the new system:
4074 export TARGET_DIR=/gllfsc
4076 mknod -m 600 dev/console c 5 1
4077 mknod -m 666 dev/null c 1 3
4078 cp -a dev/{console,null} lib/udev/devices/
4079 #chown -R root:root *
4080 chown -R root:root \
4081 bin boot dev etc home include lib* local man mnt proc root run \
4082 sbin share src static sys tmp usr var
4085 Also copy packages to be built after reboot:
4088 export DOWNLOAD_DIR="${TARGET_DIR}/download"
4090 tzcode2013h.tar.gz \
4091 tzdata2013h.tar.gz \
4092 runit-2.1.2.tar.gz \
4093 openssl-1.0.1i.tar.gz \
4094 wpa_supplicant-2.0.tar.gz \
4095 wireless_tools.29.tar.gz \
4097 perl-5.18.1.tar.gz \
4098 libtasn1-3.4.tar.gz \
4099 lynx2.8.8dev.16.tar.bz2 \
4101 inetutils-1.9.1.tar.gz \
4102 man-db-2.6.7.1.tar.xz; do
4103 cp -v ${DOWNLOAD_DIR}/$FILE ${TARGET_DIR}/src
4107 We archive the entire system by using the following command:
4111 tar -cjf gllfsc-pentium4-1.7.tar.bz2 \
4112 bin boot dev etc home include lib* local man mnt proc root run \
4113 sbin share src static sys tmp usr var
4116 It is then simple to copy the archive to the target machine and extract
4120 @node Recommendations
4121 @section Some Recommendations
4123 We recommend extracting the system to an empty partition. Moreover,
4124 the filesystem of the chosen partition has to be a filesystem
4125 supported by the kernel you compiled. Finally, this partition has to
4126 be consistent with the system description in the file
4127 @file{/etc/fstab} you created during setup (@pxref{fstab File
4137 tar xf ${DOWNLOAD_DIR}/grub-2.00.tar.gz \
4139 cd ${BUILD_DIR}/grub-2.00
4140 sed -i '/gets is a security hole/d' grub-core/gnulib/stdio.in.h
4142 --build=${CROSS_HOST} \
4143 --host=${CROSS_TARGET} \
4146 make DESTDIR=${TARGET_DIR} install
4151 mkdir ${TARGET_DIR}/boot/grub
4155 Then, you will have to edit the GRUB configuration file of the target
4156 machine: @file{/boot/grub/grub.cfg}.
4158 @c ?This file has to be put on the first partition of the hard drive.
4160 @c GRUB sur /dev/sda1 >= 1MB
4161 @c mount ... /mnt/boot && grub-install --boot-directory=/mnt/boot /dev/sda
4162 @c grub-script-check
4166 ?On the Yeeloong 8133, vmlinuz @emph{must} be on the first primary
4167 partition to be able to boot.
4170 # Install in the MBR
4171 #grub-install /dev/sda
4172 # Install in the OS partition
4173 grub-install /dev/sda1
4176 A minimal @file{/boot/grub/grub.cfg} could be:
4184 menuentry 'GLLFSC 1.7' {
4185 echo 'Loading linux-libre-3.10.7-gnu...'
4186 linux (hd0,1)/boot/vmlinuz-3.10.7-gnu root=/dev/sda1 quiet
4190 @c Or use grub-mkconfig -o /boot/grub/grub.cfg
4193 @node After Booting GLLFSC
4194 @chapter After Booting GLLFSC
4196 Some system configuration and package installation can only be made
4197 after booting onto the new system.
4200 * Login:: Login onto GLLFSC.
4201 * Locales:: Configure the language of GLLFSC.
4202 * Timezone:: Building Tzcode, Tzdata and choosing timezone.
4203 * Runit:: Building Runit.
4204 * Perl:: Building Perl.
4205 * OpenSSL:: Building OpenSSL.
4206 * Wpa_supplicant:: Building Wpa_supplicant.
4207 * Wireless_tools:: Building Wireless_tools.
4208 * Wget:: Building Wget.
4209 * Libtasn1:: Building Libtasn1.
4210 * Lynx:: Building Lynx.
4211 * CA-Certificates:: Building CA-Certificates.
4212 * Inetutils 2:: Building Inetutils under GLLFSC.
4213 * Man-db 2:: Building Man-db under GLLFSC.
4214 * Archiving Complete System:: Archiving the Complete System.
4215 * Add User:: Creating a New User Account.
4216 * Halting Computer:: Halting the Computer
4223 To login as @emph{root}, just type @samp{root} when the system asks
4224 for your @samp{login:}. Then, update your bash profile:
4227 To use the french keyboard layout, type @samp{loadkeys -q fr}.
4231 cat > ~/.bash_profile << EOF
4232 export BUILD_DIR=/tmp
4233 export DOWNLOAD_DIR=/src
4236 source ~/.bash_profile
4243 You may want to have your new system display messages in your native
4244 language. If you desire to have a system supporting german, US
4245 english, french and China mainland's chinese:
4250 #localedef -i de_DE -f UTF-8 de_DE
4251 localedef -i en_US -f UTF-8 en_US
4252 #localedef -i fr_FR -f UTF-8 fr_FR
4253 #localedef -i zh_CN -f UTF-8 zh_CN
4256 Other locales are available:
4260 For available charmaps, see the content of @file{/share/i18n/charmaps}.
4263 For available locales, see the content of @file{/share/i18n/locales}.
4271 In order to have the time and date corresponding to the area where you
4272 live, you should build tzcode, tzdata and define your timezone.
4275 mkdir ${BUILD_DIR}/tz
4276 tar xf ${DOWNLOAD_DIR}/tzcode2013h.tar.gz -C ${BUILD_DIR}/tz
4277 tar xf ${DOWNLOAD_DIR}/tzdata2013h.tar.gz -C ${BUILD_DIR}/tz
4282 TZDIR=/share/zoneinfo \
4285 for TZ in africa antarctica asia australasia europe northamerica \
4286 southamerica pacificnew etcetera backward systemv factory \
4287 solar87 solar88 solar89; do
4288 zic -y "sh yearistype.sh" \
4289 -d /share/zoneinfo \
4293 zic -y "bash yearistype.sh" \
4294 -d /share/zoneinfo \
4298 cp iso3166.tab zone.tab /share/zoneinfo
4304 Then, we define our timezone, in this case @file{Europe/Paris}:
4307 cp -v --remove-destination \
4308 /share/zoneinfo/Europe/Paris \
4316 runit is a cross-platform Unix init scheme with service supervision, a
4317 replacement for sysvinit, and other init schemes.
4321 tar xf ${DOWNLOAD_DIR}/runit-2.1.2.tar.gz -C ${BUILD_DIR}
4322 cd ${BUILD_DIR}/admin/runit-2.1.2
4324 # On GLLFSC, sleep is not under /bin:
4325 sed -i 's,/bin/sleep,sleep,' etc/debian/ctrlaltdel
4333 chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset \
4336 install -m0644 ../man/* \
4345 cp etc/debian/ctrlaltdel /etc/runit/
4347 mv /sbin/init /sbin/init.sysv
4348 ln -sv runit-init /sbin/init
4355 The init-related programs have been installed. We need to create the
4356 boot scripts too: @file{/etc/runit/1} to boot the system,
4357 @file{/etc/runit/2} to launch 2 ttys and the service logging daemon
4358 and @file{/etc/runit/3} to halt or reboot the system.
4361 cat > /etc/runit/1 << 'EOF'
4363 # system one time tasks
4370 echo -n '16. Mounting kernel-based file systems:'
4372 mount -n -o nosuid,noexec,nodev -t proc proc /proc
4374 mount -n -o nosuid,noexec,nodev -t sysfs sys /sys
4376 mount -n -o mode=0755,nosuid,nodev -t tmpfs run /run
4378 echo -n '15. Creating directories:'
4379 echo -n ' /run/lock'
4380 mkdir -m 1777 /run/lock
4386 echo '14. Mounting root file system in read-write mode.'
4387 mount -n -o remount,rw / >/dev/null
4389 # Remove fsck-related system watermarks.
4390 rm -f /fastboot /forcefsck
4392 echo '13. Recording existing mounts in /etc/mtab.'
4400 echo '12. Mounting remaining file systems.'
4401 mount -a -r >/dev/null
4403 echo '11. Cleaning file system /tmp.'
4404 cd /tmp && find . -xdev -mindepth 1 ! -name lost+found -delete
4406 echo '10. Creating /var/run/utmp.'
4407 if grep -q '^utmp:' /etc/group; then
4408 chmod 664 /var/run/utmp
4409 chgrp utmp /var/run/utmp
4412 echo '9. Starting udevd...'
4413 echo '' > /sys/kernel/uevent_helper
4415 /lib/udev/udevd --daemon
4417 echo '8. Performing Coldplugging...'
4418 /sbin/udevadm trigger --action=add --type=subsystems
4419 /sbin/udevadm trigger --action=add --type=devices
4421 /sbin/udevadm settle
4423 echo '7. Activating all swap files/partitions...'
4426 echo '6. Setting Font...'
4427 setfont LatArCyrHeb-16 -C /dev/tty2
4428 setfont LatArCyrHeb-16 -C /dev/tty3
4430 echo '5. Setting keymap to UTF-8...'
4431 dumpkeys | loadkeys --unicode
4433 echo '4. Enabling Multibyte input...'
4436 echo '3. Setting up US Keymap...'
4439 echo '2. Setting encoding to UTF-8...'
4440 echo -ne $'\033%G' > /dev/tty2
4441 echo -ne $'\033%G' > /dev/tty3
4443 echo '1. Bringing up the loopback interface...'
4444 ip addr add 127.0.0.1/8 label lo dev lo
4447 echo '0. Setting hostname to gllfsc...'
4451 echo To login, remember:
4452 echo your login is root
4453 echo with no password
4455 echo You can now login through tty2 by pressing simultaneously
4456 echo Ctrl, Alt and F2 keys
4458 echo You can then come back to this screen \(tty1\) by pressing
4459 echo simultaneously Ctrl, Alt and F1 keys
4461 echo Edit /etc/runit/1 if you want to remove this message
4464 touch /etc/runit/stopit
4465 chmod 0 /etc/runit/stopit
4470 chmod +x /etc/runit/1
4474 cat > /etc/runit/2 << EOF
4479 exec env -i PATH=/bin \
4480 runsvdir -P /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'
4483 chmod +x /etc/runit/2
4487 cat > /etc/runit/3 << EOF
4497 echo '4. Waiting for services to stop...'
4500 echo '3. Exiting services...'
4503 echo '2. Deactivating all swap files/partitions...'
4506 # Unmount everything but /:
4507 echo -n '1. Unmounting filesystems: /home'
4518 echo '0. Shutdown...'
4523 chmod +x /etc/runit/3
4526 We now create useful services:
4530 mkdir /etc/sv/getty-2
4532 cat > /etc/sv/getty-2/run << EOF
4534 exec /sbin/agetty tty2 9600
4536 chmod +x /etc/sv/getty-2/run
4538 cat > /etc/sv/getty-2/finish << EOF
4540 exec utmpset -w tty2
4542 chmod +x /etc/sv/getty-2/finish
4544 ln -sv /etc/sv/getty-2 /service/getty-2
4547 mkdir -p /etc/sv/getty-3
4549 cat > /etc/sv/getty-3/run << EOF
4551 exec /sbin/agetty tty3 9600
4553 chmod +x /etc/sv/getty-3/run
4555 cat > /etc/sv/getty-3/finish << EOF
4557 exec utmpset -w tty3
4559 chmod +x /etc/sv/getty-3/finish
4561 ln -sv /etc/sv/getty-3 /service/getty-3
4564 mkdir /etc/sv/svlogd
4566 cat > /etc/sv/svlogd/run << EOF
4570 chmod +x /etc/sv/svlogd/run
4572 ln -sv /etc/sv/svlogd /service/svlogd
4579 Perl is a high-level programming language.
4582 You may have to type @samp{exit} twice during the configure phase of
4583 the Perl installation.
4587 tar xf ${DOWNLOAD_DIR}/perl-5.18.1.tar.gz -C ${BUILD_DIR}
4588 cd ${BUILD_DIR}/perl-5.18.1
4589 sh Configure -ds -e -Dprefix=
4601 OpenSSL is a toolkit implementing the Transport Layer Security (TLS)
4602 and Secure Sockets Layer (SSL) protocols as well as a cryptography
4606 tar xf ${DOWNLOAD_DIR}/openssl-1.0.1i.tar.gz -C ${BUILD_DIR}
4607 cd ${BUILD_DIR}/openssl-1.0.1i
4610 --openssldir=/etc/ssl \
4613 # Install without the documentation:
4616 rm -rf openssl-1.0.1i
4621 @node Wpa_supplicant
4622 @section Wpa_supplicant
4624 Wpa_supplicant is a user space IEEE 802.1X/WPA supplicant (wireless
4625 client) for many wireless drivers.
4629 tar xf ${DOWNLOAD_DIR}/wpa_supplicant-2.0.tar.gz -C ${BUILD_DIR}
4630 cd ${BUILD_DIR}/wpa_supplicant-2.0/wpa_supplicant
4632 cat > .config << EOF
4633 CONFIG_DRIVER_HOSTAP=y
4634 CONFIG_DRIVER_WEXT=y
4635 #CONFIG_DRIVER_NL80211=y
4636 #CONFIG_DRIVER_WIRED=y
4645 #CONFIG_IEEE80211W=y
4649 #CONFIG_IEEE80211N=y
4652 sed -i.orig 's@local/@@g' Makefile
4656 rm -rf wpa_supplicant-2.0
4659 cat > /etc/wpa_supplicant.conf << EOF
4668 chmod 600 /etc/wpa_supplicant.conf
4672 @node Wireless_tools
4673 @section Wireless_tools
4675 The Wireless Tools is a set of tools allowing to manipulate the
4676 Wireless Extensions.
4680 tar xf ${DOWNLOAD_DIR}/wireless_tools.29.tar.gz -C ${BUILD_DIR}
4681 cd ${BUILD_DIR}/wireless_tools.29
4683 make PREFIX= install
4685 rm -rf wireless_tools.29
4691 Launch wireless connection:
4694 iwconfig wlan0 essid MYESSID
4703 GNU wget is an utility for downloading network data.
4707 tar xf ${DOWNLOAD_DIR}/wget-1.14.tar.gz -C ${BUILD_DIR}
4708 cd ${BUILD_DIR}/wget-1.14
4709 sed -i.orig 's/item $thing/item C<$thing>/' doc/texi2pod.pl
4724 GNU libtasn1 is a ASN.1 library.
4727 tar xf ${DOWNLOAD_DIR}/libtasn1-3.4.tar.gz -C ${BUILD_DIR}
4728 cd ${BUILD_DIR}/libtasn1-3.4
4742 Lynx is a text web browser.
4745 tar xf ${DOWNLOAD_DIR}/lynx2.8.8dev.16.tar.bz2 -C ${BUILD_DIR}
4746 cd ${BUILD_DIR}/lynx2-8-8
4751 --with-screen=ncursesw
4757 # Stop asking questions about certificates:
4758 sed -i s/#FORCE_SSL_PROMPT:PROMPT/FORCE_SSL_PROMPT:yes/ \
4761 # Display non-ascii characters:
4762 sed -i s/#CHARACTER_SET:iso-8859-1/CHARACTER_SET:utf-8/ \
4765 # I don't want cookies:
4766 sed -i 's/#SET_COOKIES:TRUE/SET_COOKIES:FALSE/' \
4768 sed -i 's/#ACCEPT_ALL_COOKIES:FALSE/ACCEPT_ALL_COOKIES:FALSE/' \
4770 sed -i 's/#PERSISTENT_COOKIES:FALSE/PERSISTENT_COOKIES:FALSE/' \
4776 @node CA-Certificates
4777 @section CA-Certificates
4779 CA-Certificates are used for https web pages.
4783 # http://linuxfromscratch.org/blfs/view/stable/postlfs/cacerts.html
4785 cp ${DOWNLOAD_DIR}/certdata.txt ${BUILD_DIR}
4788 cat > /bin/make-cert.pl << 'EOF'
4791 # Used to generate PEM encoded files from Mozilla certdata.txt.
4792 # Run as ./make-cert.pl > certificate.crt
4794 # Parts of this script courtesy of RedHat (mkcabundle.pl)
4796 # This script modified for use with single file data (tempfile.cer)
4797 # extracted from certdata.txt, taken from the latest version in the
4798 # Mozilla NSS source.
4799 # mozilla/security/nss/lib/ckfw/builtins/certdata.txt
4806 my $certdata = './tempfile.cer';
4808 open( IN, "cat $certdata|" )
4809 || die "could not open $certdata";
4815 if ( /^CKA_VALUE MULTILINE_OCTAL/ )
4818 open( OUT, "|openssl x509 -text -inform DER -fingerprint" )
4819 || die "could not pipe to openssl x509";
4822 elsif ( /^END/ && $incert )
4831 my @bs = split( /\\/ );
4835 printf( OUT "%c", oct($b) ) unless $b eq '';
4841 chmod +x /bin/make-cert.pl
4845 cat > /bin/make-ca.sh << 'EOF'
4848 # Script to populate OpenSSL's CApath from a bundle of PEM formatted
4851 # The file certdata.txt must exist in the local directory
4852 # Version number is obtained from the version of the data.
4859 certdata="certdata.txt"
4861 if [ ! -r $certdata ]; then
4862 echo "$certdata must be in the local directory"
4866 REVISION=$(grep CVS_ID $certdata | cut -f4 -d'$')
4868 if [ -z "${REVISION}" ]; then
4869 echo "$certfile has no 'Revision' in CVS_ID"
4873 VERSION=$(echo $REVISION | cut -f2 -d" ")
4875 TEMPDIR=$(mktemp -d)
4876 TRUSTATTRIBUTES="CKA_TRUST_SERVER_AUTH"
4877 BUNDLE="BLFS-ca-bundle-${VERSION}.crt"
4878 CONVERTSCRIPT="/bin/make-cert.pl"
4881 mkdir "${TEMPDIR}/certs"
4883 # Get a list of starting lines for each cert
4884 CERTBEGINLIST=$(grep -n "^# Certificate" "${certdata}" | cut -d ":" -f1)
4886 # Get a list of ending lines for each cert
4887 CERTENDLIST=$(grep -n "^CKA_TRUST_STEP_UP_APPROVED" "${certdata}" \
4891 for certbegin in ${CERTBEGINLIST}; do
4892 for certend in ${CERTENDLIST}; do
4893 if test "${certend}" -gt "${certbegin}"; then
4898 # Dump to a temp file with the name of the file as the beginning
4900 sed -n "${certbegin},${certend}p" "${certdata}" \
4901 > "${TEMPDIR}/certs/${certbegin}.tmp"
4904 unset CERTBEGINLIST CERTDATA CERTENDLIST certbegin certend
4907 rm -f certs/* # Make sure the directory is clean
4909 for tempfile in ${TEMPDIR}/certs/*.tmp; do
4910 # Make sure that the cert is trusted...
4911 grep "CKA_TRUST_SERVER_AUTH" "${tempfile}" | \
4912 egrep "TRUST_UNKNOWN|NOT_TRUSTED" > /dev/null
4914 if test "${?}" = "0"; then
4915 # Throw a meaningful error and remove the file
4916 cp "${tempfile}" tempfile.cer
4917 perl ${CONVERTSCRIPT} > tempfile.crt
4918 keyhash=$(openssl x509 -noout -in tempfile.crt -hash)
4919 echo "Certificate ${keyhash} is not trusted! Removing..."
4920 rm -f tempfile.cer tempfile.crt "${tempfile}"
4924 # If execution made it to here in the loop, the temp cert is trusted
4925 # Find the cert data and generate a cert file for it
4927 cp "${tempfile}" tempfile.cer
4928 perl ${CONVERTSCRIPT} > tempfile.crt
4929 keyhash=$(openssl x509 -noout -in tempfile.crt -hash)
4930 mv tempfile.crt "certs/${keyhash}.pem"
4931 rm -f tempfile.cer "${tempfile}"
4932 echo "Created ${keyhash}.pem"
4935 # Remove blacklisted files
4936 # MD5 Collision Proof of Concept CA
4937 if test -f certs/8f111d69.pem; then
4938 echo "Certificate 8f111d69 is not trusted! Removing..."
4939 rm -f certs/8f111d69.pem
4942 # Finally, generate the bundle and clean up.
4943 cat certs/*.pem > ${BUNDLE}
4947 chmod +x /bin/make-ca.sh
4951 cat > /bin/remove-expired-certs.sh << 'EOF'
4953 # Begin /bin/remove-expired-certs.sh
4957 # Make sure the date is parsed correctly on all systems
4960 local y=$( echo $1 | cut -d" " -f4 )
4961 local M=$( echo $1 | cut -d" " -f1 )
4962 local d=$( echo $1 | cut -d" " -f2 )
4965 if [ ${d} -lt 10 ]; then d="0${d}"; fi
4982 certdate="${y}${m}${d}"
4985 OPENSSL=/bin/openssl
4988 if [ $# -gt 0 ]; then
4992 certs=$( find ${DIR} -type f -name "*.pem" -o -name "*.crt" )
4993 today=$( date +%Y%m%d )
4995 for cert in $certs; do
4996 notafter=$( $OPENSSL x509 -enddate -in "${cert}" -noout )
4997 date=$( echo ${notafter} | sed 's/^notAfter=//' )
5000 if [ ${certdate} -lt ${today} ]; then
5001 echo "${cert} expired on ${certdate}! Removing..."
5007 chmod +x /bin/remove-expired-certs.sh
5011 remove-expired-certs.sh certs
5014 install -d /etc/ssl/certs
5015 cp -v certs/*.pem /etc/ssl/certs
5017 install BLFS-ca-bundle*.crt /etc/ssl/ca-bundle.crt
5018 ln -sfv ../ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
5020 rm BLFS-ca-bundle*.crt
5029 @section Inetutils 2
5031 Installed @samp{ifconfig} may hang. Reinstalling under GLLFSC to fix this:
5034 tar xf ${DOWNLOAD_DIR}/inetutils-1.9.1.tar.gz -C ${BUILD_DIR}
5035 cd ${BUILD_DIR}/inetutils-1.9.1
5036 sed -i '/gets is a security hole/d' lib/stdio.in.h
5037 #sed -i -e '/PATH_PROCNET_DEV/s/\ no//' paths
5041 make DESTDIR= install
5043 rm -rf inetutils-1.9.1
5051 Installed @samp{man} is buggy. Reinstalling under GLLFSC to fix this:
5054 tar xf ${DOWNLOAD_DIR}/man-db-2.6.7.1.tar.xz -C ${BUILD_DIR}
5055 cd ${BUILD_DIR}/man-db-2.6.7.1
5056 libpipeline_CFLAGS="-I/include" \
5057 libpipeline_LIBS="-L/lib -lpipeline" \
5061 make DESTDIR= install
5063 rm -rf man-db-2.6.7.1
5068 @node Archiving Complete System
5069 @section Archiving the Complete System
5077 mv /share/man/man* /share
5079 mv /share/man[1-8] /share/man
5082 # 109 MB before, 36 MB after
5083 strip --strip-all /bin/*
5085 # To be done outside GLLFSC:
5086 tar -cjf gllfsc-pentium4-1.7-completed.tar.bz2 \
5087 bin boot dev etc home include lib* local man mnt proc root run \
5088 sbin service share src sys tmp usr var
5095 To create a new user, without root rights:
5101 This will create a new user named @samp{USER}, with group
5102 @samp{USER} and user's home at @file{/home/USER}.
5104 To give a password to this user:
5110 You may want to change the color of this user's prompt:
5113 cat > /home/USER/.bash_profile << EOF
5114 export PS1='\[\e[32m\]\A-\W\[\e[00m\]$ '
5116 chown USER:USER /home/USER/.bash_profile
5120 @node Halting Computer
5121 @section Halting the Computer
5123 In order to halt the computer after this build process, type:
5129 If you prefer to reboot instead type:
5135 The next time you use GLLFSC, runit will be the default init system
5136 and you will have to type @samp{init 0} to halt the operating system
5137 and @samp{init 6} to reboot.
5140 @node Further Readings
5141 @chapter Further Readings
5143 On my personal website at
5144 @uref{http://cjarry.org/gnu-linux/gllfsc@//gllfsc.en.html},
5145 there is some information on how to extend GLLFSC, for instance
5146 instructions on how to build Xorg and programs on top of it.
5148 Haiyong Sun's website (in Chinese):
5149 @uref{http://blog.chinaunix.net/uid/436750.html}. It includes documents on building a
5150 GNU/Linux system for Loongson and a GNU/Hurd system for x86.
5152 Cross [GNU/]Linux from scratch: @uref{http://www.clfs.org} (PDF
5153 files may be downloaded from @uref{http://clfs.org/files/BOOK/}).
5154 Includes a lot of documentation to build a GNU/Linux system by
5155 cross-compilation on a variety of hardware, no information (yet) for
5156 cross-compiling with sysroot on MIPS though. There is also a
5157 Community-driven Beyond [GNU/]Linux From Scratch on
5158 @uref{http://cblfs.clfs.org/index.php/Main_Page}. It documents
5159 the building of Xorg and TeXLive among other things.
5161 @c Some patches from the above project are available for download on
5162 @c @uref{http://svn.clfs.org/svn/repos/patches/}.
5164 @uref{http://www.linuxfromscratch.org/hints/downloads/files/more_control_and_pkg_@/man.txt}
5165 documents an interesting way of managing packages. Quotation from the
5173 You want to know which packages your files belong to?
5176 You want to deinstall software that doesn't have make uninstall?
5179 You are bothered by programs installed setuid root behind your back?
5182 You don't like packages quietly overwriting files from other packages?
5185 You don't like package managers like RPM?
5188 YOU WANT TOTAL CONTROL USING ONLY UNIX BUILTINS?
5192 The suckless team@footnote{@uref{http://suckless.org}} is a group of
5193 programmers that share the following
5194 philosophy@footnote{@uref{http://suckless.org/philosophy}}:
5197 Focus on simplicity, clarity and frugality. Our philosophy is about
5198 keeping things simple, minimal and usable. We believe this should
5199 become the mainstream philosophy in the IT sector. Unfortunately, the
5200 tendency for complex, error-prone and slow software seems to be
5201 prevalent in the present-day software industry. We intend to prove the
5202 opposite with our software projects.
5205 The simple and lightweight programs released by this team are
5206 interesting for everyone who like small, reactive and reliable
5214 I thank Lemote and particularily the CEO, Fuxin Zhang, for offering me
5215 a Yeeloong 8133, Huacai Chen and Haiyong Sun for their help in fixing
5216 the bugs I found in the deblobbed kernel.
5218 I am particularily grateful to Haiyong Sun for having shared his
5219 knowledge on building a free operating system for Loongson 2F
5220 machines, this document is heavily based on this.
5224 @node GNU Free Documentation License
5225 @appendix GNU Free Documentation License
5226 @include fdl-1.3.texi
5229 @node GNU General Public License
5230 @appendix GNU General Public License