grub2 使用问题 boot=casper 。很难解释。。请高手帮忙。

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
ws94501564
帖子: 22
注册时间: 2011-01-15 23:30

Re: grub2 使用问题 boot=casper 。很难解释。。请高手帮忙。

#16

帖子 ws94501564 » 2011-01-18 22:19

我man页上,就找到这些,却没有找到boot= ,iso-scan/file= 这样的参数。。
init=
Run specified binary instead of /sbin/init as init process.
initrd=
specify the location of the initial ramdisk.
load_ramdisk=
list of ramdisks to load from floppy . See Documentation/blockdev/ramdisk.txt
root=
Root filesystem
ro
Mount root device read-only on boot.

rw
mount root device read-write on boot.
vga=
see Documentation/x86/boot.txt and Documentation/svga.txt

请哪位高手解释一下嘛。1楼的那几条命令,是怎么运行的。。。
我只能确定,boot=casper iso-scan/filename=/ubuntu-10.10-desktop-i386.iso 是被传给了内核。。。因为用cat /proc/cmdline 是这样写的。。
至于是被谁使用了,我到现在,也还没有找到




请大虾们,解释一下。
yjq635
帖子: 1
注册时间: 2007-09-25 0:25

Re: grub2 使用问题 boot=casper 。很难解释。。请高手帮忙。

#17

帖子 yjq635 » 2012-04-29 10:38

这个问题我也纠结了一阵子,当初是为了研究ubuntu神奇的livecd启动方式,现在又点了解了,解开casper目录下的initrd 有个init文件,是内核第一个执行的程序(脚本)其中找到以下一段,现在应该明白了吧,cmdline就是grub中配置的内核命令行参数。

for x in $(cat /proc/cmdline); do
case $x in
init=*)
init=${x#init=}
;;
root=*)
ROOT=${x#root=}
case $ROOT in
LABEL=*)
ROOT="${ROOT#LABEL=}"

