一步一步打造自己的Linux--LFS6.3安装过程(三)
一步一步打造自己的Linux--LFS6.3安装过程(五)

一步一步打造自己的Linux--LFS6.3安装过程(四)

獨立的圓 posted @ 2008年2月09日 04:41 in Linux with tags LFS , 11541 阅读

 本站文章已轉移,敬請移步:http://www.xxb.me/ ,謝謝!

(注:本文于2月28日修改)

III. 构建 LFS 系统

挂载虚拟内核文件系统

为虚拟内核文件系统建立挂载目录:

  1. $ mkdir -pv $LFS/{dev,proc,sys}

创建初始设备节点:

  1. $ mknod -m 600 $LFS/dev/console c 5 1
  2. $ mknod -m 666 $LFS/dev/null c 1 3

挂载并填充 /dev 目录:

  1. $ mount -v --bind /dev $LFS/dev

现在挂载虚拟内核文件系统:

  1. $ mount -vt devpts devpts $LFS/dev/pts
  2. $ mount -vt tmpfs shm $LFS/dev/shm
  3. $ mount -vt proc proc $LFS/proc
  4. $ mount -vt sysfs sysfs $LFS/sys

为了方便使用源码包,将lfs-sources里面所有源码包复制到$LFS/sources目录中:

  1. $ cp -v /lfs-sources/* $LFS/sources/

进入 Chroot 环境,以便不受主系统的影响来制作目标系统:

  1. $ chroot "$LFS" /tools/bin/env -i \
        HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
        PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
        /tools/bin/bash --login +h

此时 bash 提示符会显示“I have no name! :/#”因为 /etc/passwd 还没有创建。

如果此时重启了,需要再执行一次上面带*号的命令

创建系统目录结构:

  1. $ mkdir -pv /{bin,boot,etc/opt,home,lib,mnt,opt}
  2. $ mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
  3. $ install -dv -m 0750 /root
  4. $ install -dv -m 1777 /tmp /var/tmp
  5. $ mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
  6. $ mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
  7. $ mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
  8. $ mkdir -pv /usr/{,local/}share/man/man{1..8}
  9. $ for dir in /usr /usr/local; do
  10.  ln -sv share/{man,doc,info} $dir
  11.  done
  12. $ mkdir -v /var/{lock,log,mail,run,spool}
  13. $ mkdir -pv /var/{opt,cache,lib/{misc,locate},local}

创建必需的文件与符号连接,在目标系统的编译过程中,部分编译程序会用绝对路径来寻找命令或文件:

  1. $ ln -sv /tools/bin/{bash,cat,echo,grep,pwd,stty} /bin
  2. $ ln -sv /tools/bin/perl /usr/bin
  3. $ ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
  4. $ ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
  5. $ ln -sv bash /bin/sh

为用到/etc/mtab的程序创建一个空文件:

  1. $ touch /etc/mtab

创建root用户和必要的组

  1. $ cat > /etc/passwd << "EOF"
  2.  root:x:0:0:root:/root:/bin/bash
  3.  nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
  4.  EOF

root 的真正密码将在后面设置("x"在这里只是一个占位符)。

  1. $ cat > /etc/group << "EOF"
  2.  root:x:0:
  3.  bin:x:1:
  4.  sys:x:2:
  5.  kmem:x:3:
  6.  tty:x:4:
  7.  tape:x:5:
  8.  daemon:x:6:
  9.  floppy:x:7:
  10.  disk:x:8:
  11.  lp:x:9:
  12.  dialout:x:10:
  13.  audio:x:11:
  14.  video:x:12:
  15.  utmp:x:13:
  16.  usb:x:14:
  17.  cdrom:x:15:
  18.  mail:x:34:
  19.  nogroup:x:99:
  20.  EOF

启动新的shell,驱除"I have no name!"提示符:

  1. $ exec /tools/bin/bash --login +h

初始化日志文件,并设置适当的权限:

  1. $ touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
  2. $ chgrp -v utmp /var/run/utmp /var/log/lastlog
  3. $ chmod -v 664 /var/run/utmp /var/log/lastlog

到目前为止,创建目标系统的准备工作已基本完成,下面将开始目标系统的软件包安装。

(未完待续)

best CBD gummies 说:
Apr 29, 2020 03:51:42 PM

After study many of the blog articles in your web site now, i really as if your method of blogging. I bookmarked it to my bookmark website list and will also be checking back soon. Pls look at my internet site also and make me aware how you feel.

best CBD capsules 说:
May 04, 2020 05:56:39 PM

I am glad that I noticed this website, just the right info that I was searching for!

best CBD oil 说:
May 07, 2020 06:11:50 PM

Hi Im itching to know if I may use this article in one of my blogs if I link back to you? Thanks

best CBD oil for dog 说:
May 15, 2020 01:46:34 AM

Aw, it was an extremely good post. In concept I would like to invest writing this way moreover – spending time and actual effort to make a top notch article… but exactly what can I say… I procrastinate alot by no indicates find a way to get something accomplished.

best CBD gummies 说:
May 18, 2020 09:37:35 AM

People wouldn’t think about precisely how it may possibly enormously have an effect on your current destin breast augmentation profits by exercising this rules utilized in seduction methods.

best CBD oil 说:
May 22, 2020 10:57:49 AM

This web page is actually a walk-through its the info you wanted about it and didn’t know who to ask. Glimpse here, and you’ll undoubtedly discover it.

shahmeerkhan 说:
Jul 01, 2020 09:03:09 PM

Thank you for sharing excellent information. Your web-site is so cool. I’m impressed by the info that you’ve on this website. It reveals how nicely you perceive this subject. Bookmarked this web page, will come back for more articles. Christmas in colorado

shahmeerkhan 说:
Jul 29, 2020 01:36:21 AM

I am glad to be one of the visitors on this great site (:, appreciate it for posting. long range thermal camera

Off Market Immobilie 说:
Aug 24, 2020 02:37:14 AM

Many thanks for bothering to line this all out for all of us. This write-up ended up being extremely useful in my opinion.

Party de Noel Montré 说:
Sep 17, 2020 07:26:29 PM

You produced some decent points there. I looked on the web for that issue and found most people will go as well as with all your site.

Rymden77 说:
Oct 07, 2020 01:30:40 AM

Can I just say what a relief to locate somebody that really knows what theyre discussing on-line. You definitely realize how to bring a problem to light to make it critical. Workout . ought to check out this and fully grasp this side of your story. I cant believe youre no more well-liked since you also definitely provide the gift.

Robinjack 说:
Dec 23, 2020 05:24:00 PM

Hey there, Could I copy your photo and employ it on my own webpage? booking and reservation software

Faddy 说:
Feb 09, 2021 07:15:48 PM

Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. Pharmaceutical sales jobs

no excuses runner 说:
Feb 16, 2021 09:42:32 PM

One present why galore businesses opt for postcards is because they are overmuch cheaper to be prefab and this can forbear a lot of expenses on the lengthened run. 꽁머니사이트

Robinjack 说:
Feb 20, 2021 11:26:17 PM

An adrenaline-fueled adventure that captivates you without a single explosion and leaves you completely satisfied. event management software

Faddy 说:
Feb 22, 2021 04:51:57 PM

I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading, I had to go show it to my friend and he ejoyed it as well! 먹튀검증

no excuses runner 说:
Feb 27, 2021 07:15:54 PM

Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! 토토

Faddy 说:
Feb 28, 2021 08:58:12 PM

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Full Circle Health careers

Faddy 说:
Mar 03, 2021 07:43:55 PM

I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious... walmartone

JOHN 说:
Apr 04, 2021 07:57:31 PM

I think this is definitely an amazing project here. So much good will be coming from this project. The ideas and the work behind this will pay off so much. เปิดยูสเซอร์ ไม่มี ขั้นต่ำ

asdzxc 说:
May 17, 2021 02:04:09 AM

Your post has those facts which are not accessible from anywhere else. It’s my humble request to u please keep writing such remarkable articles Personal Trainer San Diego

no excuses runner 说:
May 17, 2021 05:28:17 PM

Impressive web site, Distinguished feedback that I can tackle. I am moving forward and may apply to my current job as a pet sitter, which is very enjoyable, but I need to additional expand. Regards دعم متابعين سناب

asdzxc 说:
May 18, 2021 01:27:39 AM

I appreciate several from the Information which has been composed, and especially the remarks posted I will visit once more. finocchiona

asdzxc 说:
May 18, 2021 03:29:54 AM

I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. pest control doha qatar

Karaoke DJ 说:
May 22, 2021 02:33:14 AM

I needed to thank you for this phenomenal read!! I unquestionably adored each and every piece of it. I have you bookmarked your site to look at the new stuff you post. Karaoke DJ

no excuses runner 说:
May 25, 2021 04:14:31 PM

I was surfing net and fortunately came across this site and found very interesting stuff here. Its really fun to read. I enjoyed a lot. Thanks for sharing this wonderful information. Terpenes for sale

roombooking 说:
May 25, 2021 11:48:24 PM

BR sells their items under five applications with name of ice cream, cakes, sundaes, beverages and prepacks. They have other promotional packages individually or as subprogram of any other programs.

asdzxc 说:
May 26, 2021 12:54:39 AM

Thanks for the tips guys. They were all great. I have been having issues with being fat both mentally and physically. Thanks to you guys i have been showing improvements. Do post more. شحن شدات بوبجي

شدات ببجي 说:
Jun 02, 2021 02:19:15 AM

Many homework on the continual hunt along with offstage on the road to winning. Definitely not attached, simple to-fall as a result of wayside; And not investigation, afterward into a path travel toward the black. شدات ببجي

no excuses runner 说:
Jun 07, 2021 05:36:05 PM

A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up quien es la mascara en vivo

asdzxc 说:
Jun 08, 2021 02:55:50 AM

Intriguing post. I Have Been pondering about this issue, so much obliged for posting. Really cool post.It "s truly extremely pleasant and Useful post.Thanks Gym Near Me

Faddy 说:
Jun 12, 2021 04:18:46 PM

I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Minneapolis Wedding photographer

no excuses runner 说:
Jun 12, 2021 04:51:53 PM

Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information.. Personal Trainer Near Me

Face mask 说:
Jun 20, 2021 11:41:31 PM

Nothing compares to Weber using Genesis sort of grills. That is certainly the type gas grills which have been that will always make sure that they deliver a high performance part of down interval Face mask

Kaufen oder verkaufe 说:
Jul 02, 2021 03:47:49 AM

Kostenlose Inserate im Marktplatz Österreich aufgeben. Kaufen oder Verkaufen sie alles auf dem Verticken Marktplatz über kostenlose Kleinanzeigen Kaufen oder verkaufen Sie Autos

asdzxc 说:
Jul 02, 2021 07:33:39 PM

Tutarchive is the premier and authentic blog publisher that shares knowledge & tips about online earning, digital marketing, freelancing & more! how do podcasts make money

SEO 说:
Aug 18, 2021 04:29:35 PM

HGH MD is the best and most trusted human growth hormone therapy clinic in Florida and surrounding areas in USA. Our specialists help men and women feel younger and healthier. Call Us Today! 888-763-4221

Robinjack 说:
Aug 24, 2021 08:26:56 PM

there are sporting goods that are very cheap but the quality is not very good,, conference scheduling software

Robinjack 说:
Sep 09, 2021 08:51:23 PM

I am curious to find out what blog platform you’re using? I’m experiencing some minor security problems with my latest blog and I would like to find something more safe. Do you have any solutions? property management medford

Robinjack 说:
Sep 26, 2021 10:25:46 PM

Peak Residence by Tuan Sing & Rich Capital . Hotline 61009266. Get Discounts, Direct Developer Price, Brochure, Floor Plan, Price List & More. (Former Peak Court) Peak Residence Showroom

Robinjack 说:
Oct 07, 2021 09:13:38 PM

My brother suggested I would possibly like this website. He used to be entirely right. This post actually made my day. You can not imagine just how much time I had spent for this info! Thanks! Urban Treasures showflat

JAMES 说:
Nov 12, 2021 04:24:25 PM
 

 

Robinjack 说:
Nov 12, 2021 10:10:15 PM

of course cruise ships are expensive but of course the trip is very nice;; east end market orlando

james 说:
Nov 12, 2021 11:16:29 PM

y first visit to your blog, and I am very impressed with the articles that you serve. Give adequate knowledge for me. Thank you for sharing useful material. I will be back for the more great post. math book answers

yousuf 说:
Dec 07, 2021 07:19:46 PM

My spouse and i do not possess a lot of time now to compose plenty of my personal blathering thoughts,(my lil woman wants consideration, : )), however when I logon yet again, I will explain thorough precisely why To be sure with this particular write-up. marijuana dispensaries santa barbara

uninstall skype for 说:
Aug 10, 2022 03:19:31 AM

Skype for Business is a platform created by Microsoft, which is under the suit of Microsoft Office 365, and Skype for Business has good benefits and despite having some disadvantages. uninstall skype for business This Application does use high Ram which it gets launched and it becomes sometimes hard to close it from Task Manager, and therefore there are many users who want to get rid of this Application from their Windows or Mac Device.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter