nethuan 发表于 2015-11-23 15:33:12

大神们,ipxe脚本菜单,怎样加个直接启动本地硬盘系统的命令?

本帖最后由 nethuan 于 2015-11-23 15:37 编辑

假设本地Windows是HD0
我说明,百度了一天,没找到方法,我承认我很笨。

item --key x exit         Exit iPXE and continue BIOS boot这个命令不行,如果主板的启动顺序是从网络启动,退出后又进入菜单,造成循环。


#!ipxe
   set menu-timeout 16000
   set menu-default w8pe
   isset ${ip} || dhcp
   isset ${next-server} || set next-server 192.168.0.205

:start
menu iPXE Boot Menu
item --gap --             -------------------------------- WINPE TOOL ---------------------------
item wpeiso                  66369 2003 PE IN ISO
item 0peiso                  PSEUDO 03 0PE IN ISO
item w7pe                  WIN 7x86 PE IN WIM
item w8pe                  WIN 8x86 PE IN WIM
item w81pe                   WIN 81x86 PE IN WIM
item w8164pe               WIN 81x64 PE IN WIM
item --gap --             -------------------------------- Advanced -----------------------------
item --key s shell             Drop to iPXE Shell
item --key r reboot             Reboot the Computer
item --key x exit             Exit iPXE and Continue BIOS Booting
choose --timeout ${menu-timeout} --default ${menu-default} selected
goto ${selected}

:shell
echo Type 'exit' to go back to the menu.
shell
goto start

:reboot
reboot

:exit
exit

:wpeiso
initrd http://${next-server}/iso/TangoPE_NET.ISO
chain http://${next-server}/memdisk iso raw

:0peiso
initrd http://${next-server}/wimboot/PSEUD0PE.ISO
chain http://${next-server}/wimboot/ISOLINUX/memdisk iso raw

:w7pe
kernel http://${next-server}/wimboot/wimboot
initrd http://${next-server}/wimboot/bootmgr      bootmgr
initrd http://${next-server}/wimboot/bbb      bcd
initrd http://${next-server}/wimboot/boot.sdi      boot.sdi
initrd http://${next-server}/wimboot/WIN786PE.WIM      BOOT.WIM
boot
goto start

:w8pe
kernel http://${next-server}/wimboot/wimboot
initrd http://${next-server}/wimboot/bootmgr      bootmgr
initrd http://${next-server}/wimboot/BCD      BCD
initrd http://${next-server}/wimboot/BOOT.SDI      BOOT.SDI
initrd http://${next-server}/wimboot/BOOT.WIM      BOOT.WIM
boot
goto start

:w81pe
kernel http://${next-server}/wimboot/wimboot
initrd http://${next-server}/wimboot/bootmgr      bootmgr
initrd http://${next-server}/wimboot/bbb      bcd
initrd http://${next-server}/wimboot/boot.sdi      boot.sdi
initrd http://${next-server}/wimboot/WIN8186P.WIM      BOOT.WIM
boot
goto start

:w81pe64
kernel http://${next-server}/wimboot/wimboot
initrd http://${next-server}/wimboot/bootmgr      bootmgr
initrd http://${next-server}/wimboot/bbb      bcd
initrd http://${next-server}/wimboot/boot.sdi      boot.sdi
initrd http://${next-server}/wimboot/WIN8164P.WIM      BOOT.WIM
boot
goto start

:failed
echo Booting failed, dropping to
goto shell

zhaohj 发表于 2015-11-23 16:53:03

本帖最后由 zhaohj 于 2015-11-23 17:24 编辑

那就转到grub4dos
chain grldr
不知这样行不行?
chain http://${next-server}/grub.exe--config-file="chainloader (hd0)+1"
非(hd0)就要多加几条命令了,用“;"隔开,如:
chain http://${next-server}/grub.exe--config-file="find --set-root --devices=h /bootmgr || find --set-root --devices=h /ntldr;map () (hd0);map (hd0) ();map --rehook;chainloader (hd0)+1"

假大空 发表于 2015-11-23 17:17:32

呵呵,我也是转到grldr实现的默认从本地硬盘启动

nethuan 发表于 2015-11-23 22:06:06

我也想到了grub,但我固执的认为ipxe应该可以一条命令解决,唉,原来没那么简单

captain_g 发表于 2015-11-26 13:19:07

#5所说 确如 官网 http://ipxe.org/cmd/sanboot 说明

只是没试过

nethuan 发表于 2015-11-27 09:10:19

本帖最后由 nethuan 于 2015-11-27 09:25 编辑

cckp 发表于 2015-11-26 13:28
一直用的这个命令。肯定有效的

我来试试


感谢感谢。确实可以了,就是这么简单,只怪英文太烂,在官网翻了半天没找到。

rampage 发表于 2016-2-8 20:19:03


item shell      Drop to iPXE shell
item --key r reboot   Reboot Computer
item exit       Exit iPXE (Continue BIOS boot/local disk)
choose --default exit --timeout 30000 target && goto ${target}

:exit
exit


shell可开命令行,来直接写脚本用于启动或者重启或者退出
exit 退出iPXE,开始按照BIOS顺序启动下一个,一般是硬盘
reboot 重启

rampage 发表于 2016-2-8 20:20:31


item grub_hd0                boot to hd0 (via grub4dos)

:grub_hd0
chain ${boot-url}/files/grub.exe --config-file="rootnoverify (hd0);chainloader +1" || goto failed
goto start




此法来启动本地硬盘

tanghe791 发表于 2016-3-15 08:54:22

谢谢楼主。。。。。。

papago 发表于 2018-10-21 18:18:52

ipxe 启动本地硬盘的菜单

a1379388505 发表于 2019-12-11 17:04:38

难道不是  sanboot --no-describe --drive 0x80 ?

hkkitlee 发表于 2019-12-12 17:19:46

a1379388505 发表于 2019-12-11 17:04
难道不是  sanboot --no-describe --drive 0x80 ?

我直接使用exit

a1379388505 发表于 2019-12-12 17:38:16

hkkitlee 发表于 2019-12-12 17:19
我直接使用exit

我用exit结果并没有退出而是又重新进入ipex了 应该是我的内置菜单有问题。如果前面挂载了iscsi 用sanboot --no-describe --drive 0x80确实不行
会直接启动已经挂载的iscsi磁盘

hkkitlee 发表于 2019-12-12 21:42:12

a1379388505 发表于 2019-12-12 17:38
我用exit结果并没有退出而是又重新进入ipex了 应该是我的内置菜单有问题。如果前面挂载了iscsi 用sanboot ...

https://forum.ipxe.org/showthread.php?tid=6775

exit / sanboot --no-describe --drive 0x80 都可以的
作者有說明這可能是bios/uefi的bug,建議更新

江南一根葱 发表于 2019-12-13 13:51:42

efi下的话我直接chain file:\efi\boot\bootx64.efi了

hnrrn 发表于 2020-10-22 22:05:06

学习一下
页: [1]
查看完整版本: 大神们,ipxe脚本菜单,怎样加个直接启动本地硬盘系统的命令?