think@centre-pc:~$cat /etc/grub.d/41_custom
#!/bin/sh cat <<EOF # 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 menuentry "UsbDOS 98" { insmod part_msdos insmod ext2 #set root=(hd0,msdos7) ;在grub2命令行ls得到 # floppy / iso / iso raw / harddisk :iso大小<700M # http://www.syslinux.org/wiki/index.php/MEMDISK linux16 (hd0,msdos7)/usr/lib/syslinux/memdisk c=200 h=8 s=36 floppy initrd16 (hd0,msdos7)/usr/lib/syslinux/USBDOS.IMA } # sudo update-grub ; tail -n 15 /boot/grub/grub.cfg # mkdir usbdos ;在当前工作目录下建个floppy的文件夹,用来挂载bootflp.img软盘镜像 # mount -o loop filename.img usbdos ;挂载img镜像到usbdos文件夹,对此文件夹的操作就是对img的操作 # umount usbdos/ ;反挂载软盘镜像 EOF
think@centre-pc:~$sudo update-grub