Build a complete Linux system from LFS official documentation

Source: Internet
Author: User
Tags symlink nameserver

This article is not a beginner Tutorial!!!

    • Parallels Desktop (to prevent the NIC type from being found to be set to Intel (R) pro/1000 MT).
    • KALI-LINUX-2.0-AMD64 (i386). ISO (the LIVECD compilation tool is complete, LiveCD start another installation bison, gawk, directly apt-get install can be installed).
    • Other virtual machine hardware is set by personal requirements.
    • Tool detection required by the host system

version-check.sh

1 #!/bin/Bash 2# Simple script to list version numbers of critical development tools 3 4 export lc_all=C 5 Bash--version | head-n1 | Cut-d ""-f2-4 6 echo "/bin/sh, ' readlink-f/bin/sh '" 7 echo-n "Binutils:"; LD--version | head-n1 | Cut-d ""-f3-8 Bison--version | Head-N1 9 If [-e/usr/bin/YACC];10 then echo "/usr/bin/yacc, ' readlink-f/usr/bin/yacc '", one else echo "Yacc not Found"; Fi12 bzip2--version 2>&1 </dev/null | head-n1 | Cut-d ""-f1,6-14 echo-n "coreutils:"; Chown--version | head-n1 | Cut-d ")"-f215 diff--version | Head-n116 Find--version | Head-n117 gawk--version | Head-n118 if [-e/usr/bin/awk];19 then echo "/usr/bin/awk, Readlink-f/usr/bin/awk '"; else echo "awk not Found"; FI21 gcc--version | Head- n123 ldd--version | head-n1 | cut-d "-f2- # glibc version24 grep--version | Head- n125 gzip--version | head- n126 cat/proc/ version27 M4--version | head- n128 make--versio n | Head- n129 Patch--version | head- n130 Echo Perl ' perl- v:version ' sed--version | head- n132 t AR--version | Head- n133 echo "Texinfo: ' Makeinfo--version | Head-n1 ' "XZ--version | Head- n135 Echo ' main () {} ' > dummy.c && gcc- o dummy dummy.c37 If [- x dummy]38 then echo "GCC compilation OK" ; "Compilation" "GCC Failed", fi40 RM- f DUMMY.C dummy41 Echo ' main () {} ' ; DUMMY.C && g++- o dummy dummy.c43 If [- x dummy]44 then echo "g++ compilation OK" ; else echo "g++ compilation Failed"; fi46 rm-f dummy.c dummy             
    • Build method follow the official documentation step-by-step, just copy and paste. Here are some things to watch out for. (After you build tools, enter Chroot)

When you compile and install GCC, you do not check, but you must perform

1 install-v-dm755/usr/lib/bfd-plugins 2 3 ln-sfv. /.. /libexec/gcc/$ (gcc-dumpmachine)/5.2.0/liblto_plugin.so/usr/lib/bfd-plugins/

Otherwise, the problem of the class library and header file cannot be found when the software is subsequently compiled. If you are not at ease, every time you install a software ldconfig a bit.

    • After installing the software (before compiling the kernel and installing grub), you can configure the relevant files without following the documentation method. Install the following method to configure the basic system required files, to meet the basic operation of the system, and network connection.
