无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 13831|回复: 38

[发布] 8.4更新。IPXE启动文件,启动快速!!含源码,

  [复制链接]
发表于 2019-8-1 12:34:19 | 显示全部楼层 |阅读模式
本帖最后由 huaqingyuan 于 2019-8-7 17:31 编辑

8.7更新
1.添加next-server完全不能获取时候使用DHCP服务器
2,细微调整,启动不成功添加菜单

undionlyOK.7z (66.9 KB, 下载次数: 254)

评分

参与人数 2无忧币 +10 收起 理由
freesoft00 + 5
2012FuckTheCPC + 5 赞一个!

查看全部评分

 楼主| 发表于 2019-8-1 12:38:38 | 显示全部楼层
这是特意不放启动文件的图!

QQ图片20190801123644.png
回复

使用道具 举报

 楼主| 发表于 2019-8-1 12:42:12 | 显示全部楼层
next-server修改为BS代替


2.png
回复

使用道具 举报

发表于 2019-8-1 12:59:51 | 显示全部楼层
下载测试下
回复

使用道具 举报

 楼主| 发表于 2019-8-2 21:55:51 | 显示全部楼层


使用PXE服务。也就是DHCP使用路由器的,仍然成功获取到IPXE.TXT


QQ图片20190802215316.png
回复

使用道具 举报

 楼主| 发表于 2019-8-4 17:35:00 | 显示全部楼层

8.4更新

1.还是启用next-server变量,这样大多数情况下不用再去编辑启动菜单文件
2.不成功情况下天降快捷键n,手动设置服务器IP

undionly1.7z (66.16 KB, 下载次数: 12)
回复

使用道具 举报

 楼主| 发表于 2019-8-4 19:49:48 | 显示全部楼层
8.4再次更新

1.还是启用next-server变量,这样大多数情况下不用再去编辑启动菜单文件
2.不成功情况下添加快捷键n,手动设置服务器IP
3.添加了等待按键时候的倒计时
回复

使用道具 举报

发表于 2019-8-7 09:22:58 | 显示全部楼层
最近折腾的dnsmasq默认不发送next-server,ipxe里看变量值是空的,是dhcp-server
回复

使用道具 举报

发表于 2019-8-7 09:26:05 | 显示全部楼层
#!ipxe
ifopen net0
ifstat


set getfile tinycore.ipxe

   set menu-timeout 8000
   set menu-default dhcpserver
:boot
dhcp
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||
chain file:/pxeboot/${getfile} || goto netboot

:netboot
set bootfile ${filename}
set serverip ${dhcp-server}|${proxydhcp/dhcp-server}|${proxydhcp/next-server}
chain tftp://${dhcp-server}/${getfile} || chain tftp://${proxydhcp/dhcp-server}/${getfile} ||
goto start


:menu

goto start

:start
  menu Choose An Existing Server!  Serverip:${serverip}  bootfile: ${getfile}
  item --gap --             --------------------------------PXE BOOT-----------------------------
  item dhcpserver        ${dhcp-server}
  item proxydhcp         ${proxydhcp/dhcp-server}
  item gitcloud          Cloud Boot
  item retry             set filename   

  item --gap --             ---------------------------- Advanced options -----------------------
  item --key c config       Configure settings                                   -- c
  item --key p pxelinux     Load PXELinux menu                                   -- p
  item shell                Drop to iPXE shell
  item reboot               Reboot computer
  item --key x exit         Exit iPXE and continue BIOS boot                     -- x
  choose --timeout ${menu-timeout} --default ${menu-default} selected
  goto ${selected}

:dhcpserver
echo ${dhcp-server}/${getfile}
chain tftp://${dhcp-server}/${getfile} || set menu-default proxydhcp ||
goto start

:proxydhcp
echo ${proxydhcp/dhcp-server}/${getfile}
chain tftp://${proxydhcp/dhcp-server}/${getfile} || set menu-default gitcloud ||
goto start

:gitcloud
echo Cloud Boot
chain https://raw.githubusercontent.com/zwj4031/netboot/master/${getfile} || set menu-default retry ||
goto start



:retry
console
echo set Filename
read getfile
set menu-default dhcpserver
goto start

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

:failed
  echo Booting failed, dropping to shell
  goto shell

