LFS,編譯自己的Linux系統 - 準備

來源:互聯網
上載者:User

標籤:des   c   code   tar   a   get   

概述

現在用的作業系統是Win8.1,用VMware建立一個虛擬機器,3G記憶體(實體記憶體是6G,分一半),23G硬碟,其中3G用於swap分區,10G用於host system,10G用於建立LFS系統。

建立虛擬機器

使用VMware7.1.2建立一個虛擬機器,硬碟23G,記憶體3G。

硬碟分區

分3個區,sda1,3G,用於swap;sda2,10G,用於ubuntu;sda3,10G,用於LFS。之所以要安裝ubuntu,是因為需要有一個系統執行分區、建立檔案系統、下載原始碼、編譯原始碼等工作。分區在安裝ubuntu時進行。

安裝utuntu

安裝的ubuntu版本為ubuntukylin-13.10-desktop-amd64。之所以安裝這個版本,是因為硬碟裡正好有這個鏡像,懶得再下載其他鏡像了。這裡要注意的就是host system版本不能太低,否則不能滿足編譯需求。

在安裝ubuntu的同時,按照上邊的方案進行硬碟分區。

檢測必須的軟體包

LFS裡列出了編譯系統所必須的軟體包列表,同時給出了一個指令碼用於檢測各軟體包的版本。

  • Bash-3.2 (/bin/sh should be a symbolic or hard link to bash)

  • Binutils-2.17 (Versions greater than 2.24 are not recommended as they have not been tested)

  • Bison-2.3 (/usr/bin/yacc should be a link to bison or small script that executes bison)

  • Bzip2-1.0.4

  • Coreutils-6.9

  • Diffutils-2.8.1

  • Findutils-4.2.31

  • Gawk-4.0.1 (/usr/bin/awk should be a link to gawk)

  • GCC-4.1.2 including the C++ compiler, g++ (Versions greater than 4.8.2 are not recommended as they have not been tested)

  • Glibc-2.5.1 (Versions greater than 2.19 are not recommended as they have not been tested)

  • Grep-2.5.1a

  • Gzip-1.3.12

  • Linux Kernel-2.6.32

  • M4-1.4.10

  • Make-3.81

  • Patch-2.5.4

  • Perl-5.8.8

  • Sed-4.1.5

  • Tar-1.18

  • Xz-5.0.0

cat > version-check.sh << "EOF"#!/bin/bash# Simple script to list version numbers of critical development toolsexport LC_ALL=Cbash --version | head -n1 | cut -d" " -f2-4echo "/bin/sh -> `readlink -f /bin/sh`"echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-bison --version | head -n1if [ -e /usr/bin/yacc ];  then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";  else echo "yacc not found"; fibzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2diff --version | head -n1find --version | head -n1gawk --version | head -n1if [ -e /usr/bin/awk ];  then echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";  else echo "awk not found"; figcc --version | head -n1g++ --version | head -n1ldd --version | head -n1 | cut -d" " -f2-  # glibc versiongrep --version | head -n1gzip --version | head -n1cat /proc/versionm4 --version | head -n1make --version | head -n1patch --version | head -n1echo Perl `perl -V:version`sed --version | head -n1tar --version | head -n1xz --version | head -n1echo ‘main(){}‘ > dummy.c && g++ -o dummy dummy.cif [ -x dummy ]  then echo "g++ compilation OK";  else echo "g++ compilation failed"; firm -f dummy.c dummyfor lib in lib{gmp,mpfr,mpc}.la; do  echo $lib: $(if find /usr/lib* -name $lib|               grep -q $lib;then :;else echo not;fi) founddoneunset libEOFbash version-check.sh
安裝缺失的軟體包
sudo apt-get install bison
sudo apt-get install gawk
sudo apt-get install build-essential
Changelog

2014-05-25 首次發布

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.