首页 > 系统相关 >LFS(Linux From Scratch)构建过程全记录(一):准备工作

LFS(Linux From Scratch)构建过程全记录(一):准备工作

时间:2022-09-06 12:12:12浏览次数:87  
标签:bin head -- Scratch 全记录 echo version LFS n1

写在前面

本人修学了一门课,名曰《操作系统课程设计》,其任务为基于LFS以编译源代码的方式制作一个基本的Linux操作系统,并且编写在linux下的GUI软件。

本操作系统构建的全过程将分为若干章节,在我的博客中进行记录。

 

基本配置信息

物理机操作系统: Windows 10  , 操作系统内部版本19043.1889

物理机配置: I5-1135G7,16G LPDDR4, 512G SSD

虚拟机版本: Vmware WorkStation Pro 16.2.3 build-19376536

虚拟机操作系统: Ubuntu 16.04 LTS

虚拟机配置: 4核 4GB内存 20GB磁盘

 

 环境准备

在LFS-BOOK-11.2中,提到了需要进行一系列的插件的版本准备

需要进行检查的插件如下:

 

 1 • Bash-3.2 (/bin/sh should be a symbolic or hard link to bash)
 2 • Binutils-2.13.1 (Versions greater than 2.39 are not recommended as they have not been tested)
 3 • Bison-2.7 (/usr/bin/yacc should be a link to bison or small script that executes bison)
 4 • Coreutils-6.9
 5 • Diffutils-2.8.1
 6 • Findutils-4.2.31
 7 • Gawk-4.0.1 (/usr/bin/awk should be a link to gawk)
 8 • GCC-4.8 including the C++ compiler, g++ (Versions greater than 12.2.0 are not recommended as they have not
 9 been tested). C and C++ standard libraries (with headers) must also be present so the C++ compiler can build
10 hosted programs
11 • Grep-2.5.1a
12 • Gzip-1.3.12
13 • Linux Kernel-3.2
14 The reason for the kernel version requirement is that we specify that version when building glibc in Chapter 5 and
15 Chapter 8, at the recommendation of the developers. It is also required by udev.
16 If the host kernel is earlier than 3.2 you will need to replace the kernel with a more up to date version. There
17 are two ways you can go about this. First, see if your Linux vendor provides a 3.2 or later kernel package. If so,
18 you may wish to install it. If your vendor doesn't offer an acceptable kernel package, or you would prefer not to
19 install it, you can compile a kernel yourself. Instructions for compiling the kernel and configuring the boot loader
20 (assuming the host uses GRUB) are located in Chapter 10.
21 • M4-1.4.10
22 • Make-4.0
23 • Patch-2.5.4
24 • Perl-5.8.8
25 • Python-3.4
26 • Sed-4.1.5
27 • Tar-1.22
28 • Texinfo-4.7
29 • Xz-5.0.0

 

 

在LFS-BOOK中,它贴心地准备了一个用于版本检查的bash脚本

我们打开终端,直接在终端中粘贴下面的脚本,按下回车即可自动执行

 1 cat > version-check.sh << "EOF"
 2 #!/bin/bash
 3 # Simple script to list version numbers of critical development tools
 4 export LC_ALL=C
 5 bash --version | head -n1 | cut -d" " -f2-4
 6 MYSH=$(readlink -f /bin/sh)
 7 echo "/bin/sh -> $MYSH"
 8 echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
 9 unset MYSH
10 echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
11 bison --version | head -n1
12 if [ -h /usr/bin/yacc ]; then
13  echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
14 elif [ -x /usr/bin/yacc ]; then
15  echo yacc is `/usr/bin/yacc --version | head -n1`
16 else
17  echo "yacc not found"
18 fi
19 echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
20 diff --version | head -n1
21 find --version | head -n1
22 gawk --version | head -n1
23 if [ -h /usr/bin/awk ]; then
24  echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
25 elif [ -x /usr/bin/awk ]; then
26  echo awk is `/usr/bin/awk --version | head -n1`
27 else
28  echo "awk not found"
29 fi
30 gcc --version | head -n1
31 g++ --version | head -n1
32 grep --version | head -n1
33 gzip --version | head -n1
34 cat /proc/version
35 m4 --version | head -n1
36 make --version | head -n1
37 patch --version | head -n1
38 echo Perl `perl -V:version`
39 python3 --version
40 sed --version | head -n1
41 tar --version | head -n1
42 makeinfo --version | head -n1 # texinfo version
43 xz --version | head -n1
44 echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
45 if [ -x dummy ]
46  then echo "g++ compilation OK";
47  else echo "g++ compilation failed"; fi
48 rm -f dummy.c dummy
49 EOF
50 bash version-check.sh

 

标签:bin,head,--,Scratch,全记录,echo,version,LFS,n1
From: https://www.cnblogs.com/alphainf/p/16661308.html

相关文章

  • git lfs error:batch response: HTTP/2 cannot be used except with TLS
    自己在腾讯云通过gitea架设的git服务器,使用了lfs。commit和push都很正常,不过换了台机器clone时遇到问题:gitlfspullbatchresponse:HTTP/2cannotbeusedexceptwi......
  • git lfs
    1.什么是gitlfs?GitLFS(LargeFileStorage  大文件存储)是可以把音乐、图片、视频等指定的任意文件存在Git仓库之外,而在Git仓库中用一个占用空间1KB不到的文本......
  • 服务器部署 Vue 和 Django 项目的全记录
    本篇记录我在一个全新服务器上部署Vue和Django前后端项目的全过程,内容包括服务器初始配置、安装Django虚拟环境、pythonweb服务器uWSGI和反向代理Nginx的使用,......