:reboot
  reboot

:exit
  exit

:config
  config
  goto start


这是我这几天琢磨的脚本,在研究研究有没有可以改进的。

点评

8.7更新 1.添加next-server完全不能获取时候使用DHCP服务器 2,细微调整,启动不成功添加菜单  详情 回复 发表于 2019-8-7 17:31
回复

使用道具 举报

 楼主| 发表于 2019-8-7 11:33:51 | 显示全部楼层
本帖最后由 huaqingyuan 于 2019-8-7 11:42 编辑

我比较追求快速启动成功,所以我一般不能成功才出菜单,或者等待按键:
我的脚本你可以参考一下!




#!ipxe
isset ${next-server} && set bs ${next-server} || set bs ${dhcp-server} || set error next-server
isset ${dhcp-server} && set ds ${dhcp-server} || set error ${error}+dhcp-server
isset ${hostname} && set hn ${hostname} || set error ${error}+hostname
isset ${root-path} && set rt ${root-path} || set error ${error}+rt
set priority 1
:retry
dhcp || goto retry
set keep-san 1
isset ${next-server} && set ns ${next-server}
isset ${hn} && set hostname ${hn} || set error ${error}+hn
isset ${rt} && set root-path ${rt} || set error ${error}+rt
echo next-server=${next-server} ip=${ip} mac=${mac}
isset ${proxydhcp/next-server} && set next-server ${proxydhcp/next-server} && echo boot from ${next-server}/ipxe.txt && chain tftp://${next-server}/ipxe.txt ||
isset ${bs} && set next-server ${bs} && echo boot from ${next-server}/ipxe.txt && chain tftp://${next-server}/ipxe.txt ||
isset ${ns} && set next-server ${ns} && echo boot from ${next-server}/ipxe.txt && chain tftp://${next-server}/ipxe.txt || set idx:int32 5
:lp1
iseq ${idx} 0 && goto lp1_done ||
prompt --key n --timeout 1000 Press 'n' input next-server...${idx} && echo -n Please enter next-server: && read next-server && chain tftp://
${next-server}/ipxe.txt && set idx:int32 4 ||
inc idx -1 && goto lp1
:lp1_done
set idx:int32 5
:lp2
iseq ${idx} 0 && goto lp2_done ||
prompt --key 0x02 --timeout 1000 Press Ctrl-B for the iPXE command line...${idx} && shell && set idx:int32 5 ||
inc idx -1 && goto lp2
:lp2_done
reboot
有些文字修饰符可能不能显示,但不影响阅读!

回复

使用道具 举报

 楼主| 发表于 2019-8-7 11:35:33 | 显示全部楼层
DHCP之前的信息往往是对的,所以在之前我保留了很多变量。
回复

使用道具 举报

 楼主| 发表于 2019-8-7 17:31:46 | 显示全部楼层

8.7更新
1.添加next-server完全不能获取时候使用DHCP服务器
2,细微调整,启动不成功添加菜单
undionlyOK.7z (66.9 KB, 下载次数: 11)
回复

使用道具 举报

 楼主| 发表于 2019-8-7 23:47:43 来自手机 | 显示全部楼层
测试环境建议打开路由dHCP或者多开几个DHCP
回复

使用道具 举报

发表于 2019-8-9 09:01:30 | 显示全部楼层
isset ${next-server} || set next-server ${dhcp-server}
isset ${proxydhcp/next-server} || set proxydhcp/next-server ${proxydhcp/dhcp-server}

这个语法有没有对的,我打算统一用next-server

点评

isset ${proxydhcp/next-server} || set proxydhcp/next-server ${proxydhcp/dhcp-server},这行一看就有问题吧!  详情 回复 发表于 2019-8-9 09:34
回复

使用道具 举报

 楼主| 发表于 2019-8-9 09:34:31 | 显示全部楼层
本帖最后由 huaqingyuan 于 2019-8-9 10:07 编辑
江南一根葱 发表于 2019-8-9 09:01
isset ${next-server} || set next-server ${dhcp-server}
isset ${proxydhcp/next-server} || set proxyd ...


isset ${proxydhcp/next-server} || set proxydhcp/next-server ${proxydhcp/dhcp-server},这行一看就有问题吧!
感觉{proxydhcp/next-server}大多数情况是对的,我觉得你可以这样写:


