iPXE启动菜单详解

本文内容借鉴腾龙工作室内文件,https://www.tenlonstudio.com/5602.html

#!ipxe
#============== Set Variables ===============
#设置默认时间
   set menu-timeout 16000
#判断启动平台的方式,设定默认启动项
   iseq ${platform} efi && set menu-default win64 || set menu-default win32
#将http用xieyi代替
   set xieyi:string http
#测试是否存在ip,否则dhcp自动获取
   isset ${ip} || dhcp
#测试是否存在dhcp服务器,否则指定next-server为192.168.0.101
   isset ${next-server} || set next-server 192.168.0.101

#============== Set Menu ===============
#菜单开始标记
:start
#显示menu标题,并显示平台和ip地址
  menu iPXE Boot Menu --${platform}--${ip}
#列项,可以指定热键,别名,添加--gap --分割线
  item --gap --             -------------------------------- WINPE TOOL ---------------------------
  item win32				Windows10PE x32
  item win64				Windows10PE x64
  item --gap --             ----------------------------------- TOOL ------------------------------
  item maxdos				MaxDOS 9.1
  item --gap --             -------------------------------- Advanced -----------------------------
  item --key h local        [H]Boot from local drive
  item --key s shell 		[S] Drop to iPXE Shell
  item --key r reboot		[R] Reboot the Computer
  item --key x exit			[X] Exit iPXE and Continue BIOS Booting
  item --key c config       [C]Configure settings
  item --key m msboot       [M]Enter Windows Boot Manager Menu (BIOS)
  
#在默认时间到时选择默认启动项
  choose --timeout ${menu-timeout} --default ${menu-default} selected
  goto ${selected}

#============ Main Menu Options =============
#启动32位PE,将PE32.wim赋值给pefile,并跳转至bootpe
:win32
  set pefile PE32.wim
  goto bootpe
#启动64位PE,将PE64.wim赋值给pefile,并跳转至bootpe
:win64
  set pefile PE64.wim
  goto bootpe

#PE镜像启动代码块==============================
:bootpe
  kernel ${xieyi}://${next-server}/boot/wimboot gui || goto retry
  initrd ${xieyi}://${next-server}/pxeautorun.txt ${next-server}.cmd || goto nextg
  :nextg
  initrd ${xieyi}://${next-server}/boot/boot.sdi   boot.sdi  || goto retry
  iseq ${platform} pcbios || goto winefi
  initrd ${xieyi}://${next-server}/bootmgr.exe bootmgr.exe || goto retry
  initrd ${xieyi}://${next-server}/boot/bxe bxd || goto retry
  initrd ${xieyi}://${next-server}/boot/${pefile}  boot.WIM  || goto retry
  boot || goto retry
  goto start
:retry
  imgfree
  prompt Error! press any key to retry
  goto start
#PE镜像启动代码块==============================


#启动MaxDOS镜像
:maxdos
kernel ${boot-url}/memdisk
initrd ${boot-url}/MAXDOS9.img
boot

#从本地硬盘启动
:local
  sanboot --no-describe --drive 0x80

#打开命令行
:shell
  echo Type 'exit' to go back to the menu.
  shell
  goto start

#重启
:reboot
  reboot

#退出
:exit
  exit

#配置
:config
  config
  goto start

#更换启动文件
:msboot 
  chain tftp://${next-server}/pxelinux.0
  goto start

 

  • 4
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值