1Time settings (Configuring the Setclock Script) 2 cat >/etc/sysconfig/clock << "EOF" 3 # begin/etc/sysconfig/Clock 4 utc=1 5 # end/etc/sysconfig/Clock 6EOF 7 8 bash/lib/udev/init-net-rules.sh 9 cat >/etc/udev/rules.d/83-duplicate_devs.rules << "EOF" 11 # Persistent symlinks forWebcam and tuner kernel== "video*", attrs{idproduct}== "1910", attrs{idvendor}== "0d81", symlink+= "webcam" kernel== "video*", attrs{device}== "0x036f", attrs{vendor}== "0x109e", symlink+= "TVTuner" 16EOF Cat >/etc/inittab << "EOF" # begin/etc/Inittab Id:3: initdefault:21 si::sysinit:/etc/rc.d/init.d/RC S L0:0:WAIT:/ETC/RC.D/INIT.D/RC 0 L1:S1:WAIT:/ETC/RC.D/INIT.D/RC 1 L2:2:WAIT:/ETC/RC.D/INIT.D/RC 2 L3:3:wai T:/ETC/RC.D/INIT.D/RC 3 L4:4:WAIT:/ETC/RC.D/INIT.D/RC 4 L5:5:WAIT:/ETC/RC.D/INIT.D/RC 5 l6:6:wait:/etc/rc.d/ INIT.D/RC 6 Ca:12345:ctrlaltdel:/sbin/shutdown-t1-a-R now su:s016:once:/sbin/Sulogin 1:2345:respawn:/sbin/agetty--noclear tty1 9600 + 2:2345:respawn:/sbin/agetty Tty2 9600 Tty3 9600 4:2345:respawn:/sbin/agetty tty4 9600 in/agetty 5:2345:respawn:/sbin/agetty tty5 9600 Bin/agetty tty6 9600 Notoginseng # end/etc/Inittab 38EOF Max cat >/etc/sysconfig/console << "EOF" # begin/etc/sysconfig/Console font= "Lat2a-16-m 8859-2" # end/etc/sysconfig/Console 44EOF Cat >/etc/shells << "EOF" # begin/etc/Shells 48/bin/sh 49/bin/Bash # end/etc/Shells 51EOF 52 53Set the keyboard function keys under bash set the cat >/etc/inputrc << EOF set horizontal-scroll-Mode OFF meta-SetFlag on input-SetMeta on convert-setMeta OFF output-SetMeta on set bell-Style none "\eod": backward-Word "\EOC": forward-Word "\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 "\eoh": beginning-of-Line "\eof": end-of-Line "\e[h": beginning-of-Line "\e[f": end-of-Line 73EOF 74 75Set Bash Shell startup file (the Bash shell startup files)-cat >/etc/profile << "EOF" # begin/etc/Profile Lang=en_us export. UTF-8 Export language=En_us:en export Lc_numeric=en_us. UTF-8 Bayi Export Lc_time=en_us. UTF-8 Lc_monetary=en_us Export. UTF-8 the export Lc_paper=en_us. UTF-8 export Lc_identification=en_us. UTF-8 to export Lc_name=en_us. UTF-8 Lc_address=en_us Export. UTF-8 export Lc_telephone=en_us. UTF-8 to export Lc_measurement=en_us. UTF-8 Export inputrc=/etc/INPUTRC ls= "ls--color" \u:\w\$ ps1= ' end/etc/'Profile 93EOF 94 95Set local network Name "Hostname=scorelfs" >/etc/sysconfig/Network 97 98Set up Hosts file cat >/etc/hosts << "EOF" # begin/etc/Hosts (no network card version) 101 127.0.0.1Scorelfs localhost102 # end/etc/Hosts (no network card version) 103EOF104 105Set the static address of the network 106 cd/etc/sysconfig/?cat > Ifconfig.eth0 << "EOF" 107 onboot=yes?108 iface=eth0109 service=ipv4-Static ip=10.211.55.49111 gateway=10.211.55.1 broadcast=10.211.55.255? EOF 113 114Set DNS115 cat >/etc/resolv.conf << "EOF" # begin/etc/ resolv.conf117 nameserver 10.211.55.1 118 nameserver 8.8.8.8 119 # end/etc/ resolv.conf120  EOF121 122  build fstab file 123 cat >/etc/fstab << "EOF" 124 # begin/etc/ fstab125 # File system mount- Point type op tions dump fsck126  # ORDER127/DEV/SDA1/EXT4 defaults 1 1128/dev/sda2 swap swap pri=1 0 0129 proc/proc proc DEFA Ults 0 0130 Sysfs/sys sysfs defaults 0 0131 devpts/dev/pts devpts gid=4,mode=620 0 0132 #shm/dev/shm tmpfs defaults 0 0 133 # end/etc/ fstab134  EOF135 136 install-v-m755-d/etc/modprobe . d137 138 cat >/etc/modprobe.d/u sb.conf << "EOF" # begin/etc/modprobe.d/ usb.conf139 install ohci_hcd/sbin/modprobe EHCI_HCD;/sbin/modprob E-i OHCI_HCD; true140 install Uhci_hcd/sbin/modprobe EHCI_HCD; /sbin/modprobe-i UHCI_HCD; true141 # end/etc/modprobe.d/ usb.conf142 EOF          
    • Logout remember to set the root password passwd before you go to the host system.

For subsequent installation of the software and ease of use, it is recommended to install OpenSSH, OpenSSL and wget according to the Blfs documentation. As for SSH configuration, you can install the following methods to resolve root login and permissions issues

1 vim/etc/ssh/passwordauthentication yes4 permitrootlogin Yes

Build a complete Linux system from LFS official documentation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.