自动化编译LFS/JHALFS记录
LFS (Linux from Scratch)
从源代码编译Linux系统
JHALFS 自动化编译
使用版本
$ git clone http://mygit.hll:3000/LFS/jhalfs
$ git log
commit 2e3565363048fddebaa69cc6b96d8a0015e2cffe (HEAD -> trunk, origin/trunk, origin/HEAD)
...
也尝试过2.4版本,发现有bug后放弃。
开始
- 需要lfs用户,并赋予它sudo NOPASSWD权限
cd jhalfs && time make
配置构建路径与下载源代码Loaded configuration 'configuration' No changes to save (for 'configuration') Do you want to run jhalfs? yes/no (yes): Loading config params from <configuration>...OK Loading file common/common-functions...OK Loading file common/libs/func_book_parser...OK Loading file common/libs/func_download_pkgs...OK Loading file common/libs/func_wrt_Makefile...OK Loading file LFS/master.sh...OK ------------------------------------------------------------------------------ Loading file common/libs/func_check_version.sh...OK Loading file common/libs/func_validate_configs.sh...OK Loading file common/libs/func_custom_pkgs...OK ------------------------------------------------------------------------------ Checking tools required for jhalfs SUDO <1.9.5p2> OK (Min version: 1.7.0) WGET <1.21> OK (Min version: 1.0.0) LIBXML2 <2.09.10> OK (Min version: 2.06.20) LIBXSLT <1.01.34> OK (Min version: 1.01.14) DocBook XML DTD <4.5> OK (Min version: 4.5) DocBook XSL stylesheets <current> OK (Min version: current) ------------------------------------------------------------------------------ BOOK <build_dir/jhalfs/lfs-development> CUSTOM_TOOLS <n> INITSYS <systemd> BLFS_TOOL <n> LUSER <lfs> LGROUP <lfs> LHOME </home> BUILDDIR <build_dir> CLEAN <n> GETPKG <y> SRC_ARCHIVE <> <-- NO directory name given SERVER <http://ftp.osuosl.org> RETRYSRCDOWNLOAD <> RETRYDOWNLOADCNT <20> DOWNLOADTIMEOUT <30> RUNMAKE <n> TEST <0> STRIP <n> NCURSES5 <n> DEL_LA_FILES <y> FSTAB <> CONFIG <> TIMEZONE <GMT> PAGE <letter> LANG <zh_CN.UTF-8> INSTALL_LOG <n> PKGMNGT <n> FULL_LOCALE <y> WRAP_INSTALL <n> HOSTNAME <**EDITME**> INTERFACE <eth0> IP_ADDR <10.0.2.9> GATEWAY <10.0.2.2> PREFIX <24> BROADCAST <10.0.2.255> DOMAIN <local> DNS1 <10.0.2.3> DNS2 <8.8.8.8> FONT <lat0-16> KEYMAP <us> LOCAL <n> LOG_LEVEL <> COMPARE <n> OPTIMIZE <0> SAVE_CH5 <n> REPORT <n> REBUILD_MAKEFILE <n> *** lfs config parameters look good *** ------------------------------------------------------------------------------ Are you happy with these settings? yes/no (no): yes ------------------------------------------------------------------------------ Downloading the lfs document, development version... done Extracting commands for <LFS> build... done Creating <lfs> list of tarball names for build_dir/jhalfs/lfs-development... done Creating chroot commands scripts from build_dir/jhalfs/lfs-development... done Creating virtual kernel FS commands scripts from build_dir/jhalfs/lfs-development... done Creating LFS specific URLs file ...OK acl-2.3.1.tar.xz: using cached file in build_dir/sources attr-2.5.1.tar.gz: using cached file in build_dir/sources autoconf-2.71.tar.xz: using cached file in build_dir/sources automake-1.16.5.tar.xz: using cached file in build_dir/sources bash-5.1.16.tar.gz: using cached file in build_dir/sources bc-5.2.1.tar.xz: using cached file in build_dir/sources binutils-2.37.tar.xz: using cached file in build_dir/sources bison-3.8.2.tar.xz: using cached file in build_dir/sources bzip2-1.0.8.tar.gz: using cached file in build_dir/sources check-0.15.2.tar.gz: using cached file in build_dir/sources coreutils-9.0.tar.xz: using cached file in build_dir/sources dbus-1.12.20.tar.gz: using cached file in build_dir/sources dejagnu-1.6.3.tar.gz: using cached file in build_dir/sources diffutils-3.8.tar.xz: using cached file in build_dir/sources e2fsprogs-1.46.5.tar.gz: using cached file in build_dir/sources elfutils-0.186.tar.bz2: using cached file in build_dir/sources expat-2.4.4.tar.xz: using cached file in build_dir/sources expect5.45.4.tar.gz: using cached file in build_dir/sources file-5.41.tar.gz: using cached file in build_dir/sources findutils-4.9.0.tar.xz: using cached file in build_dir/sources flex-2.6.4.tar.gz: using cached file in build_dir/sources gawk-5.1.1.tar.xz: using cached file in build_dir/sources gcc-11.2.0.tar.xz: using cached file in build_dir/sources gdbm-1.23.tar.gz: using cached file in build_dir/sources gettext-0.21.tar.xz: using cached file in build_dir/sources glibc-2.35.tar.xz: using cached file in build_dir/sources gmp-6.2.1.tar.xz: using cached file in build_dir/sources gperf-3.1.tar.gz: using cached file in build_dir/sources grep-3.7.tar.xz: using cached file in build_dir/sources groff-1.22.4.tar.gz: using cached file in build_dir/sources grub-2.06.tar.xz: using cached file in build_dir/sources gzip-1.11.tar.xz: using cached file in build_dir/sources iana-etc-20220128.tar.gz: using cached file in build_dir/sources inetutils-2.2.tar.xz: using cached file in build_dir/sources intltool-0.51.0.tar.gz: using cached file in build_dir/sources iproute2-5.16.0.tar.xz: using cached file in build_dir/sources Jinja2-3.0.3.tar.gz: using cached file in build_dir/sources kbd-2.4.0.tar.xz: using cached file in build_dir/sources kmod-29.tar.xz: using cached file in build_dir/sources less-590.tar.gz: using cached file in build_dir/sources libcap-2.63.tar.xz: using cached file in build_dir/sources libffi-3.4.2.tar.gz: using cached file in build_dir/sources libpipeline-1.5.5.tar.gz: using cached file in build_dir/sources libtool-2.4.6.tar.xz: using cached file in build_dir/sources linux-5.16.5.tar.xz: using cached file in build_dir/sources m4-1.4.19.tar.xz: using cached file in build_dir/sources make-4.3.tar.gz: using cached file in build_dir/sources man-db-2.10.0.tar.xz: using cached file in build_dir/sources man-pages-5.13.tar.xz: using cached file in build_dir/sources MarkupSafe-2.0.1.tar.gz: using cached file in build_dir/sources meson-0.61.1.tar.gz: using cached file in build_dir/sources mpc-1.2.1.tar.gz: using cached file in build_dir/sources mpfr-4.1.0.tar.xz: using cached file in build_dir/sources ncurses-6.3.tar.gz: using cached file in build_dir/sources ninja-1.10.2.tar.gz: using cached file in build_dir/sources openssl-3.0.1.tar.gz: using cached file in build_dir/sources patch-2.7.6.tar.xz: using cached file in build_dir/sources perl-5.34.0.tar.xz: using cached file in build_dir/sources pkg-config-0.29.2.tar.gz: using cached file in build_dir/sources procps-ng-3.3.17.tar.xz: using cached file in build_dir/sources psmisc-23.4.tar.xz: using cached file in build_dir/sources Python-3.10.2.tar.xz: using cached file in build_dir/sources python-3.10.2-docs-html.tar.bz2: using cached file in build_dir/sources readline-8.1.2.tar.gz: using cached file in build_dir/sources sed-4.8.tar.xz: using cached file in build_dir/sources shadow-4.11.1.tar.xz: using cached file in build_dir/sources systemd-250.tar.gz: using cached file in build_dir/sources systemd-man-pages-250.tar.xz: using cached file in build_dir/sources tar-1.34.tar.xz: using cached file in build_dir/sources tcl8.6.12-src.tar.gz: using cached file in build_dir/sources tcl8.6.12-html.tar.gz: using cached file in build_dir/sources texinfo-6.8.tar.xz: using cached file in build_dir/sources tzdata2021e.tar.gz: using cached file in build_dir/sources util-linux-2.37.3.tar.xz: using cached file in build_dir/sources vim-8.2.4236.tar.gz: using cached file in build_dir/sources XML-Parser-2.46.tar.gz: using cached file in build_dir/sources xz-5.2.5.tar.xz: using cached file in build_dir/sources zlib-1.2.11.tar.xz: using cached file in build_dir/sources zstd-1.5.2.tar.gz: using cached file in build_dir/sources binutils-2.37-upstream_fix-1.patch: using cached file in build_dir/sources bzip2-1.0.8-install_docs-1.patch: using cached file in build_dir/sources coreutils-9.0-i18n-1.patch: using cached file in build_dir/sources coreutils-9.0-chmod_fix-1.patch: using cached file in build_dir/sources glibc-2.35-fhs-1.patch: using cached file in build_dir/sources kbd-2.4.0-backspace-1.patch: using cached file in build_dir/sources perl-5.34.0-upstream_fixes-1.patch: using cached file in build_dir/sources systemd-250-upstream_fixes-1.patch: using cached file in build_dir/sources ------------------------------------------------------------------------------ Creating Makefile... START Processing... <Chapter 4> Processing... <Chapter 5> Processing... <Chapter 6> Processing... <Chapter 7> Processing... <Chapter 8> Processing... <Chapter 9> Processing... <Chapter 10> Creating Makefile... DONE ------------------------------------------------------------------------------ KERNEL <5.10.0-11-amd64> OK (Min version: 3.2) BASH <5.1.4(1)-release> OK (Min version: 3.2) GCC <10.2.1> OK (Min version: 6.2) G++ <10.2.1> OK (Min version: 6.2) GLIBC <2.31> OK (Min version: 2.11) BINUTILS <2.35.2> OK (Min version: 2.25) TAR <1.34> OK (Min version: 1.22) BZIP2 <1.0.8> OK (Min version: 1.0.4) BISON <3.7.5> OK (Min version: 2.7) COREUTILS <8.32> OK (Min version: 6.9) DIFF <3.7> OK (Min version: 2.8.1) FIND <4.8.0> OK (Min version: 4.2.31) GAWK <5.1.0> OK (Min version: 4.0.1) GREP <3.6> OK (Min version: 2.5.1a) GZIP <1.10> OK (Min version: 1.3.12) M4 <1.4.18> OK (Min version: 1.4.10) MAKE <4.3> OK (Min version: 4.0) PATCH <2.7.6> OK (Min version: 2.5.4) PERL <5.32.1> OK (Min version: 5.8.8) SED <4.7> OK (Min version: 4.1.5) TEXINFO <6.7> OK (Min version: 4.7) XZ <5.2.5> OK (Min version: 5.0.0) PYTHON <3.9.2> OK (Min version: 3.4) ------------------------------------------------------------------------------ <jhalfs> exit real 0m18.071s user 0m10.310s sys 0m1.227s
build_dir$ tree -d -L 3 . ├── bin -> usr/bin ├── etc ├── jhalfs │ ├── lfs-commands # 生成的编译脚本 │ │ ├── chapter04 │ │ ├── chapter05 │ │ ├── chapter06 │ │ ├── chapter07 │ │ ├── chapter08 │ │ ├── chapter09 │ │ └── chapter10 │ ├── lfs-development # git clone git://git.linuxfromscratch.org/jhalfs.git lfs-development ├── chroot-scripts ├── lib -> usr/lib ├── lib64 ├── sbin -> usr/sbin ├── sources # 源码目录 ├── tools ├── usr └── var
cd build_dir/jhalfs && make
-------------------------------------------------------------------------------- Finished the build of r11.0-160-systemd -------------------------------------------------------------------------------- W A R N I N G -------------------------------------------------------------------------------- To be able to boot your new system you need to follow the next steps: - Mount the virtual kernel file systems. - Enter to the chroot using the command found in the section -Entering the Chroot Environment- except if building CLFS with METHOD=boot. - Set a password for the root user. - Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock, /etc/sysconfig/console, /etc/sysconfig/network, /etc/sysconfig/ifconfig.eth0, /etc/resolv.conf and any other configuration file required to suit your needs. - Set-up the boot loader, except if building CLFS with METHOD=boot. You can set-up the new boot-loader installed on the new system or the host bootloader. If the last, it is better to exit first from the chroot. - Exit from the chroot and umount the filesystems. If you are an experienced LFS user, several of those steps can be skipped or done in a different way. But then, that is something that you already know and there is no need to discuss it here. -------------------------------------------------------------------------------- Have a nice day :-) --------------------------------------------------------------------------------
- 上一步完成到了lfs文档的第10章的/etc/fstab小节,之后收尾工作需要手工来做,包括编译内核与GRUB等。
可以看出来整个过程中第2步最为重要,包括CLFS/BLFS以及自定义修改都在第2步中完成。