isset  ${proxydhcp/next-server} && set next-server  ${proxydhcp/next-server} || isset  ${next-server} || set next-server ${dhcp-server}


顺序:proxydhcp/next-server , next-server , dhcp-server,谁存在用谁!
回复

使用道具 举报

发表于 2019-8-9 10:13:55 | 显示全部楼层
PXE NBPs
PXE NBPs such as Windows Deployment Service's wdsnbp.com or pxelinux.0 will attempt to retrieve the contents of the various DHCP packets used by iPXE (via the PXENV_GET_CACHED_INFO API call). For example, wdsnbp.com will examine these DHCP packets to determine which TFTP server address to use.
There are three packets that may be requested by the PXE NBP: DHCPDISCOVER, DHCPACK and BINL. iPXE will construct packets for the PXE NBP based on a combination of the actual DHCP packets and settings provided by other means (such as the set command).
The scoping rules for the PXE NBP packets are slightly different from the logical hierarchy of settings scopes used within iPXE:
For the DHCPACK packet, any settings within the network device scope (e.g. netX/next-server) will override any top-level settings (e.g. next-server).
For the BINL packet, any settings present in the ProxyDHCPACK (e.g. proxydhcp/next-server) or in the Boot Server Reply (e.g. pxebs/next-server) will override any top-level settings (e.g. next-server).

http://ipxe.org/settings

建議保留原iPXE的[變量內容]。使用是沒問題;但更改過的話,往後排錯增難度

点评

对了,你帖中dnsmasq的配置好像怎么都启不来efi文件,不知道是不是我vmware版本原因,能列表的是BC_EFI,但启不来,网启后回到固件开机选单页面 但我用另一帖http://bbs.wuyou.net/forum.php?mod=viewthread&tid=36  详情 回复 发表于 2019-8-9 11:53
这样的话对我来说好像更好,我正愁dnsmasq下ipxe启grldr后不能使用ipxe chain grub2,好像没proxydhcp/next-server就是瓶颈  详情 回复 发表于 2019-8-9 11:34
是的,所以还是觉得引入BS 变量,作为启动服务器比较好,服务器的其他变量都还在。但是如果要使用别人的菜单文件,就要做小修改了!  详情 回复 发表于 2019-8-9 10:33
回复

使用道具 举报

 楼主| 发表于 2019-8-9 10:33:12 | 显示全部楼层
本帖最后由 huaqingyuan 于 2019-8-9 10:35 编辑
hkkitlee 发表于 2019-8-9 10:13
PXE NBPs
PXE NBPs such as Windows Deployment Service's wdsnbp.com or pxelinux.0 will attempt to ret ...


是的,所以还是觉得引入BS 变量,作为启动服务器比较好,服务器的其他变量都还在。但是如果要使用别人的菜单文件,就要做小修改了!

isset  ${proxydhcp/next-server} && set bs ${proxydhcp/next-server} || isset  ${bs}  &&  set  bs ${next-server}  || set bs ${dhcp-server}

点评

我的簡單思路,未測: chain tftp://${proxydhcp/next-server}/ipxe.txt || chain tftp://${next-server}/ipxe.txt || shell 應該無需加入dhcp server,因為此腳本由pxe啟動的話,iPXE是由next server傳給客  详情 回复 发表于 2019-8-9 12:18
回复

使用道具 举报

发表于 2019-8-9 11:03:50 | 显示全部楼层
本帖最后由 江南一根葱 于 2019-8-9 11:06 编辑

我在dnsmasq下默认配置不存在next-server,自然也不存在proxydhcp/next-server,所以不存在就从dhcp-server取了

我目前是不存在就取,不存在就保留next-server变量
存在proxydhcp就优先从proxydhcp上取文件

点评

用原版的IPXE启动文件!在DHCP之前到命令行,然后查看next-server,试试有没有值!  详情 回复 发表于 2019-8-9 12:46
這該是你啟動ipxe腳本時,用了命令「dhcp」更新客戶機網絡設定。導致一部份不是「必須的設定值如pxe next server」經dhcp server 再重設了(不是proxydhcp)。 你再進入iPXE介面時已經覆寫了設定,所以看不見。  详情 回复 发表于 2019-8-9 12:22
回复

