Size: 78130
Comment:
|
Size: 81962
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
<<TableOfContents(3)>> |
|
Line 9: | Line 11: |
List of the required downloads for LFS 11.3 |
|
Line 10: | Line 14: |
List of the required downloads for LFS 11.3 | |
Line 14: | Line 17: |
uname -a # Linux debian 5.10.0-22-amd64 #1 SMP Debian 5.10.178-3 (2023-04-22) x86_64 GNU/Linux |
|
Line 26: | Line 30: |
sudo bash | |
Line 126: | Line 131: |
# Logged in as lfs user |
}}} == Build cross compiler system == === Logged in as lfs user === {{{#!highlight sh |
Line 158: | Line 166: |
# binutils as lfs user |
}}} === binutils as lfs user === {{{#!highlight sh |
Line 175: | Line 185: |
# gcc |
}}} === gcc === {{{#!highlight sh |
Line 220: | Line 232: |
38m | |
Line 224: | Line 235: |
# Linux-6.1.11 API Headers |
}}} === Linux-6.1.11 API Headers === {{{#!highlight sh |
Line 235: | Line 248: |
# glibc |
}}} === glibc === {{{#!highlight sh |
Line 271: | Line 286: |
# Libstdc++ |
}}} === Libstdc++ === {{{#!highlight sh |
Line 294: | Line 311: |
# m4 |
}}} === m4 === {{{#!highlight sh |
Line 320: | Line 339: |
# ncurses |
}}} === ncurses === {{{#!highlight sh |
Line 354: | Line 375: |
# bash |
}}} === bash === {{{#!highlight sh |
Line 371: | Line 394: |
# coreutils |
}}} === coreutils === {{{#!highlight sh |
Line 394: | Line 419: |
# diffutils |
}}} === diffutils === {{{#!highlight sh |
Line 406: | Line 433: |
# file |
}}} === file === {{{#!highlight sh |
Line 428: | Line 457: |
# findutils |
}}} === findutils === {{{#!highlight sh |
Line 443: | Line 474: |
# gawk |
}}} === gawk === {{{#!highlight sh |
Line 459: | Line 492: |
# grep |
}}} === grep === {{{#!highlight sh |
Line 473: | Line 508: |
# gzip |
}}} === gzip === {{{#!highlight sh |
Line 486: | Line 523: |
# make |
}}} === make === {{{#!highlight sh |
Line 506: | Line 545: |
# patch |
}}} === patch === {{{#!highlight sh |
Line 513: | Line 554: |
Line 522: | Line 562: |
# sed |
}}} === sed === {{{#!highlight sh |
Line 536: | Line 578: |
# tar |
}}} === tar === {{{#!highlight sh |
Line 551: | Line 595: |
# xz |
}}} === xz === {{{#!highlight sh |
Line 569: | Line 615: |
# binutils pass 2 |
}}} === binutils pass 2 === {{{#!highlight sh |
Line 596: | Line 644: |
# gcc part 2 |
}}} === gcc part 2 === {{{#!highlight sh |
Line 646: | Line 696: |
# As root user |
}}} === As root user === {{{#!highlight sh sudo bash export LFS=/home/vagrant/lfs |
Line 748: | Line 802: |
# gettext |
}}} === gettext === {{{#!highlight sh |
Line 761: | Line 817: |
# bison |
}}} === bison === {{{#!highlight sh |
Line 774: | Line 832: |
# perl |
}}} === perl === {{{#!highlight sh |
Line 795: | Line 855: |
# python |
}}} === python === {{{#!highlight sh |
Line 809: | Line 871: |
# texinfo |
}}} === texinfo === {{{#!highlight sh |
Line 822: | Line 886: |
# util-linux |
}}} === util-linux === {{{#!highlight sh |
Line 848: | Line 914: |
# Cleaning |
}}} === Cleaning === {{{#!highlight sh |
Line 853: | Line 921: |
# Backup as root |
}}} === Backup as root === {{{#!highlight sh |
Line 862: | Line 932: |
# Restore as root if required |
}}} === Restore as root if required === {{{#!highlight sh |
Line 868: | Line 940: |
# Prepare Virtual Kernel File Systems |
}}} == Build system based on the cross compiler == === Prepare Virtual Kernel File Systems === {{{#!highlight sh |
Line 882: | Line 958: |
# Enter the chroot env |
}}} === Enter the chroot env === {{{#!highlight sh |
Line 890: | Line 968: |
# man pages |
}}} === man pages === {{{#!highlight sh |
Line 899: | Line 979: |
# iana |
}}} === iana === {{{#!highlight sh |
Line 910: | Line 992: |
# glibc |
}}} === glibc === {{{#!highlight sh |
Line 1001: | Line 1085: |
# zlib |
}}} === zlib === {{{#!highlight sh |
Line 1016: | Line 1102: |
# bzip2 |
}}} === bzip2 === {{{#!highlight sh |
Line 1042: | Line 1130: |
# xz |
}}} === xz === {{{#!highlight sh |
Line 1059: | Line 1149: |
# zstd |
}}} === zstd === {{{#!highlight sh |
Line 1073: | Line 1165: |
# file |
}}} === file === {{{#!highlight sh |
Line 1088: | Line 1182: |
# readline |
}}} === readline === {{{#!highlight sh |
Line 1110: | Line 1206: |
# m4 |
}}} === m4 === {{{#!highlight sh |
Line 1125: | Line 1223: |
# bc |
}}} === bc === {{{#!highlight sh |
Line 1140: | Line 1240: |
# flex |
}}} === flex === {{{#!highlight sh |
Line 1159: | Line 1261: |
# tcl |
}}} === tcl === {{{#!highlight sh |
Line 1206: | Line 1310: |
# expect |
}}} === expect === {{{#!highlight sh |
Line 1227: | Line 1333: |
# dejagnu |
}}} === dejagnu === {{{#!highlight sh |
Line 2882: | Line 2989: |
# Add partition to host lfs build ## add dymamic disk 8 GB to debian vagrant .... |
}}} == Add partition in VM to host LFS build == {{{#!highlight sh # Add dymamic disk 8 GB to debian built with vagrant .... |
Line 2887: | Line 2995: |
## settings storage sata add hard disk ## create VDI dynamically allocated with 8 GB |
# VirtualBox, debian VM, settings storage sata add hard disk # Create VDI dynamically allocated with 8 GB |
Line 2890: | Line 2998: |
## sd 2:0:0:0: [sdb] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB) | # sd 2:0:0:0: [sdb] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB) |
Line 2892: | Line 3000: |
## label type gpt ## new 8GB linux fs ## write yes quit |
# label type gpt # new 8GB linux fs # write yes quit |
Line 2901: | Line 3009: |
# change fstab in debian host | |
Line 2919: | Line 3028: |
nano $LFS/etc/fstab # /dev/sdb1 / ext4 defaults 1 1 nano /etc/grub.d/40_custom # menuentry "GNU/Linux, Linux 6.1.11-lfs-11.3" { # linux /boot/vmlinuz-6.1.11-lfs-11.3 root=/dev/sdb1 ro # } |
# Update LFS fstab cat >>$LFS/etc/fstab << "EOF" /dev/sdb1 / ext4 defaults 1 1 EOF # Update debian grub to have an entry to LFS cat >>/etc/grub.d/40_custom << "EOF" menuentry "GNU/Linux, Linux 6.1.11-lfs-11.3" { linux /boot/vmlinuz-6.1.11-lfs-11.3 root=/dev/sdb1 ro } EOF |
Line 3002: | Line 3116: |
== Hello world USB boot == === Build install-mbr === {{{#!highlight sh cd tmp/ wget http://deb.debian.org/debian/pool/main/m/mbr/mbr_1.2.1.tar.xz tar tvaf mbr_1.2.1.tar.xz cd mbr-1.2.1/ ls ./configure make clean make make install }}} === create-usb-boot-hello-world.sh === Create a FAT16 partition using '''cfdisk /dev/sdX'''. We can find the right device using '''dmesg''' or '''lsblk''' commands. {{{#!highlight sh lsblk cfdisk (dev/sdc # new partition FAT16 }}} {{{#!highlight sh lsblk read -p "Target device: " DEVICE echo "Install MBR on device $DEVICE" read -p "Enter to continue" install-mbr $DEVICE --force PARTITION=${DEVICE}1 echo "Format $PARTITION" read -p "Enter to continue" # create an MS-DOS FAT filesystem mkdosfs $PARTITION echo "Install syslinux" read -p "Enter to continue" # install the SYSLINUX bootloader on a FAT filesystem syslinux $PARTITION echo "Build ramfs" rm -rf ramfs/ mkdir ramfs cd ramfs cat > hello.c << EOF #include <dirent.h> #include <stdio.h> #include <unistd.h> #include <string.h> int main(void) { char data[256]; DIR *d; struct dirent *dir; printf("Hello world!\n"); d = opendir("/dev"); if (d) { while ((dir = readdir(d)) != NULL) { printf("%s\n", dir->d_name); } closedir(d); } int loop=1; while(loop == 1){ printf("> "); scanf("%s",data); printf("<%s>\n", data); if( strcmp("exit",data) == 0) loop=0; } // sleep(3600); return(0); } EOF # compile static code gcc -static hello.c -o init # build cpio gz find . | cpio -H newc -o | gzip > ../ramfs.gz # copy data to initramfs mount $PARTITION /mnt cd /mnt cat > syslinux.cfg << EOF default vmlinuz append initrd=initrd.gz init=/init EOF cp /boot/vmlinuz vmlinuz # slackware kernel #cp /root/vmlinuz-6.1.11-lfs-11.3 vmlinuz cp /root/ramfs.gz initrd.gz ls . cd ~ umount /mnt/ sync }}} |
Contents
-
LinuxFromScratch
-
Build cross compiler system
- Logged in as lfs user
- binutils as lfs user
- gcc
- Linux-6.1.11 API Headers
- glibc
- Libstdc++
- m4
- ncurses
- bash
- coreutils
- diffutils
- file
- findutils
- gawk
- grep
- gzip
- make
- patch
- sed
- tar
- xz
- binutils pass 2
- gcc part 2
- As root user
- gettext
- bison
- perl
- python
- texinfo
- util-linux
- Cleaning
- Backup as root
- Restore as root if required
- Build system based on the cross compiler
- Add partition in VM to host LFS build
-
Build cross compiler system
- initramfs with static program
LinuxFromScratch
Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own custom Linux system, entirely from source code.
https://www.linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-11.3-NOCHUNKS.html
https://www.linuxfromscratch.org/hints/downloads/files/boot-cd_easy.txt
List of the required downloads for LFS 11.3
1 # https://www.linuxfromscratch.org/lfs/downloads/stable/LFS-BOOK-11.3-NOCHUNKS.html
2 uname -a
3 # Linux debian 5.10.0-22-amd64 #1 SMP Debian 5.10.178-3 (2023-04-22) x86_64 GNU/Linux
4 cd ~
5 mkdir lfs
6 cd lfs
7 wget https://www.linuxfromscratch.org/lfs/downloads/stable/wget-list
8 xargs -l wget < wget-list
9
10 # wget --input-file=wget-list --continue --directory-prefix=$LFS/sources
11 mkdir sources
12 mv *patch *xz *gz *bz2 sources/
13
14 # As root
15 sudo bash
16 cd sources
17 chmod 666 . -R
18
19 export LFS=/home/vagrant/lfs
20 echo $LFS
21 mkdir -pv $LFS
22
23 cd $LFS
24 mkdir sources
25 wget https://www.linuxfromscratch.org/lfs/downloads/stable/wget-list
26 xargs -l wget < wget-list
27 cd ..
28
29 cat > version-check.sh << "EOF"
30 #!/bin/bash
31 # Simple script to list version numbers of critical development tools
32 export LC_ALL=C
33 bash --version | head -n1 | cut -d" " -f2-4
34 MYSH=$(readlink -f /bin/sh)
35 echo "/bin/sh -> $MYSH"
36 echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
37 unset MYSH
38
39 echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
40 bison --version | head -n1
41
42 if [ -h /usr/bin/yacc ]; then
43 echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
44 elif [ -x /usr/bin/yacc ]; then
45 echo yacc is `/usr/bin/yacc --version | head -n1`
46 else
47 echo "yacc not found"
48 fi
49
50 echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
51 diff --version | head -n1
52 find --version | head -n1
53 gawk --version | head -n1
54
55 if [ -h /usr/bin/awk ]; then
56 echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
57 elif [ -x /usr/bin/awk ]; then
58 echo awk is `/usr/bin/awk --version | head -n1`
59 else
60 echo "awk not found"
61 fi
62
63 gcc --version | head -n1
64 g++ --version | head -n1
65 grep --version | head -n1
66 gzip --version | head -n1
67 cat /proc/version
68 m4 --version | head -n1
69 make --version | head -n1
70 patch --version | head -n1
71 echo Perl `perl -V:version`
72 python3 --version
73 sed --version | head -n1
74 tar --version | head -n1
75 makeinfo --version | head -n1 # texinfo version
76 xz --version | head -n1
77
78 echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
79 if [ -x dummy ]
80 then echo "g++ compilation OK";
81 else echo "g++ compilation failed"; fi
82 rm -f dummy.c dummy
83 EOF
84
85 sudo rm /bin/sh
86 sudo ln -s /bin/bash /bin/sh
87 sudo apt install bison texinfo gawk
88
89 bash version-check.sh
90
91 # As root user
92 sudo bash
93 export LFS=/home/vagrant/lfs
94 mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin}
95
96 for i in bin lib sbin; do
97 ln -sv usr/$i $LFS/$i
98 done
99
100 case $(uname -m) in
101 x86_64) mkdir -pv $LFS/lib64 ;;
102 esac
103
104 mkdir -pv $LFS/tools
105 groupadd lfs
106 useradd -s /bin/bash -g lfs -m -k /dev/null lfs
107 echo -e "lfs\nlfs\n" | passwd lfs
108
109 chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools,sources}
110 chgrp -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools,sources}
111 chmod 755 sources/
112
113 case $(uname -m) in
114 x86_64) chown -v lfs $LFS/lib64 ;;
115 esac
Build cross compiler system
Logged in as lfs user
1 su - lfs
2
3 cat > ~/.bash_profile << "EOF"
4 exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
5 EOF
6
7 cat > ~/.bashrc << "EOF"
8 set +h
9 umask 022
10 LFS=/home/vagrant/lfs
11 LC_ALL=POSIX
12 LFS_TGT=$(uname -m)-lfs-linux-gnu
13 PATH=/usr/bin
14 if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
15 PATH=$LFS/tools/bin:$PATH
16 CONFIG_SITE=$LFS/usr/share/config.site
17 export LFS LC_ALL LFS_TGT PATH CONFIG_SITE
18 EOF
19
20 source ~/.bash_profile
21 source ~/.bashrc
22 echo $LFS
23
24 # Basic build steps
25 # cd /mnt/lfs/sources/
26 # untar package as lfs user
27 # go to package folder
28 # build
29 # go back to /mnt/lfs/sources/
30 # delete extracted package
31
binutils as lfs user
1 cd $LFS/sources/
2 tar xvif binutils*.xz
3 cd $(ls binutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4 mkdir -v build
5 cd build
6 ../configure --prefix=$LFS/tools \
7 --with-sysroot=$LFS \
8 --target=$LFS_TGT \
9 --disable-nls \
10 --enable-gprofng=no \
11 --disable-werror
12 make
13 make install
14 cd $LFS/sources/
15 rm -rf $(ls binutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
gcc
1 cd $LFS/sources/
2 tar xvif gcc*.xz
3 cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 tar -xf ../mpfr-4.2.0.tar.xz
6 mv -v mpfr-4.2.0 mpfr
7 tar -xf ../gmp-6.2.1.tar.xz
8 mv -v gmp-6.2.1 gmp
9 tar -xf ../mpc-1.3.1.tar.gz
10 mv -v mpc-1.3.1 mpc
11
12 case $(uname -m) in
13 x86_64)
14 sed -e '/m64=/s/lib64/lib/' \
15 -i.orig gcc/config/i386/t-linux64
16 ;;
17 esac
18
19 mkdir -v build
20 cd build
21
22 ../configure \
23 --target=$LFS_TGT \
24 --prefix=$LFS/tools \
25 --with-glibc-version=2.37 \
26 --with-sysroot=$LFS \
27 --with-newlib \
28 --without-headers \
29 --enable-default-pie \
30 --enable-default-ssp \
31 --disable-nls \
32 --disable-shared \
33 --disable-multilib \
34 --disable-threads \
35 --disable-libatomic \
36 --disable-libgomp \
37 --disable-libquadmath \
38 --disable-libssp \
39 --disable-libvtv \
40 --disable-libstdcxx \
41 --enable-languages=c,c++
42 make
43 make install
44
45 cd $LFS/sources/
46 rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
Linux-6.1.11 API Headers
glibc
1 cd $LFS/sources/
2 tar xvif glibc*.xz
3 cd $(ls glibc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4 case $(uname -m) in
5 i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
6 ;;
7 x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
8 ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
9 ;;
10 esac
11
12 patch -Np1 -i ../glibc-2.37-fhs-1.patch
13 mkdir -v build
14 cd build
15 echo "rootsbindir=/usr/sbin" > configparms
16 ../configure \
17 --prefix=/usr \
18 --host=$LFS_TGT \
19 --build=$(../scripts/config.guess) \
20 --enable-kernel=3.2 \
21 --with-headers=$LFS/usr/include \
22 libc_cv_slibdir=/usr/lib
23 make
24
25 make DESTDIR=$LFS install
26
27 sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd
28 echo 'int main(){}' | $LFS_TGT-gcc -xc -
29 readelf -l a.out | grep ld-linux
30 rm -v a.out
31
32 $LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders
33 cd $LFS/sources/
34 rm -rf $(ls glibc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
Libstdc++
1 cd $LFS/sources/
2 tar xvif gcc*.xz
3 cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 mkdir -v build
6 cd build
7
8 ../libstdc++-v3/configure \
9 --host=$LFS_TGT \
10 --build=$(../config.guess) \
11 --prefix=/usr \
12 --disable-multilib \
13 --disable-nls \
14 --disable-libstdcxx-pch \
15 --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/12.2.0
16 make
17
18 make DESTDIR=$LFS install
19 rm -v $LFS/usr/lib/lib{stdc++,stdc++fs,supc++}.la
20 cd $LFS/sources/
21 rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
m4
1 cd $LFS/sources/
2 tar xvif m4*.xz
3 cd $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 ./configure --prefix=/usr \
6 --host=$LFS_TGT \
7 --build=$(build-aux/config.guess)
8 make
9 make[1]: Leaving directory '/home/vagrant/lfs/sources/m4-1.4.19'
10 make: *** [Makefile:1974: all] Error 2
11
12 cd $LFS/sources/
13 tar xvif gcc*.xz
14 cd $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
15 cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
16 `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h
17 $LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders
18 cd $LFS/sources/
19 cd $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
20 make
21 make DESTDIR=$LFS install
22 cd $LFS/sources/
23 rm -rf $(ls gcc*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
24 rm -rf $(ls m4*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
ncurses
1 cd $LFS/sources/
2 tar xvzf ncurses*.gz
3 cd $(ls ncurses*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
4
5 sed -i s/mawk// configure
6
7 mkdir build
8 pushd build
9 ../configure
10 make -C include
11 make -C progs tic
12 popd
13
14 ./configure --prefix=/usr \
15 --host=$LFS_TGT \
16 --build=$(./config.guess) \
17 --mandir=/usr/share/man \
18 --with-manpage-format=normal \
19 --with-shared \
20 --without-normal \
21 --with-cxx-shared \
22 --without-debug \
23 --without-ada \
24 --disable-stripping \
25 --enable-widec
26 time make
27
28 make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
29 echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so
30
31 cd $LFS/sources/
32 rm -rf $(ls ncurses*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
bash
1 cd $LFS/sources/
2 tar xvzf bash*.gz
3 cd $(ls bash*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
4
5 ./configure --prefix=/usr \
6 --build=$(sh support/config.guess) \
7 --host=$LFS_TGT \
8 --without-bash-malloc
9
10 time make
11 make DESTDIR=$LFS install
12 ln -sv bash $LFS/bin/sh
13
14 cd $LFS/sources/
15 rm -rf $(ls bash*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
coreutils
1 cd $LFS/sources/
2 tar xvif coreutils*.xz
3 cd $(ls coreutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 ./configure --prefix=/usr \
6 --host=$LFS_TGT \
7 --build=$(build-aux/config.guess) \
8 --enable-install-program=hostname \
9 --enable-no-install-program=kill,uptime
10
11
12 time make
13 make DESTDIR=$LFS install
14
15 mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
16 mkdir -pv $LFS/usr/share/man/man8
17 mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
18 sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8
19
20 cd $LFS/sources/
21 rm -rf $(ls coreutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
diffutils
file
1 cd $LFS/sources/
2 tar xvzf file*.gz
3 cd $(ls file*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
4
5 mkdir build
6 pushd build
7 ../configure --disable-bzlib \
8 --disable-libseccomp \
9 --disable-xzlib \
10 --disable-zlib
11 make
12 popd
13
14 ./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess)
15 time make FILE_COMPILE=$(pwd)/build/src/file
16 make DESTDIR=$LFS install
17 rm -v $LFS/usr/lib/libmagic.la
18
19 cd $LFS/sources/
20 rm -rf $(ls file*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
findutils
1 cd $LFS/sources/
2 tar xvif findutils*.xz
3 cd $(ls findutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
4
5 ./configure --prefix=/usr \
6 --localstatedir=/var/lib/locate \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess)
9 make
10 make DESTDIR=$LFS install
11
12 cd $LFS/sources/
13 rm -rf $(ls findutils*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
gawk
1 cd $LFS/sources/
2 APP=gawk
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 sed -i 's/extras//' Makefile.in
7 ./configure --prefix=/usr \
8 --host=$LFS_TGT \
9 --build=$(build-aux/config.guess)
10 make
11 make DESTDIR=$LFS install
12
13 cd $LFS/sources/
14 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
grep
gzip
make
1 cd $LFS/sources/
2 APP=make
3 tar xvif $APP*.gz
4 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
5
6 sed -e '/ifdef SIGPIPE/,+2 d' \
7 -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \
8 -i src/main.c
9
10 ./configure --prefix=/usr \
11 --without-guile \
12 --host=$LFS_TGT \
13 --build=$(build-aux/config.guess)
14 make
15 make DESTDIR=$LFS install
16
17 cd $LFS/sources/
18 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
patch
1 cd $LFS/sources/
2 APP=patch
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 ./configure --prefix=/usr \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess)
9 make
10 make DESTDIR=$LFS install
11
12 cd $LFS/sources/
13 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
sed
tar
1 cd $LFS/sources/
2 APP=tar
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 ./configure --prefix=/usr \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess)
9 make
10 make DESTDIR=$LFS install
11
12 cd $LFS/sources/
13 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
xz
1 cd $LFS/sources/
2 APP=xz
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 ./configure --prefix=/usr \
7 --host=$LFS_TGT \
8 --build=$(build-aux/config.guess) \
9 --disable-static \
10 --docdir=/usr/share/doc/xz-5.4.1
11 make
12 make DESTDIR=$LFS install
13 rm -v $LFS/usr/lib/liblzma.la
14
15 cd $LFS/sources/
16 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
binutils pass 2
1 cd $LFS/sources/
2 APP=binutils
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 sed '6009s/$add_dir//' -i ltmain.sh
7 mkdir -v build
8 cd build
9
10 ../configure \
11 --prefix=/usr \
12 --build=$(../config.guess) \
13 --host=$LFS_TGT \
14 --disable-nls \
15 --enable-shared \
16 --enable-gprofng=no \
17 --disable-werror \
18 --enable-64-bit-bfd
19
20 make
21 make DESTDIR=$LFS install
22 rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la}
23
24 cd $LFS/sources/
25 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
gcc part 2
1 cd $LFS/sources/
2 APP=gcc
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 tar -xf ../mpfr-4.2.0.tar.xz
7 mv -v mpfr-4.2.0 mpfr
8 tar -xf ../gmp-6.2.1.tar.xz
9 mv -v gmp-6.2.1 gmp
10 tar -xf ../mpc-1.3.1.tar.gz
11 mv -v mpc-1.3.1 mpc
12
13 case $(uname -m) in
14 x86_64)
15 sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
16 ;;
17 esac
18
19 sed '/thread_header =/s/@.*@/gthr-posix.h/' \
20 -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
21
22 mkdir -v build
23 cd build
24
25 ../configure \
26 --build=$(../config.guess) \
27 --host=$LFS_TGT \
28 --target=$LFS_TGT \
29 LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \
30 --prefix=/usr \
31 --with-build-sysroot=$LFS \
32 --enable-default-pie \
33 --enable-default-ssp \
34 --disable-nls \
35 --disable-multilib \
36 --disable-libatomic \
37 --disable-libgomp \
38 --disable-libquadmath \
39 --disable-libssp \
40 --disable-libvtv \
41 --enable-languages=c,c++
42
43 make
44 make DESTDIR=$LFS install
45 ln -sv gcc $LFS/usr/bin/cc
46
47 cd $LFS/sources/
48 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
As root user
1 sudo bash
2 export LFS=/home/vagrant/lfs
3 echo $LFS
4 /home/vagrant/lfs
5 cd $LFS
6 chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools}
7 case $(uname -m) in
8 x86_64) chown -R root:root $LFS/lib64 ;;
9 esac
10 mkdir -pv $LFS/{dev,proc,sys,run}
11 mount -v --bind /dev $LFS/dev
12
13 mount -v --bind /dev/pts $LFS/dev/pts
14 mount -vt proc proc $LFS/proc
15 mount -vt sysfs sysfs $LFS/sys
16 mount -vt tmpfs tmpfs $LFS/run
17
18 if [ -h $LFS/dev/shm ]; then
19 mkdir -pv $LFS/$(readlink $LFS/dev/shm)
20 else
21 mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
22 fi
23
24 chroot "$LFS" /usr/bin/env -i \
25 HOME=/root \
26 TERM="$TERM" \
27 PS1='(lfs chroot) \u:\w\$ ' \
28 PATH=/usr/bin:/usr/sbin \
29 /bin/bash --login
30 # in chroot state the bash prompt will say "I have no name!"
31 mkdir -pv /{boot,home,mnt,opt,srv}
32 mkdir -pv /etc/{opt,sysconfig}
33 mkdir -pv /lib/firmware
34 mkdir -pv /media/{floppy,cdrom}
35 mkdir -pv /usr/{,local/}{include,src}
36 mkdir -pv /usr/local/{bin,lib,sbin}
37 mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
38 mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
39 mkdir -pv /usr/{,local/}share/man/man{1..8}
40 mkdir -pv /var/{cache,local,log,mail,opt,spool}
41 mkdir -pv /var/lib/{color,misc,locate}
42
43 ln -sfv /run /var/run
44 ln -sfv /run/lock /var/lock
45
46 install -dv -m 0750 /root
47 install -dv -m 1777 /tmp /var/tmp
48
49 ln -sv /proc/self/mounts /etc/mtab
50
51 cat > /etc/hosts << "EOF"
52 127.0.0.1 localhost $(hostname)
53 ::1 localhost
54 EOF
55
56 cat > /etc/passwd << "EOF"
57 root:x:0:0:root:/root:/bin/bash
58 bin:x:1:1:bin:/dev/null:/usr/bin/false
59 daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false
60 messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false
61 uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
62 nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false
63 EOF
64
65 cat > /etc/group << "EOF"
66 root:x:0:
67 bin:x:1:daemon
68 sys:x:2:
69 kmem:x:3:
70 tape:x:4:
71 tty:x:5:
72 daemon:x:6:
73 floppy:x:7:
74 disk:x:8:
75 lp:x:9:
76 dialout:x:10:
77 audio:x:11:
78 video:x:12:
79 utmp:x:13:
80 usb:x:14:
81 cdrom:x:15:
82 adm:x:16:
83 messagebus:x:18:
84 input:x:24:
85 mail:x:34:
86 kvm:x:61:
87 uuidd:x:80:
88 wheel:x:97:
89 users:x:999:
90 nogroup:x:65534:
91 EOF
92
93 echo "tester:x:101:101::/home/tester:/bin/bash" >> /etc/passwd
94 echo "tester:x:101:" >> /etc/group
95 install -o tester -d /home/tester
96
97 exec /usr/bin/bash --login
98
99 touch /var/log/{btmp,lastlog,faillog,wtmp}
100 chgrp -v utmp /var/log/lastlog
101 chmod -v 664 /var/log/lastlog
102 chmod -v 600 /var/log/btmp
gettext
bison
perl
1 cd /sources/
2 APP=perl
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 sh Configure -des \
7 -Dprefix=/usr \
8 -Dvendorprefix=/usr \
9 -Dprivlib=/usr/lib/perl5/5.36/core_perl \
10 -Darchlib=/usr/lib/perl5/5.36/core_perl \
11 -Dsitelib=/usr/lib/perl5/5.36/site_perl \
12 -Dsitearch=/usr/lib/perl5/5.36/site_perl \
13 -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \
14 -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl
15 make
16 make install
17
18 cd /sources/
19 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
python
texinfo
util-linux
1 cd /sources/
2 APP=util-linux
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 mkdir -pv /var/lib/hwclock
7 ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
8 --libdir=/usr/lib \
9 --docdir=/usr/share/doc/util-linux-2.38.1 \
10 --disable-chfn-chsh \
11 --disable-login \
12 --disable-nologin \
13 --disable-su \
14 --disable-setpriv \
15 --disable-runuser \
16 --disable-pylibmount \
17 --disable-static \
18 --without-python \
19 runstatedir=/run
20 make
21 make install
22
23 cd /sources/
24 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
Cleaning
Backup as root
Restore as root if required
Build system based on the cross compiler
Prepare Virtual Kernel File Systems
1 findmnt | grep $LFS
2 mkdir -pv $LFS/{dev,proc,sys,run}
3 mount -v --bind /dev $LFS/dev
4 mount -v --bind /dev/pts $LFS/dev/pts
5 mount -vt proc proc $LFS/proc
6 mount -vt sysfs sysfs $LFS/sys
7 mount -vt tmpfs tmpfs $LFS/run
8 if [ -h $LFS/dev/shm ]; then
9 mkdir -pv $LFS/$(readlink $LFS/dev/shm)
10 else
11 mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
12 fi
Enter the chroot env
man pages
iana
glibc
1 cd /sources/
2 APP=glibc
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 patch -Np1 -i ../glibc-2.37-fhs-1.patch
7 sed '/width -=/s/workend - string/number_length/' \
8 -i stdio-common/vfprintf-process-arg.c
9 mkdir -v build
10 cd build
11
12 echo "rootsbindir=/usr/sbin" > configparms
13 ../configure --prefix=/usr \
14 --disable-werror \
15 --enable-kernel=3.2 \
16 --enable-stack-protector=strong \
17 --with-headers=/usr/include \
18 libc_cv_slibdir=/usr/lib
19
20 make
21 make check
22 touch /etc/ld.so.conf
23
24 sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
25 make install
26 sed '/RTLDLIST=/s@/usr@@g' -i /usr/bin/ldd
27 cp -v ../nscd/nscd.conf /etc/nscd.conf
28 mkdir -pv /var/cache/nscd
29
30 mkdir -pv /usr/lib/locale
31
32 localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
33
34 localedef -i en_US -f ISO-8859-1 en_US
35 localedef -i en_US -f UTF-8 en_US.UTF-8
36
37 localedef -i pt_PT -f ISO-8859-1 pt_PT
38 localedef -i pt_PT@euro -f ISO-8859-15 pt_PT@euro
39 localedef -i pt_PT -f UTF-8 pt_PT.UTF-8
40
41 make localedata/install-locales
42 localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
43 localedef -i ja_JP -f SHIFT_JIS ja_JP.SJIS 2> /dev/null || true
44
45 cat > /etc/nsswitch.conf << "EOF"
46 passwd: files
47 group: files
48 shadow: files
49
50 hosts: files dns
51 networks: files
52
53 protocols: files
54 services: files
55 ethers: files
56 rpc: files
57 EOF
58
59 tar -xf ../../tzdata2022g.tar.gz
60
61 ZONEINFO=/usr/share/zoneinfo
62 mkdir -pv $ZONEINFO/{posix,right}
63
64 for tz in etcetera southamerica northamerica europe africa antarctica \
65 asia australasia backward; do
66 zic -L /dev/null -d $ZONEINFO ${tz}
67 zic -L /dev/null -d $ZONEINFO/posix ${tz}
68 zic -L leapseconds -d $ZONEINFO/right ${tz}
69 done
70
71 cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
72 zic -d $ZONEINFO -p America/New_York
73 unset ZONEINFO
74
75 echo -e "7\n 37\n 1\n 1\n" | tzselect
76 # 7\n 37\n 1\n 1\n
77 # Europe Portugal Mainland yes
78 ln -sfv /usr/share/zoneinfo/Europe/Portugal /etc/localtime
79
80 cat > /etc/ld.so.conf << "EOF"
81 /usr/local/lib
82 /opt/lib
83 # Add an include directory
84 include /etc/ld.so.conf.d/*.conf
85 EOF
86
87 mkdir -pv /etc/ld.so.conf.d
88 cd /sources/
89 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
zlib
bzip2
1 cd /sources/
2 APP=bzip2
3 tar xvif $APP*.gz
4 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
5
6 patch -Np1 -i ../bzip2-1.0.8-install_docs-1.patch
7 sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
8 sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
9 make -f Makefile-libbz2_so
10 make clean
11 make
12 make PREFIX=/usr install
13 cp -av libbz2.so.* /usr/lib
14 ln -sv libbz2.so.1.0.8 /usr/lib/libbz2.so
15
16 cp -v bzip2-shared /usr/bin/bzip2
17 for i in /usr/bin/{bzcat,bunzip2}; do
18 ln -sfv bzip2 $i
19 done
20
21 rm -fv /usr/lib/libbz2.a
22
23 cd /sources/
24 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
xz
1 cd /sources/
2 APP=xz
3 tar xvif $APP*.xz
4 cd $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
5
6 ./configure --prefix=/usr \
7 --disable-static \
8 --docdir=/usr/share/doc/xz-5.4.1
9
10 make
11 make check
12 make install
13
14 cd /sources/
15 rm -rf $(ls $APP*xz | sed 's/\.tar//g' | sed 's/\.xz//g' )
zstd
file
1 cd /sources/
2 APP=file
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
readline
1 cd /sources/
2 APP=readline
3 tar xvif $APP*.gz
4 cd $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
5
6 sed -i '/MV.*old/d' Makefile.in
7 sed -i '/{OLDSUFF}/c:' support/shlib-install
8 patch -Np1 -i ../readline-8.2-upstream_fix-1.patch
9
10 ./configure --prefix=/usr \
11 --disable-static \
12 --with-curses \
13 --docdir=/usr/share/doc/readline-8.2
14
15 make SHLIB_LIBS="-lncursesw"
16 make SHLIB_LIBS="-lncursesw" install
17 install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.2
18
19 cd /sources/
20 rm -rf $(ls $APP*gz | sed 's/\.tar//g' | sed 's/\.gz//g' )
m4
1 cd /sources/
2 APP=m4
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr
8 make
9 make check
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
bc
1 cd /sources/
2 APP=bc
3 EXTENSION=xz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 CC=gcc ./configure --prefix=/usr -G -O3 -r
8 make
9 make test
10 make install
11
12 cd /sources/
13 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
flex
1 cd /sources/
2 APP=flex
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --docdir=/usr/share/doc/flex-2.6.4 \
9 --disable-static
10
11 make
12 make check
13 make install
14 ln -sv flex /usr/bin/lex
15
16 cd /sources/
17 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
tcl
1 cd /sources/
2 APP=tcl8.6.13-src
3 EXTENSION=gz
4 FOLDER=tcl8.6.13
5 tar xvzf $APP*.$EXTENSION
6 cd $FOLDER
7
8 SRCDIR=$(pwd)
9 cd unix
10 ./configure --prefix=/usr \
11 --mandir=/usr/share/man
12
13 make
14 sed -e "s|$SRCDIR/unix|/usr/lib|" \
15 -e "s|$SRCDIR|/usr/include|" \
16 -i tclConfig.sh
17
18 sed -e "s|$SRCDIR/unix/pkgs/tdbc1.1.5|/usr/lib/tdbc1.1.5|" \
19 -e "s|$SRCDIR/pkgs/tdbc1.1.5/generic|/usr/include|" \
20 -e "s|$SRCDIR/pkgs/tdbc1.1.5/library|/usr/lib/tcl8.6|" \
21 -e "s|$SRCDIR/pkgs/tdbc1.1.5|/usr/include|" \
22 -i pkgs/tdbc1.1.5/tdbcConfig.sh
23
24 sed -e "s|$SRCDIR/unix/pkgs/itcl4.2.3|/usr/lib/itcl4.2.3|" \
25 -e "s|$SRCDIR/pkgs/itcl4.2.3/generic|/usr/include|" \
26 -e "s|$SRCDIR/pkgs/itcl4.2.3|/usr/include|" \
27 -i pkgs/itcl4.2.3/itclConfig.sh
28
29 unset SRCDIR
30
31 make test
32 make install
33
34 chmod -v u+w /usr/lib/libtcl8.6.so
35
36 make install-private-headers
37 ln -sfv tclsh8.6 /usr/bin/tclsh
38 mv /usr/share/man/man3/{Thread,Tcl_Thread}.3
39 cd ..
40 tar -xf ../tcl8.6.13-html.tar.gz --strip-components=1
41 mkdir -v -p /usr/share/doc/tcl-8.6.13
42 cp -v -r ./html/* /usr/share/doc/tcl-8.6.13
43
44 cd /sources/
45 rm -rf $FOLDER
expect
1 cd /sources/
2 APP=expect
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 ./configure --prefix=/usr \
8 --with-tcl=/usr/lib \
9 --enable-shared \
10 --mandir=/usr/share/man \
11 --with-tclinclude=/usr/include
12
13 make
14 make test
15 make install
16 ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib
17
18 cd /sources/
19 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
dejagnu
1 cd /sources/
2 APP=dejagnu
3 EXTENSION=gz
4 tar xvif $APP*.$EXTENSION
5 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
6
7 mkdir -v build
8 cd build
9
10 ../configure --prefix=/usr
11 makeinfo --html --no-split -o doc/dejagnu.html ../doc/dejagnu.texi
12 makeinfo --plaintext -o doc/dejagnu.txt ../doc/dejagnu.texi
13
14 make install
15 install -v -dm755 /usr/share/doc/dejagnu-1.6.3
16 install -v -m644 doc/dejagnu.{html,txt} /usr/share/doc/dejagnu-1.6.3
17
18 make check
19
20 cd /sources/
21 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
22
23
24 # binutils
25 cd /sources/
26 APP=binutils
27 EXTENSION=xz
28 tar xvif $APP*.$EXTENSION
29 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
30
31 expect -c "spawn ls"
32 mkdir -v build
33 cd build
34
35 ../configure --prefix=/usr \
36 --sysconfdir=/etc \
37 --enable-gold \
38 --enable-ld=default \
39 --enable-plugins \
40 --enable-shared \
41 --disable-werror \
42 --enable-64-bit-bfd \
43 --with-system-zlib
44 make tooldir=/usr
45
46 make -k check
47 grep '^FAIL:' $(find -name '*.log')
48 # expected to 12 tests fail
49 grep '^FAIL:' $(find -name '*.log') | wc -l
50
51 make tooldir=/usr install
52 rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a
53 rm -fv /usr/share/man/man1/{gprofng,gp-*}.1
54
55 cd /sources/
56 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
57
58 # gmp
59 cd /sources/
60 APP=gmp
61 EXTENSION=xz
62 tar xvif $APP*.$EXTENSION
63 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
64
65 cp -v configfsf.guess config.guess
66 cp -v configfsf.sub config.sub
67
68 ./configure --prefix=/usr \
69 --enable-cxx \
70 --disable-static \
71 --docdir=/usr/share/doc/gmp-6.2.1
72 make
73 make html
74 make check 2>&1 | tee gmp-check-log
75 awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log
76 # check all 197 pass
77 make install
78 make install-html
79
80 cd /sources/
81 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
82
83
84 # mpfr
85 cd /sources/
86 APP=mpfr
87 EXTENSION=xz
88 tar xvif $APP*.$EXTENSION
89 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
90
91 sed -e 's/+01,234,567/+1,234,567 /' \
92 -e 's/13.10Pd/13Pd/' \
93 -i tests/tsprintf.c
94
95 ./configure --prefix=/usr \
96 --disable-static \
97 --enable-thread-safe \
98 --docdir=/usr/share/doc/mpfr-4.2.0
99 make
100 make html
101 make check
102 # ensure that all 197 tests passed
103 make install
104 make install-html
105
106 cd /sources/
107 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
108
109 # mpc
110 cd /sources/
111 APP=mpc
112 EXTENSION=gz
113 tar xvif $APP*.$EXTENSION
114 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
115
116
117 ./configure --prefix=/usr \
118 --disable-static \
119 --docdir=/usr/share/doc/mpc-1.3.1
120
121 make
122 make html
123 make check
124 make install
125 make install-html
126
127 cd /sources/
128 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
129
130 # attr
131 cd /sources/
132 APP=attr
133 EXTENSION=gz
134 tar xvif $APP*.$EXTENSION
135 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
136
137 ./configure --prefix=/usr \
138 --disable-static \
139 --sysconfdir=/etc \
140 --docdir=/usr/share/doc/attr-2.5.1
141
142 make
143 make check
144 make install
145
146 cd /sources/
147 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
148
149 # acl
150 cd /sources/
151 APP=acl
152 EXTENSION=xz
153 tar xvif $APP*.$EXTENSION
154 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
155
156 ./configure --prefix=/usr \
157 --disable-static \
158 --docdir=/usr/share/doc/acl-2.3.1
159
160 make
161 make install
162
163 cd /sources/
164 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
165
166 # libcap
167 cd /sources/
168 APP=libcap
169 EXTENSION=xz
170 tar xvif $APP*.$EXTENSION
171 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
172
173 sed -i '/install -m.*STA/d' libcap/Makefile
174 make prefix=/usr lib=lib
175 make test
176 make prefix=/usr lib=lib install
177
178 cd /sources/
179 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
180
181 # shadow
182 cd /sources/
183 APP=shadow
184 EXTENSION=xz
185 tar xvif $APP*.$EXTENSION
186 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
187
188 sed -i 's/groups$(EXEEXT) //' src/Makefile.in
189 find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
190 find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
191 find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
192
193 sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \
194 -e 's@#\(SHA_CRYPT_..._ROUNDS 5000\)@\100@' \
195 -e 's:/var/spool/mail:/var/mail:' \
196 -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
197 -i etc/login.defs
198
199 # no cracklib support
200
201 touch /usr/bin/passwd
202 ./configure --sysconfdir=/etc \
203 --disable-static \
204 --with-group-name-max-length=32
205
206 make
207 make exec_prefix=/usr install
208 make -C man install-man
209
210 pwconv
211 grpconv
212 mkdir -p /etc/default
213 useradd -D --gid 999
214
215 sed -i '/MAIL/s/yes/no/' /etc/default/useradd
216 # input root pwd
217 passwd root
218
219 cd /sources/
220 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
221
222 # gcc
223 cd /sources/
224 APP=gcc
225 EXTENSION=xz
226 tar xvif $APP*.$EXTENSION
227 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
228
229 case $(uname -m) in
230 x86_64)
231 sed -e '/m64=/s/lib64/lib/' \
232 -i.orig gcc/config/i386/t-linux64
233 ;;
234 esac
235
236 mkdir -v build
237 cd build
238
239 ../configure --prefix=/usr \
240 LD=ld \
241 --enable-languages=c,c++ \
242 --enable-default-pie \
243 --enable-default-ssp \
244 --disable-multilib \
245 --disable-bootstrap \
246 --with-system-zlib
247
248 time make # 43 SBU # real 65m28.356s
249 ulimit -s 32768
250 chown -Rv tester .
251 su tester -c "PATH=$PATH make -k check" # started 16:14
252 ../contrib/test_summary
253
254 make install
255 chown -v -R root:root \
256 /usr/lib/gcc/$(gcc -dumpmachine)/12.2.0/include{,-fixed}
257 ln -svr /usr/bin/cpp /usr/lib
258 ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/12.2.0/liblto_plugin.so \
259 /usr/lib/bfd-plugins/
260
261 echo 'int main(){}' > dummy.c
262 cc dummy.c -v -Wl,--verbose &> dummy.log
263 readelf -l a.out | grep ': /lib'
264 # should show
265 # [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
266
267 grep -E -o '/usr/lib.*/S?crt[1in].*succeeded' dummy.log
268 grep -B4 '^ /usr/include' dummy.log
269 grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
270 grep "/lib.*/libc.so.6 " dummy.log
271 rm -v dummy.c a.out dummy.log
272
273 mkdir -pv /usr/share/gdb/auto-load/usr/lib
274 mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
275
276 cd /sources/
277 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
278
279 # pkg-config
280 cd /sources/
281 APP=pkg-config
282 EXTENSION=gz
283 tar xvif $APP*.$EXTENSION
284 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
285
286 ./configure --prefix=/usr \
287 --with-internal-glib \
288 --disable-host-tool \
289 --docdir=/usr/share/doc/pkg-config-0.29.2
290 make
291 make check
292 make install
293
294 cd /sources/
295 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
296
297 # ncurses
298 cd /sources/
299 APP=ncurses
300 EXTENSION=gz
301 tar xvif $APP*.$EXTENSION
302 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
303
304 ./configure --prefix=/usr \
305 --mandir=/usr/share/man \
306 --with-shared \
307 --without-debug \
308 --without-normal \
309 --with-cxx-shared \
310 --enable-pc-files \
311 --enable-widec \
312 --with-pkg-config-libdir=/usr/lib/pkgconfig
313
314 make
315 make DESTDIR=$PWD/dest install
316 install -vm755 dest/usr/lib/libncursesw.so.6.4 /usr/lib
317 rm -v dest/usr/lib/libncursesw.so.6.4
318 cp -av dest/* /
319
320 for lib in ncurses form panel menu ; do
321 rm -vf /usr/lib/lib${lib}.so
322 echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so
323 ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
324 done
325
326 rm -vf /usr/lib/libcursesw.so
327 echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so
328 ln -sfv libncurses.so /usr/lib/libcurses.so
329
330 mkdir -pv /usr/share/doc/ncurses-6.4
331 cp -v -R doc/* /usr/share/doc/ncurses-6.4
332
333 cd /sources/
334 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
335
336 # sed
337 cd /sources/
338 APP=sed
339 EXTENSION=xz
340 tar xvif $APP*.$EXTENSION
341 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
342
343 ./configure --prefix=/usr
344
345 make
346 make html
347 chown -Rv tester .
348 su tester -c "PATH=$PATH make check"
349
350 make install
351 install -d -m755 /usr/share/doc/sed-4.9
352 install -m644 doc/sed.html /usr/share/doc/sed-4.9
353
354 cd /sources/
355 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
356
357 # psmisc
358 cd /sources/
359 APP=psmisc
360 EXTENSION=xz
361 tar xvif $APP*.$EXTENSION
362 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
363
364 ./configure --prefix=/usr
365 make
366 make install
367
368 cd /sources/
369 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
370
371 # gettext
372 cd /sources/
373 APP=gettext
374 EXTENSION=xz
375 tar xvif $APP*.$EXTENSION
376 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
377
378 ./configure --prefix=/usr \
379 --disable-static \
380 --docdir=/usr/share/doc/gettext-0.21.1
381
382 make
383 make check
384 make install
385 chmod -v 0755 /usr/lib/preloadable_libintl.so
386
387 cd /sources/
388 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
389
390 # bison
391 cd /sources/
392 APP=bison
393 EXTENSION=xz
394 tar xvif $APP*.$EXTENSION
395 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
396
397 ./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.8.2
398 make
399 make check
400 make install
401
402 cd /sources/
403 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
404
405 # grep
406 cd /sources/
407 APP=grep
408 EXTENSION=xz
409 tar xvif $APP*.$EXTENSION
410 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
411
412 sed -i "s/echo/#echo/" src/egrep.sh
413 ./configure --prefix=/usr
414 make
415 make check
416 make install
417
418 cd /sources/
419 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
420
421 # bash
422 cd /sources/
423 APP=bash
424 EXTENSION=gz
425 tar xvif $APP*.$EXTENSION
426 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
427
428 ./configure --prefix=/usr \
429 --without-bash-malloc \
430 --with-installed-readline \
431 --docdir=/usr/share/doc/bash-5.2.15
432
433 make
434 chown -Rv tester .
435 su -s /usr/bin/expect tester << EOF
436 set timeout -1
437 spawn make tests
438 expect eof
439 lassign [wait] _ _ _ value
440 exit $value
441 EOF
442
443 make install
444 exec /usr/bin/bash --login
445
446 cd /sources/
447 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
448
449 # libtool
450 cd /sources/
451 APP=libtool
452 EXTENSION=xz
453 tar xvif $APP*.$EXTENSION
454 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
455
456 ./configure --prefix=/usr
457 make
458 make -k check
459 make install
460 rm -fv /usr/lib/libltdl.a
461
462 cd /sources/
463 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
464
465 # gdbm
466 cd /sources/
467 APP=gdbm
468 EXTENSION=gz
469 tar xvif $APP*.$EXTENSION
470 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
471
472 ./configure --prefix=/usr \
473 --disable-static \
474 --enable-libgdbm-compat
475
476 make
477 make check
478 make install
479
480 cd /sources/
481 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
482
483 # gperf
484 cd /sources/
485 APP=gperf
486 EXTENSION=gz
487 tar xvif $APP*.$EXTENSION
488 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
489
490 ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1
491 make
492 make -j1 check
493 make install
494
495 cd /sources/
496 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
497
498 # expat
499 cd /sources/
500 APP=expat
501 EXTENSION=xz
502 tar xvif $APP*.$EXTENSION
503 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
504
505 ./configure --prefix=/usr \
506 --disable-static \
507 --docdir=/usr/share/doc/expat-2.5.0
508
509 make
510 make check
511 make install
512 install -v -m644 doc/*.{html,css} /usr/share/doc/expat-2.5.0
513
514 cd /sources/
515 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
516
517 # inetutils
518 cd /sources/
519 APP=inetutils
520 EXTENSION=xz
521 tar xvif $APP*.$EXTENSION
522 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
523
524 ./configure --prefix=/usr \
525 --bindir=/usr/bin \
526 --localstatedir=/var \
527 --disable-logger \
528 --disable-whois \
529 --disable-rcp \
530 --disable-rexec \
531 --disable-rlogin \
532 --disable-rsh \
533 --disable-servers
534
535 make
536 make check
537 make install
538 mv -v /usr/{,s}bin/ifconfig
539 cd /sources/
540 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
541
542 # less
543 cd /sources/
544 APP=less
545 EXTENSION=gz
546 tar xvif $APP*.$EXTENSION
547 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
548
549 ./configure --prefix=/usr --sysconfdir=/etc
550 make
551 make install
552
553 cd /sources/
554 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
555
556 # perl
557 cd /sources/
558 APP=perl
559 EXTENSION=xz
560 tar xvif $APP*.$EXTENSION
561 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
562
563 export BUILD_ZLIB=False
564 export BUILD_BZIP2=0
565
566 sh Configure -des \
567 -Dprefix=/usr \
568 -Dvendorprefix=/usr \
569 -Dprivlib=/usr/lib/perl5/5.36/core_perl \
570 -Darchlib=/usr/lib/perl5/5.36/core_perl \
571 -Dsitelib=/usr/lib/perl5/5.36/site_perl \
572 -Dsitearch=/usr/lib/perl5/5.36/site_perl \
573 -Dvendorlib=/usr/lib/perl5/5.36/vendor_perl \
574 -Dvendorarch=/usr/lib/perl5/5.36/vendor_perl \
575 -Dman1dir=/usr/share/man/man1 \
576 -Dman3dir=/usr/share/man/man3 \
577 -Dpager="/usr/bin/less -isR" \
578 -Duseshrplib \
579 -Dusethreads
580 make
581 make test
582 make install
583 unset BUILD_ZLIB BUILD_BZIP2
584
585 cd /sources/
586 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
587
588 # XML-Parser
589 cd /sources/
590 APP=XML-Parser
591 EXTENSION=gz
592 tar xvif $APP*.$EXTENSION
593 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
594
595 perl Makefile.PL
596 make
597 make test
598 make install
599
600 cd /sources/
601 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
602
603 # intltool-0.51.0.tar.gz
604 cd /sources/
605 APP=intltool
606 EXTENSION=gz
607 tar xvif $APP*.$EXTENSION
608 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
609
610 sed -i 's:\\\${:\\\$\\{:' intltool-update.in
611 ./configure --prefix=/usr
612 make
613 make check
614 make install
615 install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO
616
617 cd /sources/
618 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
619
620 # autoconf-2.71.tar.xz
621 cd /sources/
622 APP=autoconf
623 EXTENSION=xz
624 tar xvif $APP*.$EXTENSION
625 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
626
627 sed -e 's/SECONDS|/&SHLVL|/' \
628 -e '/BASH_ARGV=/a\ /^SHLVL=/ d' \
629 -i.orig tests/local.at
630
631 ./configure --prefix=/usr
632 make
633 make check
634 make install
635
636 cd /sources/
637 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
638
639 # automake-1.16.5.tar.xz
640 cd /sources/
641 APP=automake
642 EXTENSION=xz
643 tar xvif $APP*.$EXTENSION
644 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
645
646 ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.5
647
648 make
649 make -j4 check
650 make install
651
652 cd /sources/
653 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
654
655 # openssl-3.0.8.tar.gz
656 cd /sources/
657 APP=openssl
658 EXTENSION=gz
659 tar xvif $APP*.$EXTENSION
660 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
661
662 ./config --prefix=/usr \
663 --openssldir=/etc/ssl \
664 --libdir=lib \
665 shared \
666 zlib-dynamic
667
668 make
669 make test
670 sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile
671 make MANSUFFIX=ssl install
672 mv -v /usr/share/doc/openssl /usr/share/doc/openssl-3.0.8
673 cp -vfr doc/* /usr/share/doc/openssl-3.0.8
674
675 cd /sources/
676 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
677
678 # kmod-30.tar.xz
679 cd /sources/
680 APP=kmod
681 EXTENSION=xz
682 tar xvif $APP*.$EXTENSION
683 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
684
685 ./configure --prefix=/usr \
686 --sysconfdir=/etc \
687 --with-openssl \
688 --with-xz \
689 --with-zstd \
690 --with-zlib
691
692 make
693 make install
694
695 for target in depmod insmod modinfo modprobe rmmod; do
696 ln -sfv ../bin/kmod /usr/sbin/$target
697 done
698
699 ln -sfv kmod /usr/bin/lsmod
700
701 cd /sources/
702 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
703
704 # elfutils-0.188.tar.bz2
705 cd /sources/
706 APP=elfutils
707 EXTENSION=bz2
708 tar xvif $APP*.$EXTENSION
709 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
710
711 ./configure --prefix=/usr \
712 --disable-debuginfod \
713 --enable-libdebuginfod=dummy
714
715 make
716 make check
717 make -C libelf install
718 install -vm644 config/libelf.pc /usr/lib/pkgconfig
719 rm /usr/lib/libelf.a
720
721 cd /sources/
722 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
723
724 # libffi-3.4.4.tar.gz
725 cd /sources/
726 APP=libffi
727 EXTENSION=gz
728 tar xvzf $APP*.$EXTENSION
729 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
730
731 ./configure --prefix=/usr \
732 --disable-static \
733 --with-gcc-arch=native
734
735 make
736 make check
737 make install
738
739 cd /sources/
740 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
741
742 # Python-3.11.2.tar.xz
743 cd /sources/
744 APP=Python-3
745 EXTENSION=xz
746 tar xvif $APP*.$EXTENSION
747 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
748
749 ./configure --prefix=/usr \
750 --enable-shared \
751 --with-system-expat \
752 --with-system-ffi \
753 --enable-optimizations
754
755 make
756 make install
757
758 cat > /etc/pip.conf << "EOF"
759 [global]
760 root-user-action = ignore
761 disable-pip-version-check = true
762 EOF
763
764 install -v -dm755 /usr/share/doc/python-3.11.2/html
765
766 tar --strip-components=1 \
767 --no-same-owner \
768 --no-same-permissions \
769 -C /usr/share/doc/python-3.11.2/html \
770 -xvf ../python-3.11.2-docs-html.tar.bz2
771
772 cd /sources/
773 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
774
775 # wheel-0.38.4.tar.gz
776 cd /sources/
777 APP=wheel
778 EXTENSION=gz
779 tar xvzf $APP*.$EXTENSION
780 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
781
782 PYTHONPATH=src pip3 wheel -w dist --no-build-isolation --no-deps $PWD
783 pip3 install --no-index --find-links=dist wheel
784
785 cd /sources/
786 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
787
788 # ninja-1.11.1.tar.gz
789 cd /sources/
790 APP=ninja
791 EXTENSION=gz
792 tar xvzf $APP*.$EXTENSION
793 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
794
795 export NINJAJOBS=4
796
797 sed -i '/int Guess/a \
798 int j = 0;\
799 char* jobs = getenv( "NINJAJOBS" );\
800 if ( jobs != NULL ) j = atoi( jobs );\
801 if ( j > 0 ) return j;\
802 ' src/ninja.cc
803
804 python3 configure.py --bootstrap
805
806 ./ninja ninja_test
807 ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots
808
809 install -vm755 ninja /usr/bin/
810 install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja
811 install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja
812
813 cd /sources/
814 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
815
816 # meson-1.0.0.tar.gz
817 cd /sources/
818 APP=meson
819 EXTENSION=gz
820 tar xvzf $APP*.$EXTENSION
821 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
822
823 pip3 wheel -w dist --no-build-isolation --no-deps $PWD
824 pip3 install --no-index --find-links dist meson
825 install -vDm644 data/shell-completions/bash/meson /usr/share/bash-completion/completions/meson
826 install -vDm644 data/shell-completions/zsh/_meson /usr/share/zsh/site-functions/_meson
827
828 cd /sources/
829 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
830
831 # coreutils-9.1.tar.xz
832 cd /sources/
833 APP=coreutils
834 EXTENSION=xz
835 tar xvif $APP*.$EXTENSION
836 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
837
838 patch -Np1 -i ../coreutils-9.1-i18n-1.patch
839
840 autoreconf -fiv
841 FORCE_UNSAFE_CONFIGURE=1 ./configure \
842 --prefix=/usr \
843 --enable-no-install-program=kill,uptime
844
845 make
846 make NON_ROOT_USERNAME=tester check-root
847
848 echo "dummy:x:102:tester" >> /etc/group
849
850 chown -Rv tester .
851 su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"
852 sed -i '/dummy/d' /etc/group
853
854 make install
855
856 mv -v /usr/bin/chroot /usr/sbin
857 mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
858 sed -i 's/"1"/"8"/' /usr/share/man/man8/chroot.8
859
860 cd /sources/
861 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
862
863 # check-0.15.2.tar.gz
864 cd /sources/
865 APP=check
866 EXTENSION=gz
867 tar xvzf $APP*.$EXTENSION
868 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
869
870
871 ./configure --prefix=/usr --disable-static
872
873 make
874 make check
875 make docdir=/usr/share/doc/check-0.15.2 install
876
877 cd /sources/
878 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
879
880 # diffutils-3.9.tar.xz
881 cd /sources/
882 APP=diffutils
883 EXTENSION=xz
884 tar xvif $APP*.$EXTENSION
885 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
886
887 ./configure --prefix=/usr
888 make
889 make check
890 make install
891
892 cd /sources/
893 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
894
895 # gawk-5.2.1.tar.xz
896 cd /sources/
897 APP=gawk
898 EXTENSION=xz
899 tar xvif $APP*.$EXTENSION
900 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
901
902 sed -i 's/extras//' Makefile.in
903 ./configure --prefix=/usr
904 make
905 make check
906 make LN='ln -f' install
907 mkdir -pv /usr/share/doc/gawk-5.2.1
908 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-5.2.1
909
910 cd /sources/
911 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
912
913 # findutils-4.9.0.tar.xz
914 cd /sources/
915 APP=findutils
916 EXTENSION=xz
917 tar xvif $APP*.$EXTENSION
918 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
919
920 case $(uname -m) in
921 i?86) TIME_T_32_BIT_OK=yes ./configure --prefix=/usr --localstatedir=/var/lib/locate ;;
922 x86_64) ./configure --prefix=/usr --localstatedir=/var/lib/locate ;;
923 esac
924
925 make
926 chown -Rv tester .
927 su tester -c "PATH=$PATH make check"
928 make install
929
930 cd /sources/
931 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
932
933 # groff-1.22.4.tar.gz
934 cd /sources/
935 APP=groff
936 EXTENSION=gz
937 tar xvzf $APP*.$EXTENSION
938 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
939
940 PAGE=A4 ./configure --prefix=/usr
941
942 make
943 make install
944
945 cd /sources/
946 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
947
948 # grub-2.06.tar.xz
949 cd /sources/
950 APP=grub
951 EXTENSION=xz
952 tar xvif $APP*.$EXTENSION
953 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
954
955 unset {C,CPP,CXX,LD}FLAGS
956 patch -Np1 -i ../grub-2.06-upstream_fixes-1.patch
957
958 ./configure --prefix=/usr \
959 --sysconfdir=/etc \
960 --disable-efiemu \
961 --disable-werror
962
963 make
964 make install
965 mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions
966
967 cd /sources/
968 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
969
970 # gzip-1.12.tar.xz
971 cd /sources/
972 APP=gzip
973 EXTENSION=xz
974 tar xvif $APP*.$EXTENSION
975 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
976
977 ./configure --prefix=/usr
978 make
979 make check
980 make install
981
982 cd /sources/
983 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
984
985 # iproute2-6.1.0.tar.xz
986 cd /sources/
987 APP=iproute2
988 EXTENSION=xz
989 tar xvif $APP*.$EXTENSION
990 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
991
992 sed -i /ARPD/d Makefile
993 rm -fv man/man8/arpd.8
994
995 make NETNS_RUN_DIR=/run/netns
996 make SBINDIR=/usr/sbin install
997 mkdir -pv /usr/share/doc/iproute2-6.1.0
998 cp -v COPYING README* /usr/share/doc/iproute2-6.1.0
999
1000 cd /sources/
1001 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1002
1003 # kbd-2.5.1.tar.xz
1004 cd /sources/
1005 APP=kbd
1006 EXTENSION=xz
1007 tar xvif $APP*.$EXTENSION
1008 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1009
1010 patch -Np1 -i ../kbd-2.5.1-backspace-1.patch
1011
1012 sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure
1013 sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in
1014
1015 ./configure --prefix=/usr --disable-vlock
1016
1017 make
1018 make check
1019 make install
1020
1021 mkdir -pv /usr/share/doc/kbd-2.5.1
1022 cp -R -v docs/doc/* /usr/share/doc/kbd-2.5.1
1023
1024 cd /sources/
1025 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1026
1027 # libpipeline-1.5.7.tar.gz
1028 cd /sources/
1029 APP=libpipeline
1030 EXTENSION=gz
1031 tar xvzf $APP*.$EXTENSION
1032 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1033
1034 ./configure --prefix=/usr
1035 make
1036 make check
1037 make install
1038
1039 cd /sources/
1040 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1041
1042 # make-4.4.tar.gz
1043 cd /sources/
1044 APP=make
1045 EXTENSION=gz
1046 tar xvzf $APP*.$EXTENSION
1047 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1048
1049 sed -e '/ifdef SIGPIPE/,+2 d' \
1050 -e '/undef FATAL_SIG/i FATAL_SIG (SIGPIPE);' \
1051 -i src/main.c
1052
1053 ./configure --prefix=/usr
1054 make
1055 make check
1056 make install
1057
1058 cd /sources/
1059 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1060
1061 # patch-2.7.6.tar.xz
1062 cd /sources/
1063 APP=patch
1064 EXTENSION=xz
1065 tar xvif $APP*.$EXTENSION
1066 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1067
1068 ./configure --prefix=/usr
1069 make
1070 make check
1071 make install
1072
1073 cd /sources/
1074 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1075
1076 # tar-1.34.tar.xz
1077 cd /sources/
1078 APP=tar
1079 EXTENSION=xz
1080 tar xvif $APP*.$EXTENSION
1081 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1082
1083 FORCE_UNSAFE_CONFIGURE=1 \
1084 ./configure --prefix=/usr
1085
1086 make
1087 make check
1088 make install
1089 make -C doc install-html docdir=/usr/share/doc/tar-1.34
1090
1091 cd /sources/
1092 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1093
1094 # texinfo-7.0.2.tar.xz
1095 cd /sources/
1096 APP=texinfo
1097 EXTENSION=xz
1098 tar xvif $APP*.$EXTENSION
1099 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1100
1101 ./configure --prefix=/usr
1102 make
1103 make check
1104 make install
1105 make TEXMF=/usr/share/texmf install-tex
1106
1107 cd /sources/
1108 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1109
1110 # vim-9.0.1273.tar.xz
1111 cd /sources/
1112 APP=vim
1113 EXTENSION=xz
1114 tar xvif $APP*.$EXTENSION
1115 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1116
1117 echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
1118 ./configure --prefix=/usr
1119 make
1120 chown -Rv tester .
1121 su tester -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log
1122 make install
1123
1124 ln -sv vim /usr/bin/vi
1125 for L in /usr/share/man/{,*/}man1/vim.1; do
1126 ln -sv vim.1 $(dirname $L)/vi.1
1127 done
1128
1129 ln -sv ../vim/vim90/doc /usr/share/doc/vim-9.0.1273
1130
1131 cat > /etc/vimrc << "EOF"
1132 source $VIMRUNTIME/defaults.vim
1133 let skip_defaults_vim=1
1134
1135 set nocompatible
1136 set backspace=2
1137 set mouse=
1138 syntax on
1139 if (&term == "xterm") || (&term == "putty")
1140 set background=dark
1141 endif
1142
1143 EOF
1144
1145 cd /sources/
1146 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
1 # eudev-3.2.11.tar.gz
2 cd /sources/
3 APP=eudev
4 EXTENSION=gz
5 tar xvzf $APP*.$EXTENSION
6 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
7
8 sed -i '/udevdir/a udev_dir=${udevdir}' src/udev/udev.pc.in
9 ./configure --prefix=/usr \
10 --bindir=/usr/sbin \
11 --sysconfdir=/etc \
12 --enable-manpages \
13 --disable-static
14
15 make
16 mkdir -pv /usr/lib/udev/rules.d
17 mkdir -pv /etc/udev/rules.d
18
19 make check
20 make install
21
22 tar -xvf ../udev-lfs-20171102.tar.xz
23 make -f udev-lfs-20171102/Makefile.lfs install
24
25 udevadm hwdb --update
26
27 cd /sources/
28 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
29
30 # man-db-2.11.2.tar.xz
31 cd /sources/
32 APP=man-db
33 EXTENSION=xz
34 tar xvif $APP*.$EXTENSION
35 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
36
37 ./configure --prefix=/usr \
38 --docdir=/usr/share/doc/man-db-2.11.2 \
39 --sysconfdir=/etc \
40 --disable-setuid \
41 --enable-cache-owner=bin \
42 --with-browser=/usr/bin/lynx \
43 --with-vgrind=/usr/bin/vgrind \
44 --with-grap=/usr/bin/grap \
45 --with-systemdtmpfilesdir= \
46 --with-systemdsystemunitdir=
47 make
48 make check
49 make install
50
51 cd /sources/
52 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
53
54 # procps-ng-4.0.2.tar.xz
55 cd /sources/
56 APP=procps
57 EXTENSION=xz
58 tar xvif $APP*.$EXTENSION
59 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
60
61 ./configure --prefix=/usr \
62 --docdir=/usr/share/doc/procps-ng-4.0.2 \
63 --disable-static \
64 --disable-kill
65
66 make
67 make check
68 make install
69
70 cd /sources/
71 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
72
73 # util-linux-2.38.1.tar.xz
74 cd /sources/
75 APP=util-linux
76 EXTENSION=xz
77 tar xvif $APP*.$EXTENSION
78 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
79
80 ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
81 --bindir=/usr/bin \
82 --libdir=/usr/lib \
83 --sbindir=/usr/sbin \
84 --disable-chfn-chsh \
85 --disable-login \
86 --disable-nologin \
87 --disable-su \
88 --disable-setpriv \
89 --disable-runuser \
90 --disable-pylibmount \
91 --disable-static \
92 --without-python \
93 --without-systemd \
94 --without-systemdsystemunitdir \
95 --docdir=/usr/share/doc/util-linux-2.38.1
96
97 make
98 chown -Rv tester .
99 su tester -c "make -k check"
100 make install
101
102 cd /sources/
103 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
104
105 # e2fsprogs-1.47.0.tar.gz
106 cd /sources/
107 APP=e2fsprogs
108 EXTENSION=gz
109 tar xvzf $APP*.$EXTENSION
110 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
111
112 mkdir -v build
113 cd build
114
115 ../configure --prefix=/usr \
116 --sysconfdir=/etc \
117 --enable-elf-shlibs \
118 --disable-libblkid \
119 --disable-libuuid \
120 --disable-uuidd \
121 --disable-fsck
122
123 make
124 make check
125 make install
126 rm -fv /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
127 gunzip -v /usr/share/info/libext2fs.info.gz
128 install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info
129 makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo
130 install -v -m644 doc/com_err.info /usr/share/info
131 install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info
132 sed 's/metadata_csum_seed,//' -i /etc/mke2fs.conf
133
134 cd /sources/
135 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
136
137 # sysklogd-1.5.1.tar.gz
138 cd /sources/
139 APP=sysklogd
140 EXTENSION=gz
141 tar xvzf $APP*.$EXTENSION
142 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
143
144 sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c
145 sed -i 's/union wait/int/' syslogd.c
146
147 make
148 make BINDIR=/sbin install
149
150 cat > /etc/syslog.conf << "EOF"
151 auth,authpriv.* -/var/log/auth.log
152 *.*;auth,authpriv.none -/var/log/sys.log
153 daemon.* -/var/log/daemon.log
154 kern.* -/var/log/kern.log
155 mail.* -/var/log/mail.log
156 user.* -/var/log/user.log
157 *.emerg *
158 EOF
159
160 cd /sources/
161 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
162
163 # sysvinit-3.06.tar.xz
164 cd /sources/
165 APP=sysvinit
166 EXTENSION=xz
167 tar xvif $APP*.$EXTENSION
168 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
169
170 patch -Np1 -i ../sysvinit-3.06-consolidated-1.patch
171 make
172 make install
173
174 cd /sources/
175 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
176
177 # Stripping
178 save_usrlib="$(cd /usr/lib; ls ld-linux*[^g])
179 libc.so.6
180 libthread_db.so.1
181 libquadmath.so.0.0.0
182 libstdc++.so.6.0.30
183 libitm.so.1.0.0
184 libatomic.so.1.2.0"
185
186 cd /usr/lib
187
188 for LIB in $save_usrlib; do
189 objcopy --only-keep-debug $LIB $LIB.dbg
190 cp $LIB /tmp/$LIB
191 strip --strip-unneeded /tmp/$LIB
192 objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB
193 install -vm755 /tmp/$LIB /usr/lib
194 rm /tmp/$LIB
195 done
196
197 online_usrbin="bash find strip"
198 online_usrlib="libbfd-2.40.so
199 libsframe.so.0.0.0
200 libhistory.so.8.2
201 libncursesw.so.6.4
202 libm.so.6
203 libreadline.so.8.2
204 libz.so.1.2.13
205 $(cd /usr/lib; find libnss*.so* -type f)"
206
207 for BIN in $online_usrbin; do
208 cp /usr/bin/$BIN /tmp/$BIN
209 strip --strip-unneeded /tmp/$BIN
210 install -vm755 /tmp/$BIN /usr/bin
211 rm /tmp/$BIN
212 done
213
214 for LIB in $online_usrlib; do
215 cp /usr/lib/$LIB /tmp/$LIB
216 strip --strip-unneeded /tmp/$LIB
217 install -vm755 /tmp/$LIB /usr/lib
218 rm /tmp/$LIB
219 done
220
221 for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \
222 $(find /usr/lib -type f -name \*.a) \
223 $(find /usr/{bin,sbin,libexec} -type f); do
224 case "$online_usrbin $online_usrlib $save_usrlib" in
225 *$(basename $i)* )
226 ;;
227 * ) strip --strip-unneeded $i
228 ;;
229 esac
230 done
231
232 unset BIN LIB save_usrlib online_usrbin online_usrlib
233
234 # Cleaning Up
235 rm -rf /tmp/*
236 find /usr/lib /usr/libexec -name \*.la -delete
237 find /usr -depth -name $(uname -m)-lfs-linux-gnu\* | xargs rm -rf
238 userdel -r tester
239
240 # lfs-bootscripts-20230101.tar.xz
241 cd /sources/
242 APP=lfs-bootscripts
243 EXTENSION=xz
244 tar xvif $APP*.$EXTENSION
245 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
246
247 make install
248
249 cd /sources/
250 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
251
252 bash /usr/lib/udev/init-net-rules.sh
253 cat /etc/udev/rules.d/70-persistent-net.rules
254
255 cat > /etc/sysconfig/ifconfig.eth0 << "EOF"
256 ONBOOT=yes
257 IFACE=eth0
258 SERVICE=ipv4-static
259 IP=192.168.1.2
260 GATEWAY=192.168.1.1
261 PREFIX=24
262 BROADCAST=192.168.1.255
263 EOF
264
265 cat > /etc/resolv.conf << "EOF"
266 domain <Your Domain Name>
267 nameserver <IP address of your primary nameserver>
268 nameserver <IP address of your secondary nameserver>
269 EOF
270
271 echo "vitux" > /etc/hostname
272
273 cat > /etc/hosts << "EOF"
274 127.0.0.1 localhost.localdomain localhost
275 127.0.1.1 vitux.bitarus.mooo.com
276 ::1 localhost ip6-localhost ip6-loopback
277 ff02::1 ip6-allnodes
278 ff02::2 ip6-allrouters
279 EOF
280
281 cat > /etc/inittab << "EOF"
282 id:3:initdefault:
283 si::sysinit:/etc/rc.d/init.d/rc S
284 l0:0:wait:/etc/rc.d/init.d/rc 0
285 l1:S1:wait:/etc/rc.d/init.d/rc 1
286 l2:2:wait:/etc/rc.d/init.d/rc 2
287 l3:3:wait:/etc/rc.d/init.d/rc 3
288 l4:4:wait:/etc/rc.d/init.d/rc 4
289 l5:5:wait:/etc/rc.d/init.d/rc 5
290 l6:6:wait:/etc/rc.d/init.d/rc 6
291 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
292 su:S06:once:/sbin/sulogin
293 s1:1:respawn:/sbin/sulogin
294 1:2345:respawn:/sbin/agetty --noclear tty1 9600
295 2:2345:respawn:/sbin/agetty tty2 9600
296 3:2345:respawn:/sbin/agetty tty3 9600
297 4:2345:respawn:/sbin/agetty tty4 9600
298 5:2345:respawn:/sbin/agetty tty5 9600
299 6:2345:respawn:/sbin/agetty tty6 9600
300 EOF
301
302 cat > /etc/sysconfig/clock << "EOF"
303 UTC=1
304 # Set this to any options you might need to give to hwclock,
305 # such as machine hardware clock type for Alphas.
306 CLOCKPARAMS=
307 EOF
308
309 cat > /etc/sysconfig/console << "EOF"
310 KEYMAP="pt-latin1"
311 FONT="lat1-16 -m 8859-1"
312 UNICODE="1"
313 EOF
314
315 locale -a
316 locale -a | grep -i pt
317 kk_KZ.pt154
318 pt_BR
319 pt_BR.iso88591
320 pt_BR.utf8
321 pt_PT
322 pt_PT.iso88591
323 pt_PT.iso885915@euro
324 pt_PT.utf8
325 pt_PT@euro
326
327 cat > /etc/profile << "EOF"
328 export LANG=pt_PT.utf8
329 EOF
330
331 cat > /etc/inputrc << "EOF"
332 # Modified by Chris Lynn <roryo@roryo.dynup.net>
333 # Allow the command prompt to wrap to the next line
334 set horizontal-scroll-mode Off
335 # Enable 8-bit input
336 set meta-flag On
337 set input-meta On
338 # Turns off 8th bit stripping
339 set convert-meta Off
340 # Keep the 8th bit for display
341 set output-meta On
342 # none, visible or audible
343 set bell-style none
344 # All of the following map the escape sequence of the value
345 # contained in the 1st argument to the readline specific functions
346 "\eOd": backward-word
347 "\eOc": forward-word
348 # for linux console
349 "\e[1~": beginning-of-line
350 "\e[4~": end-of-line
351 "\e[5~": beginning-of-history
352 "\e[6~": end-of-history
353 "\e[3~": delete-char
354 "\e[2~": quoted-insert
355 # for xterm
356 "\eOH": beginning-of-line
357 "\eOF": end-of-line
358 # for Konsole
359 "\e[H": beginning-of-line
360 "\e[F": end-of-line
361 EOF
362
363 cat > /etc/shells << "EOF"
364 /bin/sh
365 /bin/bash
366 EOF
367
368 cat > /etc/fstab << "EOF"
369 # file-system mount-point type options dump fsck
370 # order
371
372 #/dev/<xxx> / <fff> defaults 1 1
373 #/dev/<yyy> swap swap pri=1 0 0
374 proc /proc proc nosuid,noexec,nodev 0 0
375 sysfs /sys sysfs nosuid,noexec,nodev 0 0
376 devpts /dev/pts devpts gid=5,mode=620 0 0
377 tmpfs /run tmpfs defaults 0 0
378 devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
379 tmpfs /dev/shm tmpfs nosuid,nodev 0 0
380 EOF
381
382 # linux-6.1.11.tar.xz
383 cd /sources/
384 APP=linux
385 EXTENSION=xz
386 tar xvif $APP*.$EXTENSION
387 cd $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
388
389 make mrproper
390 make menuconfig
391
392 # Processor type and features --->
393 # [*] Build a relocatable kernel [CONFIG_RELOCATABLE]
394 # [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE]
395 # General setup --->
396 # [ ] Compile the kernel with warnings as errors [CONFIG_WERROR]
397 # < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS]
398 # General architecture-dependent options --->
399 # [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR]
400 # [*] Strong Stack Protector [CONFIG_STACKPROTECTOR_STRONG]
401 # Device Drivers --->
402 # Graphics support --->
403 # Frame buffer Devices --->
404 # <*> Support for frame buffer devices --->
405 # Console display driver support --->
406 # [*] Framebuffer Console support [CONFIG_FRAMEBUFFER_CONSOLE]
407 # Generic Driver Options --->
408 # [ ] Support for uevent helper [CONFIG_UEVENT_HELPER]
409 # [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS]
410 # [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs [CONFIG_DEVTMPFS_MOUNT]
411 # Processor type and features --->
412 # [*] Support x2apic [CONFIG_X86_X2APIC]
413 # Device Drivers --->
414 # [*] PCI Support ---> [CONFIG_PCI]
415 # [*] Message Signaled Interrupts (MSI and MSI-X) [CONFIG_PCI_MSI]
416 # [*] IOMMU Hardware Support ---> [CONFIG_IOMMU_SUPPORT]
417 # [*] Support for Interrupt Remapping [CONFIG_IRQ_REMAP]
418
419 /sources/linux-6.1.11# find . -name .config
420 ./.config
421
422 cat .config | grep -e CONFIG_IRQ_REMAP -e CONFIG_IOMMU_SUPPORT=y -e CONFIG_PCI_MSI=y -e CONFIG_PCI=y -e CONFIG_X86_X2APIC=y \
423 -e CONFIG_DEVTMPFS_MOUNT -e CONFIG_DEVTMPFS=y -e CONFIG_UEVENT_HELPER -e CONFIG_FRAMEBUFFER_CONSOLE=y \
424 -e CONFIG_STACKPROTECTOR=y -e CONFIG_STACKPROTECTOR_STRONG=y -e CONFIG_RELOCATABLE=y -e CONFIG_RANDOMIZE_BASE=y \
425 -e CONFIG_WERROR -e CONFIG_IKHEADERS
426
427 # # CONFIG_WERROR is not set
428 # # CONFIG_IKHEADERS is not set
429 # CONFIG_RELOCATABLE=y
430 # CONFIG_RANDOMIZE_BASE=y
431 # CONFIG_STACKPROTECTOR=y
432 # CONFIG_STACKPROTECTOR_STRONG=y
433 # CONFIG_PCI=y
434 # CONFIG_PCI_MSI=y
435 # # CONFIG_UEVENT_HELPER is not set
436 # CONFIG_DEVTMPFS=y
437 # CONFIG_DEVTMPFS_MOUNT=y
438 # CONFIG_FRAMEBUFFER_CONSOLE=y
439 # CONFIG_IOMMU_SUPPORT=y
440 # CONFIG_IRQ_REMAP=y
441
442 # https://www.linuxfromscratch.org/hints/downloads/files/kernel-configuration.txt
443
444 make help
445 make
446 make modules_install
447
448 cp -iv arch/x86/boot/bzImage /boot/vmlinuz-6.1.11-lfs-11.3
449 cp -iv System.map /boot/System.map-6.1.11
450 cp -iv .config /boot/config-6.1.11
451 install -d /usr/share/doc/linux-6.1.11
452 cp -r Documentation/* /usr/share/doc/linux-6.1.11
453
454 install -v -m755 -d /etc/modprobe.d
455
456 cat > /etc/modprobe.d/usb.conf << "EOF"
457 install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
458 install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
459 EOF
460
461 cd $LFS/sources/
462 rm -rf $(ls $APP*$EXTENSION | sed 's/\.tar//g' | sed "s/\.$EXTENSION//g" )
463
464 echo 11.3 > /etc/lfs-release
465
466 cat > /etc/lsb-release << "EOF"
467 DISTRIB_ID="Linux From Scratch"
468 DISTRIB_RELEASE="11.3"
469 DISTRIB_CODENAME="Vitux"
470 DISTRIB_DESCRIPTION="Linux From Scratch"
471 EOF
472
473 cat > /etc/os-release << "EOF"
474 NAME="Linux From Scratch"
475 VERSION="11.3"
476 ID=lfs
477 PRETTY_NAME="Linux From Scratch 11.3"
478 VERSION_CODENAME="Vitux"
479 EOF
480
481 cd / # as chroot
482 du . -hs
483 # 2.0G
484 du sources/ -hs
485 # 603M sources/
486 sh version-check.sh
487
488 # To make a backup, leave the chroot environment:
489 exit
490 mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm
491 umount $LFS/dev/pts
492 umount $LFS/{sys,proc,run,dev}
493 LFS=/home/vagrant/lfs
494 echo $LFS
495 cd $LFS
496 time tar -cJpf /root/lfs-build-11.3.tar.xz .
497 # real 17m18.550s
498 tar tvaf /root/lfs-build-11.3.tar.xz
499 # -p, --preserve-permissions
500 # -f, --file=ARCHIVE
501 # -J, --xz Filter the archive through xz
502
503 scp lfs*xz xyz@xyz.com:/media/LFS/
Add partition in VM to host LFS build
1 # Add dymamic disk 8 GB to debian built with vagrant ....
2 vagrant halt
3 # VirtualBox, debian VM, settings storage sata add hard disk
4 # Create VDI dynamically allocated with 8 GB
5 vagrant up
6 # sd 2:0:0:0: [sdb] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB)
7 sudo cfdisk /dev/sdb
8 # label type gpt
9 # new 8GB linux fs
10 # write yes quit
11 sudo mkfs -v -t ext4 /dev/sdb1
12 export LFS=/mnt/lfs
13 sudo mkdir -pv $LFS
14 sudo mount -v -t ext4 /dev/sdb1 $LFS
15 sudo bash
16
17 # change fstab in debian host
18 cat >>/etc/fstab << "EOF"
19 /dev/sdb1 /mnt/lfs ext4 defaults 1 1
20 EOF
21
22 exit
23 sudo bash
24 export LFS=/mnt/lfs
25 cd ~
26 cp lfs-build-11.3.tar.xz $LFS
27
28 cd $LFS
29 rm -rf ./*
30 tar -xpf /root/lfs-build-11.3.tar.xz
31 ls
32 chown root:root $LFS/*
33 cat $LFS/etc/inittab
34 cat $LFS/etc/fstab
35
36 # Update LFS fstab
37 cat >>$LFS/etc/fstab << "EOF"
38 /dev/sdb1 / ext4 defaults 1 1
39 EOF
40
41 # Update debian grub to have an entry to LFS
42 cat >>/etc/grub.d/40_custom << "EOF"
43 menuentry "GNU/Linux, Linux 6.1.11-lfs-11.3" {
44 linux /boot/vmlinuz-6.1.11-lfs-11.3 root=/dev/sdb1 ro
45 }
46 EOF
47
48 update-grub
49
50 vagrant reload
51 # select grun entry for lfs
52 # login with root:root
53 df -h # uses 2.7G
54 rm lfs-build-11.3.tar.xz
55 rm -rf sources/*
56 df -h # uses 1.4 GB
57
initramfs with static program
https://www.kernel.org/doc/html/latest/filesystems/ramfs-rootfs-initramfs.html#contents-of-initramfs
A good first step is to get initramfs to run a statically linked "hello world" program as init
1 sudo apt install qemu-system genisoimage
2
3 cd /tmp
4 wget https://saimei.ftp.acc.umu.se/debian-cd/current/amd64/iso-cd/debian-12.1.0-amd64-netinst.iso
5 sudo mount -o loop /vagrant/debian-12.1.0-amd64-netinst.iso /mnt/iso
6
7 # reuse isolinux from debian iso
8 mkdir /tmp/debiancd
9 mkdir /tmp/debiancd/isolinux
10 mkdir /tmp/debiancd/install.amd
11 cd /mnt/iso
12 cp isolinux/isolinux.cfg isolinux/*c32 isolinux/menu.cfg isolinux/txt.cfg /tmp/debiancd/isolinux
13 cp install.amd/initrd.gz install.amd/vmlinuz /tmp/debiancd/install.amd/
14 cp /mnt/iso/isolinux/isolinux.bin /tmp/debiancd/isolinux/
15
16 # isolinux.cfg
17 cat > debiancd/isolinux/isolinux.cfg << EOF
18 default bootcd
19 prompt 1
20 timeout 40
21
22 label bootcd
23 kernel /install.amd/vmlinuz
24 append initrd=/install.amd/test.cpio.gz vga=788
25 EOF
26
27 # hello.c
28 cat > hello.c << EOF
29 #include <stdio.h>
30 #include <unistd.h>
31
32 int main(int argc, char *argv[])
33 {
34 printf("Hello world!\n");
35 sleep(999999999);
36 }
37 EOF
38 gcc -static hello.c -o init
39
40 # build cpio initramfs
41 echo init | cpio -o -H newc | gzip > test.cpio.gz
42 cp test.cpio.gz debiancd/install.amd/test.cpio.gz
43
44 cd /tmp/
45 mkisofs -o /tmp/output.iso -R -l -L -D -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V "LFS_$(date +%Y%m%d)" /tmp/debiancd/
46 rm /vagrant/output.iso
47 cp output.iso /vagrant
48
49 # the output.iso can be launched in VirtualBox booting the iso in a VM Other Linux, Linux 64 bit
50
51 # test with qemu
52 qemu-system-x86_64 -kernel debiancd/install.amd/vmlinuz -initrd test.cpio.gz /dev/zero
53 # test with qemu with kernel in debian system
54 qemu-system-x86_64 -kernel /boot/vmlinuz-5.10.0-22-amd64 -initrd test.cpio.gz /dev/zero
55 # test with qemu with kernel from lfs
56 qemu-system-x86_64 -kernel /home/vagrant/lfs/boot/lfskernel -initrd test.cpio.gz /dev/zero
57 # test with qemu with kernel from lfs
58 qemu-system-x86_64 -kernel /home/vagrant/lfs/boot/vmlinuz-6.1.11-lfs-11.3 -initrd test.cpio.gz /dev/zero
Hello world USB boot
Build install-mbr
create-usb-boot-hello-world.sh
Create a FAT16 partition using cfdisk /dev/sdX. We can find the right device using dmesg or lsblk commands.
1 lsblk
2 read -p "Target device: " DEVICE
3 echo "Install MBR on device $DEVICE"
4 read -p "Enter to continue"
5 install-mbr $DEVICE --force
6
7 PARTITION=${DEVICE}1
8 echo "Format $PARTITION"
9 read -p "Enter to continue"
10 # create an MS-DOS FAT filesystem
11 mkdosfs $PARTITION
12 echo "Install syslinux"
13 read -p "Enter to continue"
14 # install the SYSLINUX bootloader on a FAT filesystem
15 syslinux $PARTITION
16
17 echo "Build ramfs"
18 rm -rf ramfs/
19 mkdir ramfs
20 cd ramfs
21
22 cat > hello.c << EOF
23 #include <dirent.h>
24 #include <stdio.h>
25 #include <unistd.h>
26 #include <string.h>
27
28 int main(void) {
29 char data[256];
30 DIR *d;
31 struct dirent *dir;
32 printf("Hello world!\n");
33
34 d = opendir("/dev");
35 if (d) {
36 while ((dir = readdir(d)) != NULL) {
37 printf("%s\n", dir->d_name);
38 }
39 closedir(d);
40 }
41 int loop=1;
42 while(loop == 1){
43 printf("> ");
44 scanf("%s",data);
45 printf("<%s>\n", data);
46 if( strcmp("exit",data) == 0) loop=0;
47 }
48 // sleep(3600);
49 return(0);
50 }
51 EOF
52 # compile static code
53 gcc -static hello.c -o init
54 # build cpio gz
55 find . | cpio -H newc -o | gzip > ../ramfs.gz
56 # copy data to initramfs
57 mount $PARTITION /mnt
58 cd /mnt
59 cat > syslinux.cfg << EOF
60 default vmlinuz
61 append initrd=initrd.gz init=/init
62 EOF
63
64 cp /boot/vmlinuz vmlinuz # slackware kernel
65 #cp /root/vmlinuz-6.1.11-lfs-11.3 vmlinuz
66 cp /root/ramfs.gz initrd.gz
67 ls .
68 cd ~
69 umount /mnt/
70 sync