Linux From Scratch

Again, have some fun with Linux From Scratch again.

1. Preparation

1.1 Create a Disk Image File

1
2
3
4
➜  repo dd if=/dev/zero of=./lfs.img bs=1M count=32768
32768+0 records in
32768+0 records out
34359738368 bytes (34 GB, 32 GiB) copied, 28.398 s, 1.2 GB/s
1
2
3
➜  repo ll lfs.img
Permissions Size User Date Modified Name
.rw-rw-r-- 34G lvision 27 Aug 03:33 lfs.img

1.2 Format the Disk Image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
➜  repo mkfs.ext4 lfs.img

mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 8388608 4k blocks and 2097152 inodes
Filesystem UUID: e3c14a31-b52c-46c0-97ac-882feff59aa1
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done

1.3 Mount the Disk Image

1
2
➜  repo sudo mount -o loop lfs.img /mnt/lfs
➜ repo
1
2
3
➜  repo df -h /mnt/lfs
Filesystem Size Used Avail Use% Mounted on
/dev/loop33 32G 24K 30G 1% /mnt/lfs

1.4 Login As Root

From now on, we need to login as user root.

1
2
3
➜  repo su - root                          
Password:
root@lvision-MS-7C60:~#

1.5 Exports

1
2
3
root@lvision-MS-7C60:~# export LFS=/mnt/lfs
root@lvision-MS-7C60:~# export LFS_TGT=$(uname -m)-lfs-linux-gnu
root@lvision-MS-7C60:~#

1.6 Download Source

1
2
3
4
root@lvision-MS-7C60:~# mkdir -v $LFS/sources
mkdir: created directory '/sources'
root@lvision-MS-7C60:~# chmod -v a+wt $LFS/sources
mode of '/sources' changed from 0755 (rwxr-xr-x) to 1777 (rwxrwxrwt)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
root@lvision-MS-7C60:/mnt/docker/repo# wget --input-file=wget-list-sysv --continue --directory-prefix=$LFS/sources
--2024-08-27 03:49:06-- https://download.savannah.gnu.org/releases/acl/acl-2.3.2.tar.xz
Resolving download.savannah.gnu.org (download.savannah.gnu.org)... 2001:470:142:5::200, 209.51.188.200
Connecting to download.savannah.gnu.org (download.savannah.gnu.org)|2001:470:142:5::200|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://mirrors.ocf.berkeley.edu/nongnu/acl/acl-2.3.2.tar.xz [following]
--2024-08-27 03:49:06-- https://mirrors.ocf.berkeley.edu/nongnu/acl/acl-2.3.2.tar.xz
Resolving mirrors.ocf.berkeley.edu (mirrors.ocf.berkeley.edu)... 2607:f140:0:32::70, 169.229.200.70
Connecting to mirrors.ocf.berkeley.edu (mirrors.ocf.berkeley.edu)|2607:f140:0:32::70|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 371680 (363K) [application/octet-stream]
Saving to: ‘/mnt/lfs/sources/acl-2.3.2.tar.xz’

acl-2.3.2.tar.xz 100%[====================================================================================================================================>] 362.97K --.-KB/s in 0.1s

2024-08-27 03:49:07 (3.07 MB/s) - ‘/mnt/lfs/sources/acl-2.3.2.tar.xz’ saved [371680/371680]

--2024-08-27 03:49:07-- https://download.savannah.gnu.org/releases/attr/attr-2.5.2.tar.gz
Connecting to download.savannah.gnu.org (download.savannah.gnu.org)|2001:470:142:5::200|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://nongnu.askapache.com/attr/attr-2.5.2.tar.gz [following]
--2024-08-27 03:49:07-- https://nongnu.askapache.com/attr/attr-2.5.2.tar.gz
Resolving nongnu.askapache.com (nongnu.askapache.com)... 50.87.145.190
Connecting to nongnu.askapache.com (nongnu.askapache.com)|50.87.145.190|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 492539 (481K) [application/x-gzip]
Saving to: ‘/mnt/lfs/sources/attr-2.5.2.tar.gz’

attr-2.5.2.tar.gz 100%[====================================================================================================================================>] 481.00K 2.13MB/s in 0.2s