使用道具 举报

发表于 2019-8-9 11:34:15 | 显示全部楼层
hkkitlee 发表于 2019-8-9 10:13
PXE NBPs
PXE NBPs such as Windows Deployment Service's wdsnbp.com or pxelinux.0 will attempt to ret ...

这样的话对我来说好像更好,我正愁dnsmasq下ipxe启grldr后不能使用ipxe chain grub2,好像没proxydhcp/next-server就是瓶颈
回复

使用道具 举报

发表于 2019-8-9 11:53:22 | 显示全部楼层
hkkitlee 发表于 2019-8-9 10:13
PXE NBPs
PXE NBPs such as Windows Deployment Service's wdsnbp.com or pxelinux.0 will attempt to ret ...

对了,你帖中dnsmasq的配置好像怎么都启不来efi文件,不知道是不是我vmware版本原因,能列表的是BC_EFI,但启不来,网启后回到固件开机选单页面
但我用另一帖http://bbs.wuyou.net/forum.php?mod=viewthread&tid=368988中7楼的方案可以启动成功,

还有就是kernel ipxe.kkpxe是不是个坑啊,我用生成的ipxe.lkrn才可以这么操做

点评

印象中你加了#在設定檔[關於Arch 9 BC_EFI回應] 改回你的檔名,刪除除#號,重啟dnsmasq應該可以 #0 pxe-service=X86PC, "kkpxe for Legacy BIOS", undionly.kkpxe pxe-service=X86PC, "kpxe for Legacy BIOS  详情 回复 发表于 2019-8-9 12:33
回复

使用道具 举报

发表于 2019-8-9 12:18:07 | 显示全部楼层
huaqingyuan 发表于 2019-8-9 10:33
是的,所以还是觉得引入BS 变量,作为启动服务器比较好,服务器的其他变量都还在。但是如果要使用别人 ...

我的簡單思路,未測:

chain tftp://${proxydhcp/next-server}/ipxe.txt ||
chain tftp://${next-server}/ipxe.txt ||
shell

應該無需加入dhcp server,因為此腳本由pxe啟動的話,iPXE是由next server傳給客戶機。

点评

经过判断明显有优势,你这样${proxydhcp/next-server}不存在时候,客户机器会去尝试tftp:///ipxe.txt,耗时很久!  详情 回复 发表于 2019-8-9 12:36
回复

使用道具 举报

发表于 2019-8-9 12:22:15 | 显示全部楼层
江南一根葱 发表于 2019-8-9 11:03
我在dnsmasq下默认配置不存在next-server,自然也不存在proxydhcp/next-server,所以不存在就从dhcp-server ...

這該是你啟動ipxe腳本時,用了命令「dhcp」更新客戶機網絡設定。導致一部份不是「必須的設定值如pxe next server」經dhcp server 再重設了(不是proxydhcp)。

你再進入iPXE介面時已經覆寫了設定,所以看不見。
回复

使用道具 举报

发表于 2019-8-9 12:33:53 | 显示全部楼层
本帖最后由 hkkitlee 于 2019-8-9 12:51 编辑
江南一根葱 发表于 2019-8-9 11:53
对了,你帖中dnsmasq的配置好像怎么都启不来efi文件,不知道是不是我vmware版本原因,能列表的是BC_EFI, ...


印象中你加了#在設定檔[關於Arch 9 BC_EFI回應]
改回你的檔名,刪除除#號,重啟dnsmasq應該可以

#0
pxe-service=X86PC, "kkpxe for Legacy BIOS", undionly.kkpxe
pxe-service=X86PC, "kpxe for Legacy BIOS", undionly.kpxe
pxe-service=X86PC, "pxe for Legacy BIOS", undionly.pxe

#2
pxe-service=IA64_EFI, "Boot IA64_EFI", uefi/ipxe64.efi

#6
pxe-service=IA32_EFI, "Boot IA32_EFI", uefi/ipxe32.efi

#7
pxe-service=X86-64_EFI, "Boot X86-64_EFI", uefi/ipxe64.efi

#8
pxe-service=Xscale_EFI, "Boot BC_EFI", uefi/ipxe64.efi

