You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
4.9 KiB
132 lines
4.9 KiB
4 years ago
|
Current LFS version: 10.0
|
||
|
|
||
|
Substantial changes were introduced in LFS 10.0, so these notes will probably
|
||
|
not apply to anything below this version. This version should be easier to
|
||
|
bootstrap like this, anyway.
|
||
|
|
||
|
Ignore the Host System Requirements, a lot of these either don't apply or will
|
||
|
be procured as we go through this guide.
|
||
|
Ignore, as well, the creation of a new partition or user, as the necessary
|
||
|
tools to achieve this aren't available in the bootstrap toolset. We will be
|
||
|
building everything on whatever partition the bootstrap toolset was installed.
|
||
|
|
||
|
Install the sources under /sources right next to the /bootstrap directory.
|
||
|
This can't be done when inside the bootstrap system as no networking utilities
|
||
|
are yet installed. For the "xz" package, download a .tar.gz or .tar.bz2
|
||
|
package, as the xz utilities aren't included with the bootstrap utilities.
|
||
|
|
||
|
To enter the bootstrap system as a chroot, use the following commands to set
|
||
|
up the filesystems and entering:
|
||
|
mkdir -p sys proc dev tmp
|
||
|
mount -o ro -t devtmpfs devtmpfs dev
|
||
|
mount -o ro -t devpts devpts dev/pts
|
||
|
mount -o ro -t sysfs sysfs sys
|
||
|
mount -o ro -t proc proc proc
|
||
|
./bootstrap/bin/chroot . /bootstrap/bin/env -i PATH=/bootstrap/bin HOME=/root /bin/sh -l
|
||
|
|
||
|
Set the LFS variable to either / or keep it blank, as the bootstrap tools are
|
||
|
self-contained in /bootstrap, and can be removed afterwards, keeping a clean
|
||
|
system anyway.
|
||
|
|
||
|
The bootstrap tools are all x86, if you're going to be cross-compiling for
|
||
|
x86_64, make sure the command `uname -m` returns `x86_64`, or manually
|
||
|
substitute it throughout the LFS commands you execute.
|
||
|
|
||
|
In chapter 4.4 Setting Up the Environment, make sure LFS is set according to
|
||
|
what's been explained, and PATH=$LFS/tools/bin:/bootstrap/bin. We don't want
|
||
|
to use /usr/bin and /bin until chapter 7. Also define LFS_TGT after setting PATH.
|
||
|
Also `mkdir /root` before creating the files. If you don't want the "I have no
|
||
|
name!" prompt, you shouldn't use '\u' in the PS1 variable.
|
||
|
A finished bashrc/bash_profile looks like:
|
||
|
mkdir -p /root
|
||
|
cat > ~/.bash_profile << "EOF"
|
||
|
exec env -i HOME=$HOME TERM=$TERM PS1='\w\$ ' /bin/bash
|
||
|
EOF
|
||
|
cat > ~/.bashrc << "EOF"
|
||
|
set +h
|
||
|
umask 022
|
||
|
LFS=
|
||
|
LC_ALL=POSIX
|
||
|
PATH=$LFS/tools/bin:/bootstrap/bin
|
||
|
LFS_TGT=$(uname -m)-lfs-linux-gnu
|
||
|
export LFS LC_ALL LFS_TGT PATH
|
||
|
EOF
|
||
|
source ~/.bash_profile
|
||
|
|
||
|
Once you get to chapter 5, you will need to add a couple of tools to the
|
||
|
/bootstrap toolset, by building them from the sources you've downloaded for LFS.
|
||
|
|
||
|
You'll need to build the following packages:
|
||
|
- xz-5.2.5 (required to unpack .tar.xz archives)
|
||
|
- sed-4.8 (required by linux-headers for -E option)
|
||
|
- m4-1.4.18 (required by bison)
|
||
|
- bison-3.7.1 (required by glibc)
|
||
|
- grep-3.4 (required by glibc for -o option)
|
||
|
- make-4.3 (required by glibc)
|
||
|
- Python-3.8.5 (required by glibc)
|
||
|
|
||
|
Install them by unpacking them (see "General Compilation Instructions" chapter),
|
||
|
and running:
|
||
|
./configure --prefix=/bootstrap --build=i686-pc-linux-gnu
|
||
|
make
|
||
|
make install
|
||
|
|
||
|
Python with:
|
||
|
./configure --prefix=/bootstrap --build=i686-pc-linux-gnu --without-ensurepip
|
||
|
|
||
|
Now, you can run chapter 5 and 6, with the following exceptions:
|
||
|
|
||
|
5.3. GCC-10.2.0 - Pass 1:
|
||
|
Add --with-stage1-libs='-lstdc++ -lsupc++' CC='gcc -std=c11'
|
||
|
to the ../configure command.
|
||
|
|
||
|
6.3. Ncurses-6.2:
|
||
|
Use --disable-stripping during "main" ./configure
|
||
|
|
||
|
6.4. Bash-5.0:
|
||
|
Do not move bash to /bin or replace the /bin/sh symlink. We'll do this
|
||
|
later.
|
||
|
|
||
|
Once you reach chapter 7, run the finishing bash install commands we skipped earlier:
|
||
|
mv $LFS/usr/bin/bash $LFS/bin/bash
|
||
|
ln -sfv bash $LFS/bin/sh
|
||
|
|
||
|
Now, if you're cross-building for x86_64, this is the point where you should
|
||
|
make sure you're either already running a compatible kernel, or you reboot
|
||
|
into one. You might be able to build one with the tools in /bootstrap and
|
||
|
/tools, but this guide won't cover this. Booting into this system instead of
|
||
|
chrooting will also require extra steps, not covered here.
|
||
|
|
||
|
You may skip chapters 7.1 and 7.2, since we've built everything as root, and
|
||
|
7.3 may be skipped as well as we've already set up the chroot. However, you
|
||
|
should set up the PATH variable as described in chapter 7.4, by for example
|
||
|
modifying your bashrc:
|
||
|
cat > ~/.bash_profile << "EOF"
|
||
|
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
|
||
|
EOF
|
||
|
cat > ~/.bashrc << "EOF"
|
||
|
set +h
|
||
|
umask 022
|
||
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||
|
export PATH
|
||
|
EOF
|
||
|
source ~/.bash_profile
|
||
|
|
||
|
Chapter 7.5 onwards can be followed without any modifications. This is all
|
||
|
standard LFS stuff from here on.
|
||
|
|
||
|
It's probably not related to this specific bootstrap, but I had to run the
|
||
|
following extra commands during the remaining chapters:
|
||
|
|
||
|
7.10. Perl-5.32.0:
|
||
|
Run the following command after sh Configure:
|
||
|
echo '#define MB_LEN_MAX 16' >> config.h
|
||
|
|
||
|
7.13. Util-linux-2.36:
|
||
|
Run the following command after ./configure:
|
||
|
echo '#define SSIZE_MAX LONG_MAX' >> config.h
|
||
|
|
||
|
8.15. M4-1.4.18:
|
||
|
Run the following command after ./configure:
|
||
|
echo '#define MB_LEN_MAX 16' >> lib/config.h
|