lfs(systemv版本)学习笔记-第4页
lfs(systemv版本)学习笔记第3页:https://www.cnblogs.com/renren-study-notes/p/10199965.html
第7.2章节
安装lfs启动脚本
1.进入sources目录,解压并进入lfs-bootscripts包目录
tar -xvf lfs-bootscripts-.tar.bz2 cd lfs-bootscripts-
2.参照书中说明安装
make install
3.返回sources目录并删除软件包目录
cd $LFS/sources/ rm -rf lfs-bootscripts-
第7.4章节
管理设备
1.创建udev规则并查看输出找到网卡设备名称(name后面的输出为网卡设备名字)
bash /lib/udev/init-net-rules.sh cat /etc/udev/rules.d/-persistent-net.rules
2.找到重复设备并创建符号链接规则文件
udevadm info -a -p /sys/class/video4linux/video0 cat > /etc/udev/rules.d/-duplicate_devs.rules << "EOF" # Persistent symlinks for webcam and tuner
KERNEL=="video*", ATTRS{idProduct}=="", ATTRS{idVendor}=="0d81", \
SYMLINK+="webcam"
KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \
SYMLINK+="tvtuner" EOF
第7.5章节
网络配置
1.创建网络接口配置文件
cd /etc/sysconfig/
cat > ifconfig.eth0 << "EOF"
ONBOOT=yes
IFACE=eth0
SERVICE=ipv4-static
IP=192.168.1.2
GATEWAY=192.168.1.1
PREFIX=
BROADCAST=192.168.1.255
EOF 这里的etch0 更换为上一章节查看的网卡设备名字
2.创建dns解析文件
cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf domain <Your Domain Name>
nameserver 8.8.8.8
nameserver 8.8.4.4 # End /etc/resolv.conf
EOF 这里使用书中注意里面提供的谷歌dns地址
3,配置系统主机名字
echo "<lfs>" > /etc/hostname <lfs>更换为主机名字
4.创建/etc/hosts文件
cat > /etc/hosts << "EOF"
# Begin /etc/hosts 127.0.0.1 localhost
127.0.1.1 <FQDN> <HOSTNAME>
<192.168.1.1> <FQDN> <HOSTNAME> [alias1] [alias2 ...]
:: localhost ip6-localhost ip6-loopback
ff02:: ip6-allnodes
ff02:: ip6-allrouters # End /etc/hosts
EOF
第7.6章节
System V Bootscript使用和配置
1.配置Sysvinit
cat > /etc/inittab << "EOF"
# Begin /etc/inittab id::initdefault: si::sysinit:/etc/rc.d/init.d/rc S l0::wait:/etc/rc.d/init.d/rc
l1:S1:wait:/etc/rc.d/init.d/rc
l2::wait:/etc/rc.d/init.d/rc
l3::wait:/etc/rc.d/init.d/rc
l4::wait:/etc/rc.d/init.d/rc
l5::wait:/etc/rc.d/init.d/rc
l6::wait:/etc/rc.d/init.d/rc ca::ctrlaltdel:/sbin/shutdown -t1 -a -r now su:S016:once:/sbin/sulogin ::respawn:/sbin/agetty --noclear tty1
::respawn:/sbin/agetty tty2
::respawn:/sbin/agetty tty3
::respawn:/sbin/agetty tty4
::respawn:/sbin/agetty tty5
::respawn:/sbin/agetty tty6 # End /etc/inittab
EOF
2.配置系统时钟
cat > /etc/sysconfig/clock << "EOF"
# Begin /etc/sysconfig/clock UTC=1 # Set this to any options you might need to give to hwclock,
# such as machine hardware clock type for Alphas.
CLOCKPARAMS= # End /etc/sysconfig/clock
EOF
如果电脑上面是多系统,并且有windows系统,要把UTC设置为0,也就是不使用系统硬件时间作为系统时间。如果没有windows系统不需要更改。
因为大多数使用的都是美国键盘,所以本章节剩余内容可忽略
第7.7章节
配置语言环境
运行以下命令获取Glibc支持的所有语言环境的列表:
locale -a
结果:
C
en_US.utf8
POSIX
zh_CN.utf8
这里我们选择en_US.utf8
以下是对对所选择的语言的测试
LC_ALL=<locale name> locale charmap LC_ALL=<locale name> locale language
LC_ALL=<locale name> locale charmap
LC_ALL=<locale name> locale int_curr_symbol
LC_ALL=<locale name> locale int_prefix
确定正确的区域设置后,创建 /etc/profile文件:
cat > /etc/profile << "EOF"
# Begin /etc/profile export LANG=en_US.utf8 (这里替换为所选择的语言环境)
# End /etc/profile
EOF
第7.8章节
1.创建/etc/inputrc配置文件
cat > /etc/inputrc << "EOF"
# Begin /etc/inputrc
# Modified by Chris Lynn <roryo@roryo.dynup.net> # Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off # Enable 8bit input
set meta-flag On
set input-meta On # Turns off 8th bit stripping
set convert-meta Off # Keep the 8th bit for display
set output-meta On # none, visible or audible
set bell-style none # All of the following map the escape sequence of the value
# contained in the 1st argument to the readline specific functions
"\eOd": backward-word
"\eOc": forward-word # for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert # for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line # for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line # End /etc/inputrc
EOF
第7.9章节
1.创建/etc/shells文件
cat > /etc/shells << "EOF"
# Begin /etc/shells /bin/sh
/bin/bash # End /etc/shells
EOF
第8.2章节
1.更改为lfs所创建的分区到相应位置即可(这个文件是配置lfs开机自动挂载的分区)
cat > /etc/fstab << "EOF"
# Begin /etc/fstab # file system mount-point type options dump fsck
# order
/dev/sda9 /boot ext4 defaults 1 1
/dev/sda10 / ext4 defaults 1 1
/dev/sda11 /home ext4 defaults 1 1
/dev/sda12 swap swap pri=1 0 0
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 # End /etc/fstab
EOF
第8.3章节
配置编译安装linux内核
1.首先进入sources目录
cd /sources
2.解压内核文件压缩包
tar -xvf linux-4.20.12.tar.xz
3.进入内核包目录
cd linux-4.20.12
4.准备编译
make mrproper
5.设置默认内核配置状态
make defconfig
6.设置内核
make menuconfig
7.找到以下选项
Device Drivers --->
Generic Driver Options --->
[ ] Support for uevent helper [CONFIG_UEVENT_HELPER]
[*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] Kernel hacking --->
Choose kernel unwinder (Frame pointer unwinder) ---> [CONFIG_UNWINDER_FRAME_POINTER]
8.第一项设置如下
[ ] Support for uevent helper │ │
│ │ [*] Maintain a devtmpfs filesystem to mount at /dev │ │
│ │ [*] Automount devtmpfs at /dev, after the kernel mounted the ro│ │
│ │ [*] Select only drivers that don't need compile-time external fir│ │
│ │ [*] Disable drivers features which enable custom firmware buildin│ │
│ │ Firmware loader ---> │ │
│ │ [ ] Driver Core verbose debug messages │ │
│ │ [*] Managed device resources verbose debug messages │ │
│ │ [ ] Test driver remove calls during probe (UNSTABLE) │ │
│ │ < > Build kernel module to test asynchronous driver probing
9.第二项设置如下
┌────^(-)─────────────────────────────────────────────────────────────┐ │
│ │ [ ] x86 instruction decoder selftest │ │
│ │ IO delay type (port 0x80 based port-IO delay [recommended]) │ │
│ │ [*] Debug boot parameters │ │
│ │ [ ] CPA self-test code │ │
│ │ [*] Allow gcc to uninline functions marked 'inline' │ │
│ │ [ ] Debug low-level entry code │ │
│ │ [ ] NMI Selftest │ │
│ │ [*] Debug the x86 FPU code │ │
│ │ < > ATOM Punit debug driver │ │
│ │ Choose kernel unwinder (Frame pointer unwinder) --->
10.如果您的主机硬件使用UEFI,请自行添加此项设置
Processor type and features --->
[*] EFI stub support [CONFIG_EFI_STUB]
11.设置调整完保存退出即可
12.编译内核映像和模块
make -j8
13.安装配置模块
make modules_install
14.复制一些内核的启动文件到boot分区
cp -iv arch/x86/boot/bzImage /boot/vmlinuz-4.20.12-lfs-8.4 cp -iv System.map /boot/System.map-4.20.12 cp -iv .config /boot/config-4.20.12
15.安装Linux内核的文档:
install -d /usr/share/doc/linux-4.20.12
cp -r Documentation/* /usr/share/doc/linux-4.20.12
16.配置linux模块加载顺序
install -v -m755 -d /etc/modprobe.d
cat > /etc/modprobe.d/usb.conf << "EOF"
# Begin /etc/modprobe.d/usb.conf install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true # End /etc/modprobe.d/usb.conf
EOF
17.返回sources目录并删除包目录
cd $LFS/sources rm -rf linux-4.20.12
第8.4章节
安装配置grub引导
1.安装grub引导到MBR
grub-install /dev/sda
2.创建grub配置文件
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5 insmod ext2
set root=(hd0,2) 括号里面更改为你所安装lfs的分区或boot分区 例如/dev/sda2为(hd0,2) menuentry "GNU/Linux, Linux 4.18.5-lfs-8.3" {
linux /boot/vmlinuz-4.18.5-lfs-8.3 root=/dev/sda2 ro(这里的/dev/sda2更改为你所安装lfs的分区号 例如/dev/sda2)
} (如果boot单独分区,则把这里的/boot删除。)
EOF
多系统引导文件示例:
cat > /boot/grub/grub.cfg << "EOF"
# Begin /boot/grub/grub.cfg
set default=
set timeout= menuentry "GNU/Linux, Linux 4.18.5-lfs-8.3" {
insmod ext2
set root=(hd0,)
linux /vmlinuz-4.18.-lfs-8.3 root=/dev/sda6 ro
}
menuentry 'Manjaro Linux'{
insmod ext2
set root='hd0,msdos9'
linux /vmlinuz-4.19-x86_64 root=/dev/sda10 ro
initrd /intel-ucode.img /initramfs-4.19-x86_64.img
}
menuentry 'Windows 7 (on /dev/sda1)'{
insmod ntfs
set root='hd0,msdos1'
chainloader +
}
EOF
第9.1章节
设置系统版本及版本号
echo 8.4 > /etc/lfs-release cat > /etc/lsb-release << "EOF"
DISTRIB_ID="Linux From Scratch"
DISTRIB_RELEASE="8.4"
DISTRIB_CODENAME="<your name here>"(括号里改为自己起的名字)
DISTRIB_DESCRIPTION="Linux From Scratch"
EOF
第9.3章节
运行下面的命令,退出chroot,卸载lfs的分区
exit umount -v $LFS/dev/pts
umount -v $LFS/dev
umount -v $LFS/run
umount -v $LFS/proc
umount -v $LFS/sys umount -v $LFS umount -v $LFS/usr
umount -v $LFS/home
umount -v $LFS
重启进入lfs系统
reboot
附录
如果需要本机的grub引导lfs则在root用户下运行以下命令创建lfs的引导项
需要安装os-prober软件包,并挂载lfs的分区,在运行下面命令,添加lfs的启动项
grub-mkconfig -o /boot/grub/grub.cfg
确定添加完lfs引导项后,重启机器进入lfs选项,即可进入lfs操作系统。
lfs(systemv版本)学习笔记-第4页的更多相关文章
- lfs(systemv版本)学习笔记-第2页
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! lfs(systemv)学习笔记-第1页 的地址:https://www.cnblogs.com/renren-study-no ...
- lfs(systemv版本)学习笔记-第3页
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! lfs(systemv版本)学习笔记-第2页的地址:https://www.cnblogs.com/renren-study-n ...
- lfs(systemv版本)学习笔记-第1页
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 一名linux爱好者,记录构建Linux From Scratch的过程 经博客园-骏马金龙前辈介绍,开始接触学习lfs,用博客 ...
- lfs(systemd版本)学习笔记-第3页
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! lfs(systemd)学习笔记-第2页 的地址:https://www.cnblogs.com/renren-study-no ...
- lfs(systemd版本)学习笔记-第1页
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 一名linux爱好者,记录构建Linux From Scratch的过程 经博客园-骏马金龙前辈介绍,开始接触学习lfs,用博客 ...
- lfs(systemd版本)学习笔记-第4页
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! lfs(systemd版本)学习笔记-第3页 的地址:https://www.cnblogs.com/renren-study- ...
- lfs(systemd版本)学习笔记-第2页
我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! lfs(systemd)学习笔记-第1页 的地址:https://www.cnblogs.com/renren-study-no ...
- 关于Angular.js Routing 的学习笔记(实现单页应用)
最近开始学习angular.js,发现angular.js确实很方便,也很强大.在看到 AngularJS Routing and Multiple Views 这一部分的时候,有点乱.现在通过记录一 ...
- react-router 4.0版本学习笔记
Router 所有路由组件的底层接口,一般情况都不使用,而是使用更加高级的路由. 最常用的有两种<BrowserRouter>.<HashRouter> <Browser ...
随机推荐
- WPF PrismDialog PopupWindowAction使用MetroWindow
本示例必须在prism5.0版本以上 PopupWindowAction如何使用MetroWindow? public class Window1ViewModel:BindableBase,II ...
- 856. Score of Parentheses
Given a balanced parentheses string S, compute the score of the string based on the following rule: ...
- CentOS防火墙配置
1.查询防火墙状态 service iptables status 2.开启防火墙 service iptables start 3.关闭防火墙 service iptables stop 4.重启防 ...
- JavaScript中JSON对象和JSON字符串的相互转化
一.JSON字符串转换为JSON对象 var str = '{"name":"cxh","sex":"man",&quo ...
- 写你的shell,其实很简单[架构篇]
引语:我本人以前并没有写过shell脚本,也许是因为懒,也许是没有被逼到要去写shell的地步.但是,前段时间,工作需求,要求重新跑几个月的脚本,这些脚本是每天定时进行跑的,而且每天是好几个脚本一起关 ...
- ubuntu 16.04 下更换boost版本
如果是新机器,没装过boost,那么直接一条命令 sudo apt-get install libboost-all-dev 头文件一般安装在 /usr/include 下面有一个目录boost,里面 ...
- 2D转换与3D转换的区别
2D与3D的区别——2D 转换元素能够改变元素 x 和 y 轴.3D 转换元素还能改变其 Z 轴.
- DRF项目工程基础包
drf开发基础包 日常使用drf进行后端开发中,每次开发新项目就的做很多的工程基础配置操作,我觉得这样是没必要的,我们主要关注在业务的开发中,而不是每次都要做这些繁琐的基础操作,所以我把这些做了一个基 ...
- 卡尔曼滤波+单目标追踪+python-opencv
很好的入门资料 向面试官一句话解释卡尔曼滤波: 用上一次的最优状态估计和最优估计误差去计算这一次的先验状态估计和先验误差估计: 用1得到的本次先验误差估计和测量噪声,得到卡尔曼增益: 用1,2步骤得到 ...
- Spark之submit任务时的Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient memory
Spark submit任务到Spark集群时,会出现如下异常: Exception 1:Initial job has not accepted any resources; check your ...