文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Building a LFS for kgdb

Building a LFS for kgdb

时间:2009-07-08  来源:oxjob

文件: scripts.tar.gz
大小: 8KB
下载: 下载


  Too many softwares running concurrently during stepping through kernel source code will make thing complex, I just want build a clean linux system following the LFS projects.
  1. download lfslivecd-x86-6.2-3 livecd from http://ftp.osuosl.org/pub/lfs-livecd/lfslivcd-x86-6.2-3.iso or other url from what lfs website lists, and burn it to a cdrom. Why I choose x86-6.2-3 is because this version matches my linux-2.6.15.5-kgdb close.
  2. boot your machine with the lfs livecd. Press enter key whenever it stops asking for settings during booting up until the # prompts. Run startx command to enter graphics UI, that is Xfce. In the Xfce panel in the bottom of the desktop, launch a Terminal and SeaMonkey Web Browser. The SeamMonkey Web Browser will display the LFS book as its default home page, from which we can copy the commands and paste(shift + Insert) to the Terminal and run.
  3. Create a new partition or use an old partition for LFS use, say, /dev/hda2. Format this partition and mount it.
     #export LFS=/mnt/lfs
     # mke2fs -jv /dev/hda2
     # mkdir -pv $LFS
     # mount -v -t ext3 /dev/hda2 $LFS
  4. Copy the lfs souces to $LFS/sources. Make it writable and sticky.
     # mkdir -pv $LFS/sources
     # cp -R /lfs-sources/* $LFS/sources
     # chmod -v a+wt $LFS/sources
     make a directory to accommodate the temporary build tools and make a link to /
     # mkdir -pv $LFS/tools
     # ln -sv $LFS/tools /
     Add a lfs user and group and build the temporary tools as lfs user without messing host environments up. Change the
     previously created two directories ownership to lfs user
     # groupadd lfs
     # useradd -s /bin/bash -g lfs -m -k /dev/null lfs
     # chown -v lfs $LFS/tools
     # chown -v lfs $LFS/sources
     Login as user lfs and setting up the environment.
     # su - lfs
     # cat >~/.bash_profile <<"EOF"
       exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
       EOF
     # cat >~/.bashrc <<"EOF"
       set +h
       umask 022
       LFS=/mnt/lfs
       LC_ALL=POSIX
       PATH=/tools/bin:/bin:/usr/bin
       export LFS LC_ALL PATH
       EOF
     # source ~/.bash_profile
  5. Now we can start building LFS now. In order to save so many key strokes, I just made a shell scripts to build the time consuming packags building procedure. Run the scripts to build the temporary tools.
     # chmod +x 5chapt.sh
     # ./5chapt.sh
    Some notes I feel needs to point out for the above building procedure.
    A. First, binutils, gcc and glibc is build and installed under /tools. where ld-new is built with LIB_PATH=/tools/lib but now used during gcc and glibc build. During toolchain adjusting, the ld-new which will link /tools/lib library will be the default linker. Gcc will use /tools/lib/ld-linux.so.2 by amend its /usr/lib/gcc/i486-pc-linux-gnu/4.0.3/specs file.
    B. Then build the test tools, tcl, expect, dejagnu. Rebuild the gcc and binutils. The ld in binutils is built with LIB_PATH=/usr/lib:/lib for chapter 6 usage.
    C. Sed is extensively used during the build where it is used used mostly to replace a pattern in file. eg,
       sed -i 's@^/lib/ld-linux.so.2@/tools&@g' $SPECFILE > tempspecfile
      search string /lib/ld-linux.so.2 at line beginning and append /tools to this pattern in aspecfile, -i means modify on the file directly.

   6. Install basic system software. We use the toolchain built in chapter 5 to build the basic system software.
      Prepare virtual kernel file system and change root by running the following script.
    # chmod +x 6chroot.sh
    # ./6chroot.sh
      Under the chroot'ed environment, run the following script to build the basic system software.
    # chmod +x 6chapt.sh
    # ./6chapt.sh

   7. Now we can setup system bootscripts. First chroot to the new built system.
    # chroot $LFS /usr/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login
      Under the chroot'ed environment, run the following script to setup system script. Be care to modify /etc/fstab to match partition layout.
    # ./7chapt.sh

   8. Build the linux kernel. Just follow the LFS book. Copy the built kernel and System.map files to /boot directory. Of course, we can build kgdb versioned kernel here. Just follow kgdb guide. Modify our boot loader to start the new built LFS kernel.

   9. reboot the machine and choose our boot entry.
   # logout
   # umount -v $LFS/dev/pts
   # umount -v $LFS/dev/shm
   # umount -v $LFS/dev
   # umount -v $LFS/proc
   # umount -v $LFS/sys
   # umount -v $LFS
   # reboot

Untar the scripts.tar.gz, there are the scripts mentioned in the blog.
相关阅读 更多 +
排行榜 更多 +
无敌赛车王

无敌赛车王

赛车竞速 下载
多人汽车聚会

多人汽车聚会

赛车竞速 下载
漂移基地

漂移基地

赛车竞速 下载