......
sysvinit-3.10-consolidated-1.patch 100%[====================================================================================================================================>] 2.41K --.-KB/s in 0s

2024-08-27 03:51:25 (2.39 GB/s) - ‘/mnt/lfs/sources/sysvinit-3.10-consolidated-1.patch’ saved [2464/2464]

FINISHED --2024-08-27 03:51:25--
Total wall clock time: 2m 20s
Downloaded: 94 files, 519M in 1m 32s (5.67 MB/s)
You have new mail in /var/mail/root
root@lvision-MS-7C60:/mnt/docker/repo#

1.7 Limited Directory Layout in the LFS Filesystem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
root@lvision-MS-7C60:/mnt/lfs# mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin}

for i in bin lib sbin; do
ln -sv usr/$i $LFS/$i
done

case $(uname -m) in
x86_64) mkdir -pv $LFS/lib64 ;;
esac
mkdir: created directory '/mnt/lfs/etc'
mkdir: created directory '/mnt/lfs/var'
mkdir: created directory '/mnt/lfs/usr'
mkdir: created directory '/mnt/lfs/usr/bin'
mkdir: created directory '/mnt/lfs/usr/lib'
mkdir: created directory '/mnt/lfs/usr/sbin'
'/mnt/lfs/bin' -> 'usr/bin'
'/mnt/lfs/lib' -> 'usr/lib'
'/mnt/lfs/sbin' -> 'usr/sbin'
mkdir: created directory '/mnt/lfs/lib64'
root@lvision-MS-7C60:/mnt/lfs# mkdir -pv $LFS/tools
mkdir: created directory '/mnt/lfs/tools'
root@lvision-MS-7C60:/mnt/lfs#

1.8 Adding the LFS User

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@lvision-MS-7C60:/mnt/lfs# groupadd lfs
useradd -s /bin/bash -g lfs -m -k /dev/null lfs
groupadd: group 'lfs' already exists
useradd: user 'lfs' already exists
root@lvision-MS-7C60:/mnt/lfs# chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools}
case $(uname -m) in
x86_64) chown -v lfs $LFS/lib64 ;;
esac
changed ownership of '/mnt/lfs/usr' from root to lfs
changed ownership of '/mnt/lfs/usr/bin' from root to lfs
changed ownership of '/mnt/lfs/usr/lib' from root to lfs
changed ownership of '/mnt/lfs/usr/sbin' from root to lfs
ownership of '/mnt/lfs/lib' retained as lfs
changed ownership of '/mnt/lfs/var' from root to lfs
changed ownership of '/mnt/lfs/etc' from root to lfs
ownership of '/mnt/lfs/bin' retained as lfs
ownership of '/mnt/lfs/sbin' retained as lfs
changed ownership of '/mnt/lfs/tools' from root to lfs
changed ownership of '/mnt/lfs/lib64' from root to lfs
1
2
root@lvision-MS-7C60:/mnt/lfs# su - lfs
lfs@lvision-MS-7C60:~$

2. Building

Please just strictly follow

2.1 Entering Chroot

1
2
3
4
chown --from lfs -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools}
case $(uname -m) in
x86_64) chown --from lfs -R root:root $LFS/lib64 ;;
esac
1
2
3
4
5
6
7
8
9
10
root@lvision-MS-7C60:/mnt/lfs# mount -v --bind /dev $LFS/dev
mount -vt devpts devpts -o gid=5,mode=0620 $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
mount: /dev bound on /mnt/lfs/dev.
mount: devpts mounted on /mnt/lfs/dev/pts.
mount: proc mounted on /mnt/lfs/proc.
mount: sysfs mounted on /mnt/lfs/sys.
mount: tmpfs mounted on /mnt/lfs/run.
1
2
3
4
5
6
root@lvision-MS-7C60:/mnt/lfs# if [ -h $LFS/dev/shm ]; then
install -v -d -m 1777 $LFS$(realpath /dev/shm)
else
mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
fi
mount: tmpfs mounted on /mnt/lfs/dev/shm.
1
2
3
4
5
6
7
8
9
root@lvision-MS-7C60:/mnt/lfs# chroot "$LFS" /usr/bin/env -i   \
HOME=/root \
TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \
PATH=/usr/bin:/usr/sbin \
MAKEFLAGS="-j$(nproc)" \
TESTSUITEFLAGS="-j$(nproc)" \
/bin/bash --login
(lfs chroot) root:/#

2.2 Bug Fixing

2.2.1 LFS Chapter 8 - 8.35. Grep-3.11

  • The bug:
1
2
3
4
5
In file included from grep.c:43:
../lib/getopt.h:84:10: fatal error: getopt-cdefs.h: No such file or directory
84 | #include <getopt-cdefs.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.

Under folder /sources/grep-3.11/lib, there is the file getopt-cdefs.in.h, but NO getopt-cdefs.h.

  • The Solution:
1
(lfs chroot) root:/sources/grep-3.11# cp ../coreutils-9.5/lib/getopt-cdefs.h ./lib/

2.2.2 LFS Chapter 8 - 8.37. Libtool-2.4.7

  • The bug:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
(lfs chroot) root:/sources/libtool-2.4.7# make check
GEN public-submodule-commit
make check-recursive
make[1]: Entering directory '/sources/libtool-2.4.7'
Making check in .
make[2]: Entering directory '/sources/libtool-2.4.7'
make check-local
make[3]: Entering directory '/sources/libtool-2.4.7'
## ----------------------------- ##
## GNU Libtool 2.4.7 test suite. ##
## ----------------------------- ##

26: test LT_SUPPORTED_TAG interface skipped (libtool.at:219)
33: force non-PIC objects skipped (demo.at:513)
46: F77 convenience archives skipped (convenience.at:111)
48: Java convenience archives skipped (convenience.at:231)
47: FC convenience archives skipped (convenience.at:171)
21: diagnose no mode specified ok
1: func_munge_path_list works ok
25: check objectlist file operation ok
20: check help output ok
24: check link mode operation ok
3: libtoolize macro directory mismatch error ok
2: libtoolize macro installation ok
5: multiple AC_CONFIG_MACRO_DIRS directories ok
4: multiple AC_CONFIG_MACRO_DIRS invocation ok
6: libtoolize ACLOCAL_AMFLAGS extraction ok
62: passing F77 flags through libtool skipped (flags.at:24)
63: passing FC flags through libtool skipped (flags.at:24)
64: passing GCJ flags through libtool skipped (flags.at:24)
29: preload static and dynamic module expected failure (demo.at:422)
31: disable fast install expected failure (demo.at:483)
43: allow_undefined_flag expected failure (cdemo.at:185)
41: build and link against a dynamic library expected failure (cdemo.at:155)
27: link against a preloaded static library expected failure (demo.at:388)
42: build both static and dynamic expected failure (cdemo.at:170)
36: uninstalled libraries have priority expected failure (demo.at:795)
32: force PIC objects expected failure (demo.at:501)
28: build and dynamically load a module expected failure (demo.at:405)
54: standard command line options ok
34: hardcoding library path expected failure (demo.at:612)
40: build and link against a static library expected failure (cdemo.at:140)
39: test --with-pic expected failure (with-pic.at:31)
35: binary relinking at install time expected failure (demo.at:724)
37: linking with long file names expected failure (demo.at:982)
30: deplibs_check_method expected failure (demo.at:468)
51: shared and static interdependencies expected failure (depdemo.at:324)
80: both of -o prog and -o prog$EXEEXT work skipped (exeext.at:29)
52: disable fast install expected failure (depdemo.at:341)
49: static library interdependencies expected failure (depdemo.at:290)
53: binary relinking at install time expected failure (depdemo.at:360)
50: shared library interdependencies expected failure (depdemo.at:307)
38: override pic_flag at configure time expected failure (pic_flag.at:52)
74: export from a DLL with a .def file skipped (export-def.at:35)
14: verbatim aclocal.m4 w/o AC_CONFIG_MACRO_DIRS expected failure (libtoolize.at:789)
90: F77 inferred tag skipped (infer-tag.at:57)
91: FC inferred tag skipped (infer-tag.at:71)
92: GCJ inferred tag skipped (infer-tag.at:85)
76: sys_lib_search_path on w32 skipped (search-path.at:84)
94: nocase library search skipped (nocase.at:31)
9: diagnose missing LT_CONFIG_LTDL_DIR ok
88: inferred tag ok
15: nonrecursive ltdl with AC_CONFIG_MACRO_DIRS ok
89: CXX inferred tag ok
72: ccache -all-static ok
75: sys_lib_search_path ok
13: upgrading verbatim style aclocal.m4 expected failure (libtoolize.at:698)
93: localized compiler messages ok
18: LIBTOOLIZE_OPTIONS ok
99: AM_PROG_LIBTOOL expected failure (old-m4-iface.at:91)
101: AC_CONFIG_MACRO_DIR ok
85: cwrapper string length skipped (cwrapper.at:190)
107: lt_dlopen archive skipped (lt_dlopen_a.at:79)
102: C subdir-objects expected failure (am-subdir.at:79)
17: Subproject ltdl without GNU M4 ok
110: ltdl API skipped (ltdl-api.at:32)
11: correctly parse LTDL_INIT from configure.ac ok
10: copy ltdl.m4 with shared macro directory ok
103: C++ subdir-objects expected failure (am-subdir.at:147)
12: diagnose missing LTDL_INIT invocation ok
79: static library contains static library expected failure (archive-in-archive.at:57)
95: Install tests ok
16: subproject ltdl with unconventional layout ok
19: cleanup old installation ok
115: SList functionality ok
55: mode short-hands ok
97: Simple DESTDIR install ok
68: Failure tests ok
59: preserve duplicate convenience deps expected failure (duplicate_deps.at:73)
86: cwrapper and installed shared libraries ok
7: libtoolize macro serial update ok
82: bindir basic lib test ok
70: Runpath in libtool library files ok
109: libdir of installed modules ok
104: lt_dlexit unloading libs ok
111: dlloader API ok
69: shlibpath_overrides_runpath ok
106: lt_dlopen error messages expected failure (lt_dlopen.at:102)
114: resident modules ok
117: dynamically ltdl preload static modules expected failure (mdemo.at:629)
118: dynamically ltdl load a shared module expected failure (mdemo.at:646)
113: syntax of .la files expected failure (lalib-syntax.at:133)
119: ltdl load shared and static modules expected failure (mdemo.at:663)
100: AC_WITH_LTDL expected failure (old-m4-iface.at:161)
57: duplicate members in archive tests ok
120: ltdl dryrun expected failure (mdemo.at:680)
121: link with library that loads ltdl modules expected failure (mdemo.at:841)
108: lt_dlopenext error messages ok
60: passing CC flags through libtool ok
136: static library expected failure (tagdemo.at:343)
138: shared and static together expected failure (tagdemo.at:373)
137: shared library expected failure (tagdemo.at:358)
112: loadlibrary error messages skipped (loadlibrary.at:250)
139: allow_undefined_flag expected failure (tagdemo.at:388)
77: indirect convenience ok
133: compiling softlinked libltdl expected failure (recursive.at:69)
130: compiling softlinked libltdl expected failure (nonrecursive.at:91)
134: compiling copied libltdl expected failure (recursive.at:89)
152: static library skipped (f77demo.at:301)
131: compiling copied libltdl expected failure (nonrecursive.at:115)
153: shared library skipped (f77demo.at:316)
135: installable libltdl expected failure (recursive.at:111)
155: static library skipped (fcdemo.at:315)
154: shared and static together skipped (f77demo.at:331)
132: installable libltdl expected failure (nonrecursive.at:141)
156: shared library skipped (fcdemo.at:330)
157: shared and static together skipped (fcdemo.at:345)
158: darwin fat compile skipped (darwin.at:43)
65: inherited_linker_flags ok
160: darwin gdb debug information skipped (darwin.at:155)
163: dumpbin -symbols section hiding skipped (dumpbin-symbols.at:42)
143: C++ exception handling skipped (exceptions.at:361)
165: -L=.../lib -l skipped (sysroot.at:204)
166: -L SYSROOT/.../lib -l skipped (sysroot.at:205)
162: darwin can lt_dlopen .dylib and .so files skipped (darwin.at:250)
167: SYSROOT/.../*.la skipped (sysroot.at:206)
144: config.status expected failure (early-libtool.at:110)
145: config.lt expected failure (early-libtool.at:217)
8: libtoolize config files serial update ok
116: enforced lib prefix ok
146: AC_NO_EXECUTABLES expected failure (no-executables.at:76)
44: C convenience archives ok
61: passing CXX flags through libtool ok
78: indirect uninstalled ok
58: duplicate convenience archive names ok
161: darwin ld warnings changing configure results expected failure (darwin.at:226)
105: lt_dlopenadvise library loading ok
142: C++ static constructors ok
23: transform source suffices ok
126: compiling softlinked libltdl expected failure (subproject.at:62)
128: installable libltdl expected failure (subproject.at:96)
127: compiling copied libltdl expected failure (subproject.at:78)
140: simple template test ok
66: Link order test FAILED (link-order.at:106)
164: deplibs without file command ok
148: installable libltdl expected failure (configure-iface.at:145)
150: --with-included-ltdl expected failure (configure-iface.at:283)
151: convenience libltdl expected failure (configure-iface.at:322)
45: C++ convenience archives ok
147: build tree relpaths expected failure (deplibs-ident.at:69)
84: cwrapper for uninstalled executables ok
98: DESTDIR with in-package deplibs ok
73: Export test ok
56: debug tracing ok
22: quote shell meta-characters in filenames ok
159: darwin concurrent library extraction ok
87: deplib in subdir ok
81: execute mode ok
96: versioning ok
141: template test with subdirs ok
67: Link order of deplibs ok
122: compiling softlinked libltdl FAILED (standalone.at:36)
124: installable libltdl FAILED (standalone.at:68)
123: compiling copied libltdl FAILED (standalone.at:51)
125: linking libltdl without autotools FAILED (standalone.at:84)
129: linking libltdl without autotools FAILED (subproject.at:114)
149: --with-ltdl-include/lib expected failure (configure-iface.at:179)
71: static linking flags for programs ok
83: bindir install tests ok
168: Link option thorough search test ok
169: Run tests with low max_cmd_len FAILED (cmdline_wrap.at:48)

## ------------- ##
## Test results. ##
## ------------- ##

ERROR: 136 tests were run,
65 failed (58 expected failures).
33 tests were skipped.
## -------------------------- ##
## testsuite.log was created. ##
## -------------------------- ##

Please send `tests/testsuite.log' and all information you think might help:

To: <bug-libtool@gnu.org>
Subject: [GNU Libtool 2.4.7] testsuite: 66 122 123 124 125 129 169 failed

You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point. Its output may
be found below `tests/testsuite.dir'.

make[3]: *** [Makefile:2555: check-local] Error 1
make[3]: Leaving directory '/sources/libtool-2.4.7'
make[2]: *** [Makefile:1948: check-am] Error 2
make[2]: Leaving directory '/sources/libtool-2.4.7'
make[1]: *** [Makefile:1648: check-recursive] Error 1
make[1]: Leaving directory '/sources/libtool-2.4.7'
make: *** [Makefile:1950: check] Error 2
  • The Solution:

Filed to bug-libtool@gnu.org

2.2.3 LFS Chapter 8 - 8.64. GRUB-2.12

2.2.3.1 i386-pc

The following configuration

1
2
3
4
./configure --prefix=/usr          \
--sysconfdir=/etc \
--disable-efiemu \
--disable-werror

builds GRUB for i386-pc:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
*******************************************************
GRUB2 will be compiled with following components:
Platform: i386-pc
With devmapper support: No (need libdevmapper header)
With memory debugging: No
With disk cache statistics: No
With boot time statistics: No
efiemu runtime: No (explicitly disabled)
grub-mkfont: No (need freetype2 library)
grub-mount: No (need fuse or fuse3 libraries)
starfield theme: No (No build-time grub-mkfont)
With libzfs support: No (need zfs library)
Build-time grub-mkfont: No (need freetype2 library)
Without unifont (no build-time grub-mkfont)
With liblzma from -llzma (support for XZ-compressed mips images)
With stack smashing protector: No
*******************************************************

2.2.3.2 x86_64-efi

The following configuration

1
2
3
4
5
6
./configure --prefix=/usr          \
--sysconfdir=/etc \
--target=x86_64 \
--with-platform=efi \
--disable-efiemu \
--disable-werror

builds GRUB for x86_64-efi supporting UEFI:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
*******************************************************
GRUB2 will be compiled with following components:
Platform: x86_64-efi
With devmapper support: No (need libdevmapper header)
With memory debugging: No
With disk cache statistics: No
With boot time statistics: No
efiemu runtime: No (not available on efi)
grub-mkfont: No (need freetype2 library)
grub-mount: No (need fuse or fuse3 libraries)
starfield theme: No (No build-time grub-mkfont)
With libzfs support: No (need zfs library)
Build-time grub-mkfont: No (need freetype2 library)
Without unifont (no build-time grub-mkfont)
With liblzma from -llzma (support for XZ-compressed mips images)
With stack smashing protector: No
*******************************************************

2.2.4 LFS Chapter 8 - 8.71. Tar-1.35

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## ------------- ##
## Test results. ##
## ------------- ##

ERROR: 224 tests were run,
1 failed unexpectedly.
20 tests were skipped.
## -------------------------- ##
## testsuite.log was created. ##
## -------------------------- ##

Please send `tests/testsuite.log' and all information you think might help:

To: <bug-tar@gnu.org>
Subject: [GNU tar 1.35] testsuite: 233 failed

You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point. Its output may
be found below `tests/testsuite.dir'.

make[2]: *** [Makefile:2347: check-local] Error 1
make[2]: Leaving directory '/sources/tar-1.35/tests'
make[1]: *** [Makefile:2193: check-am] Error 2
make[1]: Leaving directory '/sources/tar-1.35/tests'
make: *** [Makefile:1882: check-recursive] Error 1

2.2.5 LFS Chapter 8 - 8.78. Procps-ng-4.0.4

1
2
3
4
5
6
7
8
9
10
11
12
13

=== w Summary ===

# of expected passes 8
/sources/procps-ng-4.0.4/src/w version 4.0.4

make[3]: *** [Makefile:529: check-DEJAGNU] Error 1
make[3]: Leaving directory '/sources/procps-ng-4.0.4/testsuite'
make[2]: *** [Makefile:603: check-am] Error 2
make[2]: Leaving directory '/sources/procps-ng-4.0.4/testsuite'
make[1]: *** [Makefile:2251: check-recursive] Error 1
make[1]: Leaving directory '/sources/procps-ng-4.0.4'
make: *** [Makefile:2757: check] Error 2

3. Flashing

3.1 Make .iso

A couple of commands as follows are to be run, with the user root.

  1. Attach lfs.img to a loop device: losetup -fP ./lfs.img or losetup /dev/loop33 ./lfs.img
  2. Verify the loop device: losetup -l | grep lfs
  3. Mount the loop device mount /dev/loop33 /mnt/lfs
  4. Create a minimum bootable ISO: grub-mkrescue -o ./lfs-bootable.iso /mnt/lfs/boot
  5. Create the full bootable ISO:
  • mkdir /mnt/lfs-iso
  • cp /mnt/lfs/* /mnt/lfs-iso
  • grub-mkrescue -o ./full-lfs-bootable.iso /mnt/lfs-iso/

In the above, step 1,2,3 can be replaced by a single command mount -o loop ./lfs.img /mnt/lfs.

After having both ISO files successfully burned, we’ll get:

1
2
3
4
➜  x86_64 ll
Permissions Size User Date Modified Name
.rw-r--r-- 1.9G lvision 29 Aug 14:36 full-lfs-bootable.iso
.rw-r--r-- 34M root 29 Aug 14:37 lfs-rescue.iso

3.2 Flash Onto A TF Card

1
2
3
4
5
6
➜  /mnt sudo dd if=lvt-lfs.iso of=/dev/sdc bs=4M status=progress
989855744 bytes (990 MB, 944 MiB) copied, 1 s, 987 MB/s

416+1 records in
416+1 records out
1747154944 bytes (1.7 GB, 1.6 GiB) copied, 293.593 s, 6.0 MB/s

4. Demonstration

1
2
3
4
➜  ~ sudo qemu-system-x86_64 -drive file=/dev/sdb,format=raw,if=virtio -kernel /mnt/boot/vmlinuz -initrd /mnt/boot/initrd.img-6.10.8 -append "root=UUID=d1fdffc1-2964-40bc-8dd6-db3d0097cdb7 rw rootdelay=5" -m 2048

[sudo] password for lvision:

Linux From Scratch Login