#9
pxe-service=BC_EFI, "Boot BC_EFI", uefi/ipxe64.efi







kkpxe/kpxe/pxe是真實模式下pxe執行格式,使用不同的載入模式
lkrn是經媒體引導(grub2等)的可啟動核心,多裝載在u盤/光盤。

点评

搞定了,我折腾半天果断开启了日志,原来是efi下也是请求xxx.efi.0,郁闷  详情 回复 发表于 2019-8-9 13:18
回复

使用道具 举报

 楼主| 发表于 2019-8-9 12:36:42 | 显示全部楼层
hkkitlee 发表于 2019-8-9 12:18
我的簡單思路,未測:

chain tftp://${proxydhcp/next-server}/ipxe.txt ||

经过判断明显有优势,你这样${proxydhcp/next-server}不存在时候,客户机器会去尝试tftp:///ipxe.txt,耗时很久!

点评

收到,謝測 真的未有機器試  详情 回复 发表于 2019-8-9 12:41
回复

使用道具 举报

发表于 2019-8-9 12:41:08 | 显示全部楼层
huaqingyuan 发表于 2019-8-9 12:36
经过判断明显有优势,你这样${proxydhcp/next-server}不存在时候,客户机器会去尝试tftp:///ipxe.txt,耗 ...

收到,謝測

真的未有機器試
回复

使用道具 举报

 楼主| 发表于 2019-8-9 12:46:04 | 显示全部楼层
江南一根葱 发表于 2019-8-9 11:03
我在dnsmasq下默认配置不存在next-server,自然也不存在proxydhcp/next-server,所以不存在就从dhcp-server ...

用原版的IPXE启动文件!在DHCP之前到命令行,然后查看next-server,试试有没有值!

点评

pxe启动,没有的,不过我给dhcp-option后是有了,但还是加了dhcp-server以防万一 这么一想,tinypxe的next-server原来可以设定成别的值,也就是别的启动器由pxe启动后也许没有这个值  详情 回复 发表于 2019-8-9 13:21
回复

使用道具 举报

发表于 2019-8-9 13:18:04 | 显示全部楼层
hkkitlee 发表于 2019-8-9 12:33
印象中你加了#在設定檔[關於Arch 9 BC_EFI回應]
改回你的檔名,刪除除#號,重啟dnsmasq應該可以

搞定了,我折腾半天果断开启了日志,原来是efi下也是请求xxx.efi.0,郁闷
回复

使用道具 举报

发表于 2019-8-9 13:21:48 | 显示全部楼层
huaqingyuan 发表于 2019-8-9 12:46
用原版的IPXE启动文件!在DHCP之前到命令行,然后查看next-server,试试有没有值!

pxe启动,没有的,不过我给dhcp-option后是有了,但还是加了dhcp-server以防万一
这么一想,tinypxe的next-server原来可以设定成别的值,也就是别的启动器由pxe启动后也许没有这个值

点评

樓主先多包涵,有點偏離了主題,但剛討論到next server才回答蔥師兄的問題。有需要請聯絡刪除。 Dnsmasq指派非預設的tftp作next server: pxe-service=BC_EFI, "Boot BC_EFI", uefi/ipxe64.efi,[machine name],  详情 回复 发表于 2019-8-9 14:40
回复

使用道具 举报

发表于 2019-8-9 14:40:13 | 显示全部楼层
本帖最后由 hkkitlee 于 2019-8-9 14:43 编辑
江南一根葱 发表于 2019-8-9 13:21
pxe启动,没有的,不过我给dhcp-option后是有了,但还是加了dhcp-server以防万一
这么一想,tinypxe的ne ...


樓主先多包涵,有點偏離了主題,但剛討論到next server才回答蔥師兄的問題。有需要請聯絡刪除。

Dnsmasq指派非預設的tftp作next server:

pxe-service=BC_EFI, "Boot BC_EFI", uefi/ipxe64.efi,[machine name],192.168.X.X

[machine name]=任意,好像不能有空格,也可留空不填
192.168.X.X=任意,同網段即可
回复

使用道具 举报

发表于 2019-8-31 23:55:17 | 显示全部楼层
表示不知道怎么用,LZ来个完整包呗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-3-29 07:35

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表