zoukankan      html  css  js  c++  java
  • (OK) U盘安装grub2,引导 Fedora-liveCD Win7-ghost


    [root@localhost ~]# cat /etc/redhat-release
    Fedora release 20 (Heisenbug)
    [root@localhost ~]# mkdir /mnt/u
    [root@localhost ~]# mount /dev/sdb1 /mnt/u
    [root@localhost ~]# grub2-install --root-directory=/mnt/u /dev/sdb
    [root@localhost ~]# grub2-mkconfig -o /mnt/u/boot/grub2/grub.cfg
    [root@localhost ~]# gedit /mnt/u/boot/grub2/grub.cfg&

    在/mnt/u/boot/grub2/grub.cfg文件最后添加:

    menuentry 'Fedora LiveCD' {
        insmod loopback
        set root='hd0,msdos1'
        set iso_path=/boot/iso/Fedora-Live-Desktop-x86_64-20-20140407.iso
        loopback loop ${iso_path}
        linux (loop)/isolinux/vmlinuz0 iso-scan/filename=${iso_path} root=live:CDLABEL=Fedora-Live-Desktop-x86_64-20-20 rootfstype=auto ro quiet rd.live.image noeject rhgb rd.luks=0 rd.md=0 rd.dm=0
        initrd (loop)/isolinux/initrd0.img
    }

    menuentry 'GRUB4DOS' {
        insmod ntfs
        set root='hd0,msdos1'
        linux /boot/grub4dos/grub.exe --config-file=/boot/grub4dos/menu.lst
    }

    CDLABEL  使用如下命令获得:
    [root@localhost ~]# file /mnt/u/boot/iso/Fedora-Live-Desktop-x86_64-20-20140407.iso
    /mnt/u/boot/iso/Fedora-Live-Desktop-x86_64-20-20140407.iso: # ISO 9660 CD-ROM filesystem data 'Fedora-Live-Desktop-x86_64-20-20' (bootable)
    [root@localhost ~]#



    [root@localhost ~]# ls /mnt/u/boot/
    grub2  grub4dos  iso
    [root@localhost ~]# ls /mnt/u/boot/iso/
    Fedora-Live-Desktop-x86_64-20-20140407.iso  ylmf_ghostwin7sp1_yn2013_x86.iso
    [root@localhost ~]# ls /mnt/u/boot/grub2
    fonts  grub.cfg  grubenv  i386-pc  locale
    [root@localhost ~]# ls /mnt/u/boot/grub4dos/
    badgrub.exe             COPYING                       grub4dos_r63.diff
    bootlace.com            default                       grub.exe           
    ChangeLog_GRUB4DOS.txt  Get_Source_of_This_Build.txt  grub.pif
    chinese                 grldr                         hmload.com
    config.sys              grldr.mbr                     menu.lst
    [root@localhost ~]# gedit /mnt/u/boot/grub4dos/menu.lst

    在/mnt/u/boot/grub4dos/menu.lst文件最后添加:
     
    title DOS/Win9x/Me/NT/2K/XP on (hd0,0)
    chainloader (hd0,0)+1
    rootnoverify (hd0)
     
     
    title Install-Fedora
    kernel (hd0,0)/isolinux/vmlinuz
    initrd (hd0,0)/isolinux/initrd.img
     
    title Install-RHEL7/CentOS7
    root (hd0,10)
    kernel /isolinux/vmlinuz linux repo=hd:/dev/sda9:/
    initrd /isolinux/initrd.img
    boot

    title 1 Start Windows XP setup - XP.iso —— OK
    map --mem /boot/grub4dos/winvblk.ima.gz (fd0)
    map --mem /boot/grub4dos/winvblk.ima.gz (fd1)
    map /boot/iso/DEEP_GHOST_XP_SP3_ZJB_V2014.iso (0xff)
    checkrange 0x80 read 0x8280 && map (hd0) (hd1)
    checkrange 0x80 read 0x8280 && map (hd1) (hd0)
    map --hook
    chainloader (0xff)

    title Windows 7 ISO
    find --set-root /boot/iso/ylmf_ghostwin7sp1_yn2013_x86.iso
    map /boot/iso/ylmf_ghostwin7sp1_yn2013_x86.iso (0xff)
    map --hook
    root (0xff)
    chainloader (0xff)

    ++++++++++++++++++++++  gedit /mnt/u/boot/grub2/grub.cfg  +++++++++++++++++++++++++++++++++

    #
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by grub2-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub
    #

    ### BEGIN /etc/grub.d/00_header ###
    if [ -s $prefix/grubenv ]; then
      load_env
    fi
    if [ "${next_entry}" ] ; then
       set default="${next_entry}"
       set next_entry=
       save_env next_entry
       set boot_once=true
    else
       set default="${saved_entry}"
    fi

    if [ x"${feature_menuentry_id}" = xy ]; then
      menuentry_id_option="--id"
    else
      menuentry_id_option=""
    fi

    export menuentry_id_option

    if [ "${prev_saved_entry}" ]; then
      set saved_entry="${prev_saved_entry}"
      save_env saved_entry
      set prev_saved_entry=
      save_env prev_saved_entry
      set boot_once=true
    fi

    function savedefault {
      if [ -z "${boot_once}" ]; then
        saved_entry="${chosen}"
        save_env saved_entry
      fi
    }

    function load_video {
      if [ x$feature_all_video_module = xy ]; then
        insmod all_video
      else
        insmod efi_gop
        insmod efi_uga
        insmod ieee1275_fb
        insmod vbe
        insmod vga
        insmod video_bochs
        insmod video_cirrus
      fi
    }

    terminal_output console
    set timeout=5
    ### END /etc/grub.d/00_header ###

    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'Fedora, with Linux 3.11.10-301.fc20.x86_64' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.10-301.fc20.x86_64-advanced-eebb0d67-12eb-4bb3-b0a1-a0dd501ff160' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos12'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos12 --hint-efi=hd0,msdos12 --hint-baremetal=ahci0,msdos12 --hint='hd0,msdos12'  59a9499f-4e9a-4d44-b152-03a14db6bc33
        else
          search --no-floppy --fs-uuid --set=root 59a9499f-4e9a-4d44-b152-03a14db6bc33
        fi
        linux    /vmlinuz-3.11.10-301.fc20.x86_64 root=UUID=eebb0d67-12eb-4bb3-b0a1-a0dd501ff160 ro vconsole.font=latarcyrheb-sun16  rhgb quiet
        initrd    /initramfs-3.11.10-301.fc20.x86_64.img
    }
    menuentry 'Fedora, with Linux 2.6.32-358.el6.i686' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-2.6.32-358.el6.i686-advanced-eebb0d67-12eb-4bb3-b0a1-a0dd501ff160' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos12'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos12 --hint-efi=hd0,msdos12 --hint-baremetal=ahci0,msdos12 --hint='hd0,msdos12'  59a9499f-4e9a-4d44-b152-03a14db6bc33
        else
          search --no-floppy --fs-uuid --set=root 59a9499f-4e9a-4d44-b152-03a14db6bc33
        fi
        linux    /vmlinuz-2.6.32-358.el6.i686 root=UUID=eebb0d67-12eb-4bb3-b0a1-a0dd501ff160 ro vconsole.font=latarcyrheb-sun16  rhgb quiet
        initrd    /initramfs-2.6.32-358.el6.i686.img
    }
    menuentry 'Fedora, with Linux 0-rescue-d64e7737811b4ac2a8d9916f962635c9' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-d64e7737811b4ac2a8d9916f962635c9-advanced-eebb0d67-12eb-4bb3-b0a1-a0dd501ff160' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos12'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos12 --hint-efi=hd0,msdos12 --hint-baremetal=ahci0,msdos12 --hint='hd0,msdos12'  59a9499f-4e9a-4d44-b152-03a14db6bc33
        else
          search --no-floppy --fs-uuid --set=root 59a9499f-4e9a-4d44-b152-03a14db6bc33
        fi
        linux    /vmlinuz-0-rescue-d64e7737811b4ac2a8d9916f962635c9 root=UUID=eebb0d67-12eb-4bb3-b0a1-a0dd501ff160 ro vconsole.font=latarcyrheb-sun16  rhgb quiet
        initrd    /initramfs-0-rescue-d64e7737811b4ac2a8d9916f962635c9.img
    }

    ### END /etc/grub.d/10_linux ###

    ### BEGIN /etc/grub.d/20_linux_xen ###

    ### END /etc/grub.d/20_linux_xen ###

    ### BEGIN /etc/grub.d/20_ppc_terminfo ###
    ### END /etc/grub.d/20_ppc_terminfo ###

    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry 'CentOS release 6.4 (Final) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-a7a028b9-1f6f-4261-ab4d-d2333b7de75f' {
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos12'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos12 --hint-efi=hd0,msdos12 --hint-baremetal=ahci0,msdos12 --hint='hd0,msdos12'  59a9499f-4e9a-4d44-b152-03a14db6bc33
        else
          search --no-floppy --fs-uuid --set=root 59a9499f-4e9a-4d44-b152-03a14db6bc33
        fi
        linux /vmlinuz-2.6.32-358.el6.i686 ro root=UUID=a7a028b9-1f6f-4261-ab4d-d2333b7de75f rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-358.el6.i686.img
    }
    submenu 'Advanced options for CentOS release 6.4 (Final) (on /dev/sda3)' $menuentry_id_option 'osprober-gnulinux-advanced-a7a028b9-1f6f-4261-ab4d-d2333b7de75f' {
        menuentry 'CentOS (2.6.32-358.el6.i686) (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-2.6.32-358.el6.i686--a7a028b9-1f6f-4261-ab4d-d2333b7de75f' {
            insmod part_msdos
            insmod ext2
            set root='hd0,msdos12'
            if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos12 --hint-efi=hd0,msdos12 --hint-baremetal=ahci0,msdos12 --hint='hd0,msdos12'  59a9499f-4e9a-4d44-b152-03a14db6bc33
            else
              search --no-floppy --fs-uuid --set=root 59a9499f-4e9a-4d44-b152-03a14db6bc33
            fi
            linux /vmlinuz-2.6.32-358.el6.i686 ro root=UUID=a7a028b9-1f6f-4261-ab4d-d2333b7de75f rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
            initrd /initramfs-2.6.32-358.el6.i686.img
        }
    }

    menuentry 'Microsoft Windows XP Professional (on /dev/sda4)' --class windows --class os $menuentry_id_option 'osprober-chain-5A54CD0554CCE53B' {
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos4'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 --hint='hd0,msdos4'  5A54CD0554CCE53B
        else
          search --no-floppy --fs-uuid --set=root 5A54CD0554CCE53B
        fi
        drivemap -s (hd0) ${root}
        chainloader +1
    }
    ### END /etc/grub.d/30_os-prober ###

    ### BEGIN /etc/grub.d/40_custom ###
    # This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    ### END /etc/grub.d/40_custom ###

    ### BEGIN /etc/grub.d/41_custom ###
    if [ -f  ${config_directory}/custom.cfg ]; then
      source ${config_directory}/custom.cfg
    elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
      source $prefix/custom.cfg;
    fi
    ### END /etc/grub.d/41_custom ###

    menuentry 'Fedora LiveCD' {
        insmod loopback
        set root='hd0,msdos1'
        set iso_path=/boot/iso/Fedora-Live-Desktop-x86_64-20-20140407.iso
        loopback loop ${iso_path}
        linux (loop)/isolinux/vmlinuz0 iso-scan/filename=${iso_path} root=live:CDLABEL=Fedora-Live-Desktop-x86_64-20-20 rootfstype=auto ro quiet rd.live.image noeject rhgb rd.luks=0 rd.md=0 rd.dm=0
        initrd (loop)/isolinux/initrd0.img
    }

    menuentry 'GRUB4DOS' {
        insmod ntfs
        set root='hd0,msdos1'
        linux /boot/grub4dos/grub.exe --config-file=/boot/grub4dos/menu.lst
    }



    ++++++++++++++++++++++  gedit /mnt/u/boot/grub4dos/menu.lst  +++++++++++++++++++++++++++++++++

    # This is a sample menu.lst file. You should make some changes to it.
    # The old install method of booting via the stage-files has been removed.
    # Please install GRLDR boot strap code to MBR with the bootlace.com
    # utility under DOS/Win9x or Linux.
     
    color black/cyan yellow/cyan
    timeout 30
    default /default
     
    title find and load NTLDR of Windows NT/2K/XP
    fallback 1
    find --set-root /ntldr
    chainloader /ntldr
    savedefault --wait=2
     
    title find and load CMLDR, the Recovery Console of Windows NT/2K/XP
    fallback 2
    find --set-root /cmldr
    chainloader /cmldr
    #####################################################################
    # write string "cmdcons" to memory 0000:7C03 in 2 steps:
    #####################################################################
    # step 1. Write 4 chars "cmdc" at 0000:7C03
    write 0x7C03 0x63646D63
    # step 2. Write 3 chars "ons" and an ending null at 0000:7C07
    write 0x7C07 0x00736E6F
    savedefault --wait=2
     
    title find and load IO.SYS of Windows 9x/Me
    fallback 3
    find --set-root /io.sys
    chainloader /io.sys
    savedefault --wait=2
     
    title find and boot Mandriva with menu.lst already installed
    fallback 4
    find --set-root /etc/mandriva-release
    savedefault --wait=2
    configfile /boot/grub/menu.lst
     
    title find and boot Linux with menu.lst already installed
    fallback 5
    find --set-root /sbin/init
    savedefault --wait=2
    configfile /boot/grub/menu.lst
     
    title commandline
    savedefault --wait=2
    commandline
     
    title floppy (fd0)
    chainloader (fd0)+1
    rootnoverify (fd0)
    savedefault --wait=2
     
    title back to dos
    savedefault --wait=2
    quit
     
    title reboot
    savedefault --wait=2
    reboot
     
    title halt
    savedefault --wait=2
    halt
     
    title memdrive duplicated from floppy image file (hd0,0)/sbm.bin
    map --mem (hd0,0)/sbm.bin (fd0)
    map --hook
    chainloader (fd0)+1
    rootnoverify (fd0)
    savedefault --wait=2
     
    title memdrive based on win98 partition (hd0,6)
    map --mem (hd0,6)+1 (hd0)
    # map --mem (hd0,0)/win98.gz (hd0)
    map --hook
    chainloader (hd0)+1
    rootnoverify (hd0)
    savedefault --wait=2
     
    title DOS/Win9x/Me/NT/2K/XP on (hd0,0)
    chainloader (hd0,0)+1
    rootnoverify (hd0)
     
     
    title Install-Fedora
    kernel (hd0,0)/isolinux/vmlinuz
    initrd (hd0,0)/isolinux/initrd.img
     
    title Install-RHEL7/CentOS7
    root (hd0,10)
    kernel /isolinux/vmlinuz linux repo=hd:/dev/sda9:/
    initrd /isolinux/initrd.img
    boot
     
    title Windows 7 ISO
    find --set-root /boot/iso/ylmf_ghostwin7sp1_yn2013_x86.iso
    map /boot/iso/ylmf_ghostwin7sp1_yn2013_x86.iso (0xff)
    map --hook
    root (0xff)
    chainloader (0xff)
     
    title XP setup 1
    find --set-root /boot/iso/DNGS_GHOST_XP_SP3_TYZJ_2014_04.iso
    map --mem /boot/grub4dos/firadisk.img (fd1)
    map --mem (md)0x6000+800 (fd0)
    map --mem /boot/iso/DNGS_GHOST_XP_SP3_TYZJ_2014_04.iso (0xff)
    map --hook
    dd if=(fd1) of=(fd0) count=1
    chainloader (0xff)
     
    title Continue XP setup 2
    find --set-root /boot/iso/DNGS_GHOST_XP_SP3_TYZJ_2014_04.iso
    map --mem /boot/grub4dos/firadisk.img (fd1)
    map --mem (md)0x6000+800 (fd0)
    map --mem /boot/iso/DNGS_GHOST_XP_SP3_TYZJ_2014_04.iso (0xff)
    map --hook
    dd if=(fd1) of=(fd0) count=1
    chainloader (hd0)+1
     
    title 1 Start Windows XP setup - XP.iso
    map --mem /boot/grub4dos/winvblk.ima.gz (fd0)
    map --mem /boot/grub4dos/winvblk.ima.gz (fd1)
    map /boot/iso/DEEP_GHOST_XP_SP3_ZJB_V2014.iso (0xff)
    checkrange 0x80 read 0x8280 && map (hd0) (hd1)
    checkrange 0x80 read 0x8280 && map (hd1) (hd0)
    map --hook
    chainloader (0xff)
     
    title 2 Continue Windows XP setup
    map --mem /boot/grub4dos/winvblk.ima.gz (fd0)
    map --mem /boot/grub4dos/winvblk.ima.gz (fd1)
    map /boot/iso/DEEP_GHOST_XP_SP3_ZJB_V2014.iso (0xff)
    checkrange 0x80 read 0x8280 && map (hd0) (hd1)
    checkrange 0x80 read 0x8280 && map (hd1) (hd0)
    map --hook
    chainloader (hd0)+1
     
    title Install kali  
    root (hd0,6)
    kernel (hd0,6)/live/vmlinuz boot=live noconfig=sudo username=root hostname=kali 
    initrd (hd0,6)/live/initrd.img


  • 相关阅读:
    Oracle 实例恢复
    使用 ASMCMD 工具管理ASM目录及文件
    软考编译原理总结
    解决初学者学不懂android,不理解android的设计
    对计算机模拟人脑的一个小想法
    [每日一题] 11gOCP 1z0-052 :2013-09-19 创建用户...................................................B41
    andengine游戏引擎总结基础篇
    hdu 1789 Doing Homework again (贪心)
    poj 3026 (最小生成树)
    autolisp 列表 resbuf
  • 原文地址:https://www.cnblogs.com/ztguang/p/12648633.html
Copyright © 2011-2022 走看看