# support any / in LABEL= path (escape to \x2f)
case "${ROOT}" in
*/*)
if command -v sed >/dev/null 2>&1; then
ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')"
else
if [ "${ROOT}" != "${ROOT#/}" ]; then
ROOT="\x2f${ROOT#/}"
fi
if [ "${ROOT}" != "${ROOT%/}" ]; then
ROOT="${ROOT%/}\x2f"
fi
IFS='/'
newroot=
for s in $ROOT; do
newroot="${newroot:+${newroot}\\x2f}${s}"
done
unset IFS
ROOT="${newroot}"
fi
esac
ROOT="/dev/disk/by-label/${ROOT}"
;;
UUID=*)
ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
;;
/dev/nfs)
[ -z "${BOOT}" ] && BOOT=nfs
;;
esac
;;
rootflags=*)
ROOTFLAGS="-o ${x#rootflags=}"
;;
rootfstype=*)
ROOTFSTYPE="${x#rootfstype=}"
;;
rootdelay=*)
ROOTDELAY="${x#rootdelay=}"
case ${ROOTDELAY} in
*[![:digit:].]*)
ROOTDELAY=
;;
esac
;;
resumedelay=*)
RESUMEDELAY="${x#resumedelay=}"
;;
loop=*)
LOOP="${x#loop=}"
;;
loopflags=*)
LOOPFLAGS="-o ${x#loopflags=}"
;;
loopfstype=*)
LOOPFSTYPE="${x#loopfstype=}"
;;
cryptopts=*)
cryptopts="${x#cryptopts=}"
;;
nfsroot=*)
NFSROOT="${x#nfsroot=}"
;;
netboot=*)
NETBOOT="${x#netboot=}"
;;
ip=*)
IP="${x#ip=}"
;;
boot=*)
BOOT=${x#boot=}
;;
ubi.mtd=*)
UBIMTD=${x#ubi.mtd=}
;;
resume=*)
RESUME="${x#resume=}"
;;
resume_offset=*)
resume_offset="${x#resume_offset=}"
;;
noresume)
noresume=y
;;
panic=*)
panic="${x#panic=}"
case ${panic} in
*[![:digit:].]*)
panic=
;;
esac
;;
quiet)
quiet=y
;;
ro)
readonly=y
;;
rw)
readonly=n
;;
debug)
debug=y
quiet=n
exec >/run/initramfs/initramfs.debug 2>&1
set -x
;;
debug=*)
debug=y
quiet=n
set -x
;;
break=*)
break=${x#break=}
;;
break)
break=premount
;;
blacklist=*)
blacklist=${x#blacklist=}
;;
netconsole=*)
netconsole=${x#netconsole=}
;;
BOOTIF=*)
BOOTIF=${x#BOOTIF=}
;;
hwaddr=*)
BOOTIF=${x#BOOTIF=}
;;
recovery)
recovery=y
;;
esac
done
l10x
帖子: 447
注册时间: 2008-06-23 19:31
系统: debian+fedora+win10

Re: grub2 使用问题 boot=casper 。很难解释。。请高手帮忙。

#18

帖子 l10x » 2012-08-26 11:05

yjq635 写了:这个问题我也纠结了一阵子,当初是为了研究ubuntu神奇的livecd启动方式,现在又点了解了,解开casper目录下的initrd 有个init文件,是内核第一个执行的程序(脚本)其中找到以下一段,现在应该明白了吧,cmdline就是grub中配置的内核命令行参数。

for x in $(cat /proc/cmdline); do
case $x in
init=*)
init=${x#init=}
;;
root=*)
ROOT=${x#root=}
case $ROOT in
LABEL=*)
ROOT="${ROOT#LABEL=}"

# support any / in LABEL= path (escape to \x2f)
case "${ROOT}" in
*/*)
if command -v sed >/dev/null 2>&1; then
ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')"
else
if [ "${ROOT}" != "${ROOT#/}" ]; then
ROOT="\x2f${ROOT#/}"
fi
if [ "${ROOT}" != "${ROOT%/}" ]; then
ROOT="${ROOT%/}\x2f"
fi
IFS='/'
newroot=
for s in $ROOT; do
newroot="${newroot:+${newroot}\\x2f}${s}"
done
unset IFS
ROOT="${newroot}"
fi
esac
ROOT="/dev/disk/by-label/${ROOT}"
;;
UUID=*)
ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
;;
/dev/nfs)
[ -z "${BOOT}" ] && BOOT=nfs
;;
esac
;;
rootflags=*)
ROOTFLAGS="-o ${x#rootflags=}"
;;
rootfstype=*)
ROOTFSTYPE="${x#rootfstype=}"
;;
rootdelay=*)
ROOTDELAY="${x#rootdelay=}"
case ${ROOTDELAY} in
*[![:digit:].]*)
ROOTDELAY=
;;
esac
;;
resumedelay=*)
RESUMEDELAY="${x#resumedelay=}"
;;
loop=*)
LOOP="${x#loop=}"
;;
loopflags=*)
LOOPFLAGS="-o ${x#loopflags=}"
;;
loopfstype=*)
LOOPFSTYPE="${x#loopfstype=}"
;;
cryptopts=*)
cryptopts="${x#cryptopts=}"
;;
nfsroot=*)
NFSROOT="${x#nfsroot=}"
;;
netboot=*)
NETBOOT="${x#netboot=}"
;;
ip=*)
IP="${x#ip=}"
;;
boot=*)
BOOT=${x#boot=}
;;
ubi.mtd=*)
UBIMTD=${x#ubi.mtd=}
;;
resume=*)
RESUME="${x#resume=}"
;;
resume_offset=*)
resume_offset="${x#resume_offset=}"
;;
noresume)
noresume=y
;;
panic=*)
panic="${x#panic=}"
case ${panic} in
*[![:digit:].]*)
panic=
;;
esac
;;
quiet)
quiet=y
;;
ro)
readonly=y
;;
rw)
readonly=n
;;
debug)
debug=y
quiet=n
exec >/run/initramfs/initramfs.debug 2>&1
set -x
;;
debug=*)
debug=y
quiet=n
set -x
;;
break=*)
break=${x#break=}
;;
break)
break=premount
;;
blacklist=*)
blacklist=${x#blacklist=}
;;
netconsole=*)
netconsole=${x#netconsole=}
;;
BOOTIF=*)
BOOTIF=${x#BOOTIF=}
;;
hwaddr=*)
BOOTIF=${x#BOOTIF=}
;;
recovery)
recovery=y
;;
esac
done
grub安装debian需不需要boot=casper
回复