编译 grub4dos 的方法

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
头像
ptptptptptpt
帖子: 3711
注册时间: 2006-09-19 18:16

编译 grub4dos 的方法

#1

帖子 ptptptptptpt » 2008-09-23 14:22

1、安装编译环境

代码: 全选

sudo apt-get install autoconf automake automake1.9 subversion openssh-client patch 
2、下载源代码

代码: 全选

svn co svn://svn.gna.org/svn/grub4dos/trunk grub4dos
代码存放在 grub4dos 子目录中。

3、编译

代码: 全选

cd grub4dos
./build
头像
HuntXu
帖子: 5776
注册时间: 2007-09-29 3:09

Re: 编译 grub4dos 的方法

#2

帖子 HuntXu » 2008-09-23 14:28

支持,不过好像没有dos,做不来测试... :em05
HUNT Unfortunately No Talent...
头像
adagio
论坛版主
帖子: 22110
注册时间: 2008-02-17 23:47
来自: 美丽富饶的那啥星球

Re: 编译 grub4dos 的方法

#3

帖子 adagio » 2008-09-23 14:30

这个都要自己编译啊?
有啥好处么?
:em06
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手
头像
ptptptptptpt
帖子: 3711
注册时间: 2006-09-19 18:16

Re: 编译 grub4dos 的方法

#4

帖子 ptptptptptpt » 2008-09-23 14:44

HuntXu 写了:支持,不过好像没有dos,做不来测试... :em05
其实 离 dos 已经很远了,参见 viewtopic.php?f=139&t=150541

这个 grub4dos 的名字实在是误事,曾建议开发者改名,未果。 :em09
头像
ptptptptptpt
帖子: 3711
注册时间: 2006-09-19 18:16

Re: 编译 grub4dos 的方法

#5

帖子 ptptptptptpt » 2008-09-23 14:45

adagio 写了:这个都要自己编译啊?
有啥好处么?
:em06
有朋友想自己编译 viewtopic.php?f=139&t=151523&p=944686#p944686

所以就发了这个贴

有兴趣可以自己改源码,编译自己想要的 grldr
tmwl0tmwl
帖子: 34
注册时间: 2008-09-20 15:57

Re: 编译 grub4dos 的方法

#6

帖子 tmwl0tmwl » 2008-09-23 18:26

已经按你的编译好了。

是不是直接进root替换掉原来的grldr?



你用的是双系统还是,能否加你私聊
tmwl0tmwl
帖子: 34
注册时间: 2008-09-20 15:57

Re: 编译 grub4dos 的方法

#7

帖子 tmwl0tmwl » 2008-09-23 18:54

ptptpt朋友,一切按照你的步骤

下载下来的gurb4dos在/user/grub4dos
文件夹里

编译好之后

我修改了它的menu.lst文件(就是把ubuntu自带的grub使用的menu.lst文件里的启动项复制到grub4dos所用的men.lst
(ubuntu在grub4dos下的启动引导与其自带的grub下的启动一样吗?也就是menu.lst文件是不是要修改? 是不是问题出在这??? 不一样如何写)

并且在root下替换了/boot/grub 里的所以文件


但是重启后出现一个grub 四个字母,后面是光标不断的闪

重装系统中
tmwl0tmwl
帖子: 34
注册时间: 2008-09-20 15:57

Re: 编译 grub4dos 的方法

#8

帖子 tmwl0tmwl » 2008-09-23 20:54

ptptptpt,帮帮我呵..

我已经又把系统恢复掉了

这个编译之后如何替换,我的过程有哪些出了问题?
头像
ptptptptptpt
帖子: 3711
注册时间: 2006-09-19 18:16

Re: 编译 grub4dos 的方法

#9

帖子 ptptptptptpt » 2008-09-24 11:13

替换 stage2 即可

用 /grub4dos-temp/stage2 里面的stage2 替换 /boot/grub/ 里面的 即可
tmwl0tmwl
帖子: 34
注册时间: 2008-09-20 15:57

Re: 编译 grub4dos 的方法

#10

帖子 tmwl0tmwl » 2008-09-24 14:45

继续实验中
tmwl0tmwl
帖子: 34
注册时间: 2008-09-20 15:57

Re: 编译 grub4dos 的方法

#11

帖子 tmwl0tmwl » 2008-09-24 16:40

ptptptptpt朋友,按照你说的,运行之后一切正常,没有任何错误,生成的stage2为196K
原来的stage2为103k

但是加载的img文件提示文件没有发现(似乎犯了一个错误)
是win下的img文件直接拖过来的。写法也用的是win下grub4dos的写法


下面是menu.lst内容

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=112d6f08-9a31-43f8-8a17-89e46ba65e17 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,2)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title Ubuntu 8.04.1, kernel 2.6.24-19-generic
# root (hd0,2)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=112d6f08-9a31-43f8-8a17-89e46ba65e17 ro quiet splash
initrd /boot/initrd.img-2.6.24-19-generic
quiet

title gghost
find --set-root /boot/grub/gghost.img

map --mem /boot/grub/gghost.img (fd0)

map --hook

chainloader (fd0)+1

rootnoverify (fd0)

title Ubuntu 8.04.1, kernel 2.6.24-19-generic (recovery mode)
# root (hd0,2)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=112d6f08-9a31-43f8-8a17-89e46ba65e17 ro single
initrd /boot/initrd.img-2.6.24-19-generic

title Ubuntu 8.04.1, memtest86+
# root (hd0,2)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
chainloader +1
tmwl0tmwl
帖子: 34
注册时间: 2008-09-20 15:57

Re: 编译 grub4dos 的方法

#12

帖子 tmwl0tmwl » 2008-09-24 16:41

附件是编译过的stage2


我替换了,但是如何才能知道自己成功了呢?


我的img文件为什么找不到呢?
附件
stage2.rar
(96.16 KiB) 已下载 121 次
tmwl0tmwl
帖子: 34
注册时间: 2008-09-20 15:57

Re: 编译 grub4dos 的方法

#13

帖子 tmwl0tmwl » 2008-09-24 16:48

/boot/grub下的文件相比win下的grub4dos很多文件没有

包括grldr
grub.exe


一个完整的grub4dos在linux运行需要哪些文件?是不是我的文件有缺少

win下的img文件放在linux的分区上,是不是不能识别,为什么提示文件没有找到?(file not found)

盼ptptptpt解答
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 编译 grub4dos 的方法

#14

帖子 billbear » 2008-09-24 19:22

先确定你的 gghost.img 大小写正确
/boot/grub/gghost.img 路径正确

find --set-root /boot/grub/gghost.img 可以不写。
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 编译 grub4dos 的方法

#15

帖子 billbear » 2008-09-24 19:24

先确定你的 gghost.img 大小写正确
/boot/grub/gghost.img 路径正确

find --set-root /boot/grub/gghost.img 可以不写。
回复