无忧启动论坛

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

[原创] 菜鸟WSL环境iPXE编译及网启二三事

    [复制链接]
发表于 2021-4-14 00:21:26 | 显示全部楼层 |阅读模式
本帖最后由 hhh333 于 2021-4-16 06:29 编辑

     iPXE网启确实够快,而且在不停更新,不得不每次按自己的意愿编译定制,时间一长又忘记,干脆记下来以免重新捡起时又走弯路。前面都在UOS中编译,刚好caocaofff提点在WSL环境中可能更方便,摸索了一下,不对之处请大佬们指正。
一、这是iPXE网站上有关编译的信息https://ipxe.org/download
You will need to have at least the following packages installed in order to build iPXE:
gcc
binutils
make
perl
liblzma or xz header files
mtools
mkisofs or genisoimage or xorrisofs (needed only for building .iso images)
syslinux (for isolinux, needed only for building .iso images)

二、WSL中搭建iPXE编译环境
WSL是win10的可选安装组件,因此要先安装WSL,如果不清楚,可以上网搜索安装方法,也是超简单的。可以参考这篇https://www.daehub.com/archives/9561.html
安装好后就可以启动进入Ubuntu,设定用户和密码,根据提示进行必要的升级就可进入编译环境搭建,在Ubuntu命令窗口中发下述命令安装组件:
  1. sudo apt install git
  2. sudo apt install git-core   #不装这个编译时会出现文件找不到
  3. sudo apt install liblzma-dev #不装会出现lzma.h错误
  4. sudo apt install gcc
  5. sudo apt install make
  6. sudo apt install mtools  #DOS命令模拟器
  7. sudo apt install mkisofs #不生成ISO不需要
  8. sudo apt install syslinux #不生成ISO不需要

  9. binutils和perl提示系统中已经存在不需要安装
复制代码
可见与网站上的提示有所出入。

三、编译
1、使用git下载iPXE源代码
git clone git://git.ipxe.org/ipxe.git
这个不要用sudo,否则会没操作权限
2、进入ipxe/src先做些准备工作
先要了解究竟需要编译哪些文件,这个分两种情况,一种是适用于BIOS启动环境,另一种是EFI环境,以下是编译命令,可以存成BASH的批处理文件
  1. #!/bin/bash
  2. #编译前清空文件
  3. make clean
  4. #====BIOS编译命令,ipxe.lkrn不预置脚本调用时指定,undionly.kpxe可以内置脚本,也可以不内置脚本由网络启动器指定
  5. make bin/ipxe.lkrn
  6. make bin/undionly.kpxe EMBED=biosrom.txt
  7. #====EFI编译命令,ipxe.efi包含网卡驱动较大,snponly只含通用驱动小=====
  8. #64位
  9. make bin-x86_64-efi/ipxe.efi EMBED=efirom.txt
  10. make bin-x86_64-efi/snponly.efi EMBED=efirom.txt
  11. #32位
  12. make bin-i386-efi/ipxe.efi EMBED=efirom32.txt
  13. make bin-i386-efi/snponly.efi EMBED=efirom32.txt
  14. #====收集编译的文件=====
  15. mkdir -p myipxe/32
  16. mkdir -p myipxe/64
  17. cp bin/ipxe.lkrn myipxe
  18. cp bin/undionly.kpxe myipxe
  19. cp bin-x86_64-efi/ipxe.efi myipxe/64
  20. cp bin-x86_64-efi/snponly.efi myipxe/64
  21. cp bin-i386-efi/ipxe.efi myipxe/32
  22. cp bin-i386-efi/snponly.efi myipxe/32
复制代码
以上生成的文件的用途:
A、bin/ipxe.lkrn  用于其他PXE启动程序调用进入iPXE环境的启动程序,可以不用内置脚本而由PXE程序灵活配置,如下为PXELINUX调用这个程序的菜单
  1. LABEL bootiPXE
  2.         MENU LABEL [^X] --转iPXE网启
  3.         kernel /BOOT/IPXE.KRN
  4.         append initrd=/BOOT/H3_iPXEM.LST
复制代码
下面是G4D调用
  1. title 转iPXE网启                   Goto iPXE Menu\n可有更快的网启速度
  2.         kernel /BOOT/IPXE.KRN
  3.         initrd /BOOT/H3_iPXEM.LST
复制代码
这个IPXE.KRN是由ipxe.lkrn改名而来

B、bin/undionly.kpxe这个是iPXE作网络第一启动时使用,最好在内嵌脚本中指定查找启动脚本的位置,当然也可以在网启服务工具中指定。我一般是将这个文件改名为ipxe.0放网启服务器网启目录的根下。
网启工具设置示例.png

(注:如果在启动文件中内嵌了脚本指定外置菜单,这个启动器指定就无效了)

C、ipxe.efi、snponly.efi用于EFI环境iPXE做第一启动时的启动文件,前者包含网卡驱动较大,后者只含通用驱动小。由于用于EFI环境所以分64位和32位版本,不可混用,编译后分别位于bin-x86_64-efi和bin-i386-efi目录。由于是EFI一启,必须在内嵌脚本中指定菜单文件。

以上文件的文件名在编译时是不能改名的,因为编译工具是用文件名来判断用于何种类型的启动的。编译后名称可以任意改,如上图中EFI网启文件H3_iPXE64.efi就是由64位的ipxe.efi或snponly.efi改名而来。

在以上编译命令中用到了内嵌脚本,这个脚本不是菜单,只是用来指定菜单的位置和名称,即到服务器的什么地方取什么文件作菜单。语法与外置的菜单是一样的,当然也可以直接将外置菜单内嵌。目前的逻辑是用一个小的内嵌脚本调用外置脚本,一般情况下修改外置菜单就可以了,不必重新编译。以下脚本用于BIOS编译时的biosrom.txt的内容:
  1. #!ipxe
  2. dhcp
  3. chain BOOT/H3_iPXEM.LST
复制代码
以下是EFI64的efirom.txt
  1. #!ipxe
  2. dhcp
  3. chain EFI/ipxe/H3_iPXEM.LST
复制代码
以下是EFI32的efirom32.txt
  1. #!ipxe
  2. dhcp
  3. set x32 32                #32位增加一个参数以方便后面菜单脚本编写
  4. chain EFI/ipxe/H3_iPXEM.LST
复制代码
这个很容易看懂,就不作过多解释了。
内嵌脚本编译时通过EMBED=xxx来指定,要提前编辑好,并放当前编译目录下,即ipxe/src下。准备好文件后就可进行编译了。

3、进行编译
准备好内嵌文件后就可以发命令进行编译了,最好一条一条来,以方便查看编译结果。
编译示例.png

四、网启菜单的编写
这是我编写的BIOS-ipxe菜单

  1. #!ipxe
  2. set menu-timeout 10000
  3. set menu-default w8pe
  4. isset ${ip} || dhcp
  5. isset ${next-server} || set next-server 192.168.7.100
  6. set base-url http://www.slitaz.cn:8083/dl/slitaz/iso/rolling
  7. console --picture /BOOT/IPXEBK.PNG
  8. :start
  9.         menu iPXE Boot Menu(ServerIP:${next-server})
  10.         item --gap --                                                 -------------------------------- H3 PE TOOL ---------------------------
  11.         item w7pe                                                     Win7 PE
  12.         item w8pe                                                     Win8 PE
  13.         item w8pe64                                                 Win8 PE 64
  14.         item w81pe                                                   Win81 PE
  15.         item w81pe64                                               Win81 PE 64
  16.         item w10pe                                                   Win10 PE
  17.         item w10pe64                                                Win10 PE 64
  18.         item w03pein                                                 Win03 PE
  19.         item maxdos                                                  Maxdos Tool
  20.         item plpbt                                                      PLPBT USB2.0 Driver
  21.         item memtest                                                 Memtest 86
  22.         item localhd0                                                 Local HD0
  23.         item h3cdall                                                 ${next-server}/H3CDALL.ISO
  24.         item slitaz5                                                 Slitaz5.0 from ${next-server}
  25.         item slitaz5n                                                 Slitaz5.0 from ${base-url}
  26.         item --gap --                                                 -------------------------------- TFTP Menu ----------------------------
  27.         item --key l pxelinux                                       [L] Load PXELinux Menu
  28.         item --key g grub4dos                                    [G] Load Grub4DOS Menu
  29. #        item --key b grub2                                      [B] Load Grub2 Menu
  30.         item --key d dostools                                   [D] Load DOSTOOLS Menu
  31.         item --gap --                                                 -------------------------------- Advanced -----------------------------
  32.         item --key c config                         [C] Configure settings
  33.         item --key s shell                         [S] Drop to iPXE shell
  34.         item --key r reboot                         [R] Reboot computer
  35.         item --key x exit                                 [X] Exit iPXE and continue BIOS boot
  36.         choose --timeout ${menu-timeout} --default ${menu-default} selected
  37.         goto ${selected}

  38. :localhd0
  39.         sanboot --no-describe --drive 0x80

  40. :shell
  41.         echo Type 'exit' to get the back to the menu
  42.         shell
  43.         goto start

  44. :failed
  45.         echo Booting failed, dropping to shell
  46.         goto shell

  47. :reboot
  48.         reboot

  49. :exit
  50.         exit

  51. :config
  52.         config
  53.         goto start

  54. :pxelinux
  55.         chain http://${next-server}/pxelinux.0 || goto failed
  56.         goto start

  57. :grub4dos
  58.         chain http://${next-server}/grldr || goto failed
  59.         goto start

  60. :grub2
  61.         chain http://${next-server}/g2ldr || goto failed
  62.         goto start

  63. :dostools
  64.         chain http://${next-server}/BOOT/H3_GRDOS.BIN || goto failed
  65.         goto start

  66. :memtest
  67.         chain http://${next-server}/BOOT/memtest.bin || goto failed        #http://boot.ipxe.org/memtest.bin
  68.         goto start

  69. :plpbt
  70.         chain http://${next-server}/BOOT/PLPBT.BIN
  71.         goto start

  72. :maxdos
  73.         initrd http://${next-server}/BOOT/IMGS/MAXDOS.IMG
  74.         chain http://${next-server}/BOOT/ISOLINUX/MEMDISK || goto failed

  75. :0pe
  76.         initrd http://${next-server}/ISO/0PE.ISO
  77.         chain        http://${next-server}/memdisk iso raw
  78. #chain http://${next-server}/ISO/grub.exe --config-file="map (rd)+1 (0xff);map --hook;chainloader (0xff)"

  79. :w03pein
  80.         chain http://${next-server}/BOOT/H3_PXELD.0 || goto failed
  81.         goto start

  82. :w7pe
  83.         set bootfile H3_MGRW7.BIN && set sbcdfile BW7 && set pefile H3_7PE.WIM
  84.         goto wimbootpe

  85. :w8pe
  86.         set bootfile H3_MGRW8.BIN && set sbcdfile BW8 && set pefile H3_8PE.WIM
  87.         goto wimbootpe

  88. :w8pe64
  89.         set bootfile H3_MGR64.BIN && set sbcdfile B64 && set pefile H3_864.WIM
  90.         goto wimbootpe

  91. :w81pe
  92.         set bootfile H3_MGR81.BIN && set sbcdfile B81 && set pefile H3_81PE.WIM
  93.         goto wimbootpe

  94. :w81pe64
  95.         set bootfile H3_MGR16.BIN && set sbcdfile B16 && set pefile H3_8164.WIM
  96.         goto wimbootpe

  97. :w10pe
  98.         set bootfile H3_MGR10.BIN && set sbcdfile B10 && set pefile H3_10PE.WIM
  99.         goto wimbootpe

  100. :w10pe64
  101.         set bootfile H3_MGR06.BIN && set sbcdfile B06 && set pefile H3_1064.WIM
  102.         goto wimbootpe

  103. :slitaz5
  104.         imgfree
  105.         kernel http://${next-server}/BOOT/bzImage || goto failed
  106.         initrd http://${next-server}/BOOT/rootfs.gz || goto failed
  107.         imgargs bzImage initrd=rootfs.gz rw root=/dev/null lang=zh_CN kmap=us autologin
  108.         boot || goto retry
  109.         goto start

  110. :slitaz5n
  111.         imgfree
  112.         kernel ${base-url}/boot64/bzImage64 || goto failed
  113.         initrd ${base-url}/boot64/rootfs.gz || goto failed
  114.         imgargs bzImage64 initrd=rootfs.gz rw root=/dev/null lang=zh_CN kmap=us autologin
  115.         boot || goto retry
  116.         goto start
  117.         
  118. :h3cdall
  119.         sanboot --no-describe --keep ${next-server}/H3CDALL.ISO || goto failed
  120.         goto start
  121.         
  122. :wimbootpe
  123.         kernel http://${next-server}/BOOT/wimboot
  124.         initrd http://${next-server}/BOOT/${bootfile} bootmgr
  125.         initrd http://${next-server}/BOOT/${sbcdfile} ${sbcdfile}
  126.         initrd http://${next-server}/BOOT/boot.sdi boot.sdi
  127.         initrd http://${next-server}/BOOT/${pefile}        ${pefile}
  128.         boot || goto failed
  129.         goto start
  130. #https://github.com/ipxe/wimboot/releases/latest/download/wimboot        
复制代码
这是用于EFI的:
  1. #!ipxe
  2. set menu-timeout 10000
  3. set menu-default w8pe
  4. isset ${ip} || dhcp
  5. isset ${next-server} || set next-server 192.168.7.100
  6. set base-url http://www.slitaz.cn:8083/dl/slitaz/iso/rolling
  7. #cpuid --ext 29 && set x64 64 || set x32 32
  8. console --picture /EFI/ipxe/ipxebk.png
  9. :start
  10.   menu iPXE EFI${x32} Boot Menu(ServerIP:${next-server})
  11.   item --gap --             -------------------------------- H3 PE TOOL ---------------------------
  12.   item w8pe                   1-- Win8 PE
  13.   item w81pe                  2-- Win81 PE
  14.   item w10pe                  3-- Win10 PE
  15.   item slitaz5                4-- Slitaz5.0 from ${next-server}
  16.   item slitaz5n               5-- Slitaz5.0 from ${base-url}
  17.   item --gap --             -------------------------------- Other Tool ---------------------------
  18.   item --key k KonBoot      [K] KonBoot 2.5
  19.   #item --key t memtest      [T] Load MemTest 7.4
  20.   #item --key g g2           [G] Load Grub2
  21.   #item --key f g2fm         [F] Load Grub2 FileManager
  22.   item --key d g2run        [D] Load Grub2 RUN
  23.   item --gap --             -------------------------------- Advanced -----------------------------
  24.   item --key c config       [C] Configure settings
  25.   item --key s shell        [S] Drop to iPXE shell
  26.   item --key r reboot       [R] Reboot computer
  27.   item --key x exit         [X] Exit iPXE and continue efi boot
  28.   choose --timeout ${menu-timeout} --default ${menu-default} selected
  29.   goto ${selected}

  30. :shell
  31.   echo Type 'exit' to get the back to the menu
  32.   shell
  33.   goto start

  34. :failed
  35.   echo Booting failed, dropping to shell
  36.   goto shell

  37. :reboot
  38.   reboot

  39. :exit
  40.   exit

  41. :config
  42.   config
  43.   goto start

  44. :g2run
  45.   chain http://${next-server}/EFI/grub/run.efi || goto failed
  46.   goto start

  47. :g2fm
  48.         isset ${x32} && set bootfile grubfmia32.efi || set bootfile grubfmx64.efi
  49.   chain http://${next-server}/EFI/grub/${bootfile} || goto failed
  50.   goto start

  51. :g2
  52.         isset ${x32} && set bootfile g2bootia32.efi || set bootfile g2bootx64.efi
  53.   chain http://${next-server}/EFI/boot/${bootfile} || goto failed
  54.   goto start

  55. :memtest
  56.         isset ${x32} && set bootfile membootia32.efi || set bootfile membootx64.efi
  57.   chain http://${next-server}/EFI/boot/${bootfile} || goto failed
  58.   goto start

  59. :KonBoot
  60.         isset ${x32} && set bootfile KonBootia32.EFI || set bootfile KonBootx64.EFI
  61.   chain http://${next-server}/EFI/boot/${bootfile} || goto failed
  62.   goto start

  63. :w8pe
  64.         set bootfile bootx64.efi && set wimboot wimboot && set tbcdfile BCD && set sbcdfile b64 && set pefile H3_864.WIM
  65.         isset ${x32} && set bootfile bootia32.efi && set wimboot wimboot.i386 && set tbcdfile B32 && set sbcdfile b832 && set pefile H3_8PE.WIM ||
  66.   goto wimbootpe

  67. :w81pe
  68.         set bootfile bootx64.efi && set wimboot wimboot && set bootfile bootx64.efi && set tbcdfile BCD && set sbcdfile b16 && set pefile H3_8164.WIM
  69.         isset ${x32} && set bootfile bootia32.efi && set wimboot wimboot.i386 && set tbcdfile B32 && set sbcdfile b8132 && set pefile H3_81PE.WIM ||
  70.   goto wimbootpe

  71. :w10pe
  72.         set bootfile bootx64.efi && set wimboot wimboot && set bootfile bootx64.efi && set tbcdfile BCD && set sbcdfile b06 && set pefile H3_1064.WIM
  73.         isset ${x32} && set bootfile bootia32.efi && set wimboot wimboot.i386 && set tbcdfile B32 && set sbcdfile b1032 && set pefile H3_10PE.WIM ||
  74.   goto wimbootpe

  75. :slitaz5
  76.         isset ${x32} && set bootfile bzbootia32.efi || set bootfile bzbootx64.efi
  77.         imgfree
  78.         kernel http://${next-server}/EFI/boot/${bootfile} || goto failed
  79.         initrd http://${next-server}/BOOT/rootfs.gz || goto failed
  80.         imgargs ${bootfile} initrd=rootfs.gz rw root=/dev/null lang=zh_CN kmap=us autologin
  81.         boot || goto retry
  82.         goto start

  83. :slitaz5n
  84.         isset ${x32} && set bzd boot32 && set bootfile bzImage || set bzd boot64 && set bootfile bzImage64
  85.         imgfree
  86.         kernel ${base-url}/${bzd}/${bootfile} || goto failed
  87.         initrd ${base-url}/${bzd}/rootfs.gz || goto failed
  88.         imgargs ${bootfile} initrd=rootfs.gz rw root=/dev/null lang=zh_CN kmap=us autologin
  89.         boot || goto retry
  90.         goto start

  91. :wimbootpe
  92.   kernel http://${next-server}/BOOT/${wimboot}
  93.   initrd -n ${bootfile} http://${next-server}/EFI/boot/ms${bootfile}
  94.   initrd -n ${tbcdfile} http://${next-server}/EFI/microsoft/boot/${sbcdfile}
  95.   initrd http://${next-server}/BOOT/BOOT.SDI
  96.   initrd http://${next-server}/BOOT/${pefile}
  97.   boot || goto failed
  98.   goto start
复制代码
可见语法是较简单的:支持“:标号”和“goto",变量由"set"设置,用"${变量}"进行引用,”&&"表示“则”,“||”表示“否则”因此可以控制流程方向,“isset、iseq”用来判断......其他关键词可以看说明https://ipxe.org/docs

五、注意事项
1、脚本的格式:内嵌菜单、外置菜单都可用ansi格式,但sh脚本最好在linux环境进行编辑,如果直接在windows下编辑再直接在WSL环境中用,是没有权限的要通过“chmod 744 文件名”赋权才能使用。
2、外置脚本中使用了背景菜单,以上直接编译的文件启动时会出错失败。因此还得改两个文件:src/config/general.h console.h把其中的两个参数去除注释才行#define CONSOLE_CMD #define CONSOLE_FRAMEBUFFER这两行前面的“//"要去掉。
3、实际上还有一个WSL与Win10之间互相存取文件的问题。我比较暴力,直接到用户目录下找到WSL安装位置,直接拷入拷出,但由win->WSL的文件要记得赋权限,不然WSL看得到拿不到,要特别注意格式,否则会出现不可见的乱字符。哦,对了,WSL在Win10的位置看下这个路径就知道了:C:\Users\hwg\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\hwg\ipxe\src。而Win10在WSL中的位置可以看下图 mnt.png



评分

参与人数 7无忧币 +31 收起 理由
fanet + 5 很给力!心血来潮研究一下ipxe
w8yug + 1 很给力!
2012chenyuwen + 5 赞一个!
teasiu + 5 很给力!
879792799 + 5 赞一个!
2010sya + 5 赞一个!
freesoft00 + 5

查看全部评分

发表于 2021-4-14 07:30:12 | 显示全部楼层
谢谢分享
回复

使用道具 举报

发表于 2021-4-14 07:40:07 | 显示全部楼层
感谢分享
回复

使用道具 举报

发表于 2021-4-14 08:23:08 | 显示全部楼层
谢谢分享,认真学习
回复

使用道具 举报

发表于 2021-4-14 09:04:08 | 显示全部楼层
set base-url

暴露了,撸主这个菜单是抄别人的...

其实我觉得可以用虚拟机,装个Slitaz这样的轻量级Linux做编译环境...

点评

哟厉害了我的国。其实你应该说imgargs这个用法更是抄的,本来是用来启动神雕的Slitaz啊,觉得这么写起来代码少一些,方便变更网址时修改,这写法又不是技术含量蛮高的东西。  详情 回复 发表于 2021-4-14 09:29
回复

使用道具 举报

 楼主| 发表于 2021-4-14 09:29:52 | 显示全部楼层
邪恶海盗 发表于 2021-4-14 09:04
set base-url

暴露了,撸主这个菜单是抄别人的...

哟厉害了我的国。其实你应该说imgargs这个用法更是抄的,本来是用来启动神雕的Slitaz啊,觉得这么写起来代码少一些,方便变更网址时修改,这写法又不是技术含量蛮高的东西。
回复

使用道具 举报

发表于 2021-4-14 09:31:54 | 显示全部楼层
本帖最后由 江南一根葱 于 2021-4-14 09:32 编辑

赶嚼你们对wimboot误解太深了,你这菜单,可以精简掉大半,tinypxe官方包里的菜单有很好的示例。。

点评

有啥高级的用法?wimboot下过来要改名的,不好弄吧  详情 回复 发表于 2021-4-14 09:46
回复

使用道具 举报

 楼主| 发表于 2021-4-14 09:46:34 | 显示全部楼层
本帖最后由 hhh333 于 2021-4-14 09:49 编辑
江南一根葱 发表于 2021-4-14 09:31
赶嚼你们对wimboot误解太深了,你这菜单,可以精简掉大半,tinypxe官方包里的菜单有很好的示例。。

有啥高级的用法?wimboot下过来要改名的,不好弄吧。我正自我感觉良好呢

点评

我们是这样写的 :wimbootmenu menu iPXE Boot Menu(ServerIP:${next-server}) item --gap -- -------------------------------- H3 PE TOOL --------------------------- item H3_7PE.WIM  详情 回复 发表于 2021-4-14 09:51
从来都不需要改名, 你可以参考我折腾的ipxefm,如果一定要执意你这样改很多文件名,你可以这样弄 :wimbootmenu menu iPXE Boot Menu(ServerIP:${next-server}) item --gap -- --------------  详情 回复 发表于 2021-4-14 09:48
回复

使用道具 举报

发表于 2021-4-14 09:48:21 | 显示全部楼层
hhh333 发表于 2021-4-14 09:46
有啥高级的用法?wimboot下过来要改名的,不好弄吧

从来都不需要改名,
你可以参考我折腾的ipxefm,如果一定要执意你这样改很多文件名,你可以这样弄

:wimbootmenu
  menu iPXE Boot Menu(ServerIP:${next-server})
  item --gap --             -------------------------------- H3 PE TOOL ---------------------------
  item H3_7PE.WIM                 Win7 PE
  item H3_11pe.WIM                Win11 PE
  choose --timeout ${menu-timeout} --default ${menu-default} selected
iseq ${selected} H3_7PE.WIM && set wim ${selected} && set bootmgr H3_MGRW7.BIN && set bcd BW7  && goto wimboot
iseq ${selected} H3_11PE.WIM && set wim ${selected} && set bootmgr H3_MGRW11.BIN && set bcd BW11  && goto wimboot
goto ${selected}

:wimboot
  kernel http://${next-server}/BOOT/wimboot                                #http://git.ipxe.org/releases/wimboot/wimboot-latest.zip
  initrd http://${next-server}/BOOT/${bootmgr} bootmgr
  initrd http://${next-server}/BOOT/${bcd}   ${bcd}
  initrd http://${next-server}/BOOT/boot.sdi boot.sdi
  initrd http://${next-server}/BOOT/${wim} ${wim}
  boot || goto failed
  goto wimbootmenu

点评

改了下BIOS菜单,与EFI差不多,不提前判断再goto直接统一goto ${selected},规范些  详情 回复 发表于 2021-4-14 10:37
哦,你是指BIOS菜单,EFI菜单是这么写的,大同小异。  详情 回复 发表于 2021-4-14 09:57
回复

使用道具 举报

发表于 2021-4-14 09:51:25 | 显示全部楼层
hhh333 发表于 2021-4-14 09:46
有啥高级的用法?wimboot下过来要改名的,不好弄吧。我正自我感觉良好呢

我们是这样写的
:wimbootmenu
  menu iPXE Boot Menu(ServerIP:${next-server})
  item --gap --             -------------------------------- H3 PE TOOL ---------------------------
  item H3_7PE.WIM                 Win7 PE
  choose --timeout ${menu-timeout} --default ${menu-default} selected
set wim ${selected} && goto wimboot

:wimboot
  kernel http://${next-server}/BOOT/wimboot                                #http://git.ipxe.org/releases/wimboot/wimboot-latest.zip
  initrd http://${next-server}/BOOT/bootmgr bootmgr
  initrd http://${next-server}/BOOT/bcd   bcd
  initrd http://${next-server}/BOOT/boot.sdi boot.sdi
  initrd http://${next-server}/BOOT/${wim} boot.wim
  boot || goto failed
  goto wimbootmenu
只要加一两句判断,就可以bios/uefi双环境

点评

bios和efi菜单分开好些,没必要合成一个,本来启动文件就不一样。  详情 回复 发表于 2021-4-14 10:01
回复

使用道具 举报

 楼主| 发表于 2021-4-14 09:57:41 | 显示全部楼层
江南一根葱 发表于 2021-4-14 09:48
从来都不需要改名,
你可以参考我折腾的ipxefm,如果一定要执意你这样改很多文件名,你可以这样弄

哦,你是指BIOS菜单,EFI菜单是这么写的,大同小异。BIOS菜单写得较早一点

点评

efi也一样,只不过改成 initrd -n boot.wim  详情 回复 发表于 2021-4-14 10:21
回复

使用道具 举报

 楼主| 发表于 2021-4-14 10:01:57 | 显示全部楼层
江南一根葱 发表于 2021-4-14 09:51
我们是这样写的
:wimbootmenu
  menu iPXE Boot Menu(ServerIP:${next-server})

bios和efi菜单分开好些,没必要合成一个,本来启动文件就不一样。
回复

使用道具 举报

 楼主| 发表于 2021-4-14 10:04:29 | 显示全部楼层
我把BIOS那个再精练一下。与EFI风格一样。不喜欢牺牲可读性。不然过两个月自己也看不懂了。
回复

使用道具 举报

发表于 2021-4-14 10:14:30 | 显示全部楼层
想要高级的方法?用PHP吧,动态菜单,直接在服务器端控制客户端的启动菜单,爽歪歪

点评

哈哈,这个没玩过,简单讲下玩法  详情 回复 发表于 2021-4-14 10:31
回复

使用道具 举报

发表于 2021-4-14 10:21:42 | 显示全部楼层
本帖最后由 江南一根葱 于 2021-4-14 10:57 编辑
hhh333 发表于 2021-4-14 09:57
哦,你是指BIOS菜单,EFI菜单是这么写的,大同小异。BIOS菜单写得较早一点

efi也一样,只不过改成
initrd -n boot.wim
这样可能是bios uefi通吃的,
而且启动文件就差一个bootmgrfw.efi,
nitrd -n boot.wim http://${next-server}/BOOT/${wim} boot.wim
bios/uefi双启可以这样写
  1. :wimboot
  2. #假如取文件失败就换个地址
  3. kernel http://${booturl}/app/wimboot/wimboot quiet || goto retryip
  4. #在bios和efi不同环境取相应的文件

  5. iseq ${platform} pcbios  && initrd http://${booturl}/app/wimboot/bootmgr  bootmgr ||
  6. iseq ${platform} efi  && initrd -n bootx64.efi http://${booturl}/app/wimboot/bootmgfw.efi ||


  7. initrd http://${booturl}/app/wimboot/BCD  BCD ||
  8. initrd http://${booturl}/app/wimboot/boot.sdi   boot.sdi ||

  9. iseq ${platform} pcbios  && initrd http://${booturl}${bootfile} boot.wim ||
  10. iseq ${platform} efi && initrd -n boot.wim http://${booturl}${bootfile} ||
  11. boot ||

复制代码


回复

使用道具 举报

 楼主| 发表于 2021-4-14 10:31:25 | 显示全部楼层
caocaofff 发表于 2021-4-14 10:14
想要高级的方法?用PHP吧,动态菜单,直接在服务器端控制客户端的启动菜单,爽歪歪

哈哈,这个没玩过,简单讲下玩法
回复

使用道具 举报

 楼主| 发表于 2021-4-14 10:37:18 | 显示全部楼层
江南一根葱 发表于 2021-4-14 09:48
从来都不需要改名,
你可以参考我折腾的ipxefm,如果一定要执意你这样改很多文件名,你可以这样弄

改了下BIOS菜单,与EFI差不多,不提前判断再goto直接统一goto ${selected},规范些
  1. #!ipxe
  2. set menu-timeout 10000
  3. set menu-default w8pe
  4. isset ${ip} || dhcp
  5. isset ${next-server} || set next-server 192.168.7.100
  6. set base-url http://www.slitaz.cn:8083/dl/slitaz/iso/rolling
  7. console --picture /BOOT/IPXEBK.PNG
  8. :start
  9.   menu iPXE Boot Menu(ServerIP:${next-server})
  10.   item --gap --             -------------------------------- H3 PE TOOL ---------------------------
  11.   item w7pe                 Win7 PE
  12.   item w8pe                 Win8 PE
  13.   item w8pe64               Win8 PE 64
  14.   item w81pe                Win81 PE
  15.   item w81pe64              Win81 PE 64
  16.   item w10pe                Win10 PE
  17.   item w10pe64              Win10 PE 64
  18.   item w03pein              Win03 PE
  19.   item maxdos               Maxdos Tool
  20.   item plpbt                PLPBT USB2.0 Driver
  21.   item memtest              Memtest 86
  22.   item localhd0             Local HD0
  23.   item h3cdall              ${next-server}/H3CDALL.ISO
  24.   item slitaz5              Slitaz5.0 from ${next-server}
  25.   item slitaz5n             Slitaz5.0 from ${base-url}
  26.   item --gap --             -------------------------------- TFTP Menu ----------------------------
  27.   item --key l pxelinux     [L] Load PXELinux Menu
  28.   item --key g grub4dos     [G] Load Grub4DOS Menu
  29. #  item --key b grub2        [B] Load Grub2 Menu
  30.   item --key d dostools     [D] Load DOSTOOLS Menu
  31.   item --gap --             -------------------------------- Advanced -----------------------------
  32.   item --key c config       [C] Configure settings
  33.   item --key s shell        [S] Drop to iPXE shell
  34.   item --key r reboot       [R] Reboot computer
  35.   item --key x exit         [X] Exit iPXE and continue BIOS boot
  36.   choose --timeout ${menu-timeout} --default ${menu-default} selected
  37.   goto ${selected}

  38. :localhd0
  39.         sanboot --no-describe --drive 0x80

  40. :shell
  41.   echo Type 'exit' to get the back to the menu
  42.   shell
  43.   goto start

  44. :failed
  45.   echo Booting failed, dropping to shell
  46.   goto shell

  47. :reboot
  48.   reboot

  49. :exit
  50.   exit

  51. :config
  52.   config
  53.   goto start

  54. :pxelinux
  55.   chain http://${next-server}/pxelinux.0 || goto failed
  56.   goto start

  57. :grub4dos
  58.   chain http://${next-server}/grldr || goto failed
  59.   goto start

  60. :grub2
  61.   chain http://${next-server}/g2ldr || goto failed
  62.   goto start

  63. :dostools
  64.   chain http://${next-server}/BOOT/H3_GRDOS.BIN || goto failed
  65.   goto start

  66. :memtest
  67.   chain http://${next-server}/BOOT/memtest.bin || goto failed  #http://boot.ipxe.org/memtest.bin
  68.   goto start

  69. :plpbt
  70.   chain http://${next-server}/BOOT/PLPBT.BIN
  71.   goto start

  72. :maxdos
  73.   initrd http://${next-server}/BOOT/IMGS/MAXDOS.IMG
  74.   chain http://${next-server}/BOOT/ISOLINUX/MEMDISK || goto failed

  75. :0pe
  76.   initrd http://${next-server}/ISO/0PE.ISO
  77.   chain  http://${next-server}/memdisk iso raw
  78. #chain http://${next-server}/ISO/grub.exe --config-file="map (rd)+1 (0xff);map --hook;chainloader (0xff)"

  79. :w03pein
  80.   chain http://${next-server}/BOOT/H3_PXELD.0 || goto failed
  81.   goto start

  82. :w7pe
  83.         set bootfile H3_MGRW7.BIN && set sbcdfile BW7 && set pefile H3_7PE.WIM
  84.   goto wimbootpe
  85.   #http://git.ipxe.org/releases/wimboot/wimboot-latest.zip

  86. :w8pe
  87.         set bootfile H3_MGRW8.BIN && set sbcdfile BW8 && set pefile H3_8PE.WIM
  88.   goto wimbootpe

  89. :w8pe64
  90.         set bootfile H3_MGR64.BIN && set sbcdfile B64 && set pefile H3_864.WIM
  91.   goto wimbootpe

  92. :w81pe
  93.         set bootfile H3_MGR81.BIN && set sbcdfile B81 && set pefile H3_81PE.WIM
  94.   goto wimbootpe

  95. :w81pe64
  96.         set bootfile H3_MGR16.BIN && set sbcdfile B16 && set pefile H3_8164.WIM
  97.   goto wimbootpe

  98. :w10pe
  99.         set bootfile H3_MGR10.BIN && set sbcdfile B10 && set pefile H3_10PE.WIM
  100.   goto wimbootpe

  101. :w10pe64
  102.         set bootfile H3_MGR06.BIN && set sbcdfile B06 && set pefile H3_1064.WIM
  103.   goto wimbootpe

  104. :slitaz5
  105.         imgfree
  106.         kernel http://${next-server}/BOOT/bzImage || goto failed
  107.         initrd http://${next-server}/BOOT/rootfs.gz || goto failed
  108.         imgargs bzImage initrd=rootfs.gz rw root=/dev/null lang=zh_CN kmap=us autologin
  109.         boot || goto retry
  110.         goto start

  111. :slitaz5n
  112.         imgfree
  113.         kernel ${base-url}/boot64/bzImage64 || goto failed
  114.         initrd ${base-url}/boot64/rootfs.gz || goto failed
  115.         imgargs bzImage64 initrd=rootfs.gz rw root=/dev/null lang=zh_CN kmap=us autologin
  116.         boot || goto retry
  117.         goto start
  118.        
  119. :h3cdall
  120.         sanboot --no-describe --keep ${next-server}/H3CDALL.ISO || goto failed
  121.         goto start
  122.        
  123. :wimbootpe
  124.   kernel http://${next-server}/BOOT/wimboot
  125.   initrd http://${next-server}/BOOT/${bootfile} bootmgr
  126.   initrd http://${next-server}/BOOT/${sbcdfile}        ${sbcdfile}
  127.   initrd http://${next-server}/BOOT/boot.sdi boot.sdi
  128.   initrd http://${next-server}/BOOT/${pefile}        ${pefile}
  129.   boot || goto failed
  130.   goto start
复制代码


点评

所有的bootmgr和bcd是可以共用一个的, tinypxe官方包里有提供。。  详情 回复 发表于 2021-4-14 10:48
回复

使用道具 举报

发表于 2021-4-14 10:48:45 | 显示全部楼层
本帖最后由 江南一根葱 于 2021-4-14 11:01 编辑
hhh333 发表于 2021-4-14 10:37
改了下BIOS菜单,与EFI差不多,不提前判断再goto直接统一goto ${selected},规范些

所有的bootmgr和bcd是可以共用一个的,
tinypxe官方包里有提供。。
所以其实只需要单独写个wimboot菜单出来,然后在主菜单引用,
set wim ${selected} && goto wimboot一句就可以了。。
可以用这些文件,
wimboot.7z (1017.12 KB, 下载次数: 13)

点评

哦,好像新版可以用大内存是吧  详情 回复 发表于 2021-4-14 10:58
回复

使用道具 举报

 楼主| 发表于 2021-4-14 10:58:18 | 显示全部楼层
江南一根葱 发表于 2021-4-14 10:48
所有的bootmgr和bcd是可以共用一个的,
tinypxe官方包里有提供。。
所以其实只需要单独写个wimboot菜单 ...

哦,好像新版可以用大内存是吧
回复

使用道具 举报

发表于 2021-4-14 11:06:27 | 显示全部楼层
item 后面的这些,最好替换成有价值的,引用方便,把w7pe什么的,写成H3_7PE.WIM不是更香吗,也更容易看得懂
可以pefile就是${selected}。

点评

哈哈,也是,小技巧多啊  详情 回复 发表于 2021-4-14 11:11
回复

使用道具 举报

 楼主| 发表于 2021-4-14 11:11:51 | 显示全部楼层
江南一根葱 发表于 2021-4-14 11:06
item 后面的这些,最好替换成有价值的,引用方便,把w7pe什么的,写成H3_7PE.WIM不是更香吗,也更容易看得 ...

哈哈,也是,小技巧多啊
回复

使用道具 举报

发表于 2021-4-14 16:10:30 | 显示全部楼层
我的菜单,貌似是用的TinyPXE的改的:
  1. #!ipxe

  2. #set boot-url http://hidao.org/pxe
  3. set boot-url http://${next-server}
  4. #set iqn iqn.2008-08.com.starwindsoftware:test
  5. #set nfs-server nfs://${next-server}
  6. #set cifs-server //${next-server}
  7. #set mytarget iscsi:${next-server}::::iqn.2008-08.com.starwindsoftware:target1
  8. #set gateway 0.0.0.0
  9. #set keep-san 1
  10. #set initiator-iqn iqn.client

  11. # Setup some basic convenience variables
  12. set menu-timeout 8000
  13. set submenu-timeout ${menu-timeout}
  14. #check platform (pcbios or efi), buildarch (i386 or X86_64)
  15. echo Platform: ${platform}
  16. echo Buildarch: ${buildarch}
  17. # Ensure we have menu-default set to something
  18. isset ${menu-default} || set menu-default WinPE_x64
  19. #console --picture ${boot-url}/bg.png

  20. ######## MAIN MENU ###################
  21. :start
  22. iseq ${platform} efi && menu iPXE Boot Menu (UEFI) - Mod By hidao.org || menu iPXE Boot Menu (BIOS) - Mod By hidao.org
  23. item --gap -- IP:${ip} , DHCP:${dhcp-server} , boot-url = ${boot-url}
  24. item
  25. item --gap --                  ----------------------- Win PE -----------------------
  26. item --key 1 isoboot           [1] Boot boot.iso ------------------------ (BIOS/UEFI) Unavailable
  27. item --key 2 WinPE_x86         [2] Boot boot32.wim ---------------------- (BIOS/UEFI) Unavailable
  28. item --key 3 WinPE_x64         [3] Boot boot64.wim ---------------------- (BIOS/UEFI) Unavailable
  29. item --gap --
  30. item --gap --                  ----------------------- Linux ------------------------
  31. item --key l Slitaz            [L] Boot Slitaz -------------------------- (BIOS Only) Available
  32. item --key t TinyCore          [T] Boot TinyCore ------------------------ (BIOS Only) Available
  33. item --key k kolibri           [K] Boot Kolibri ------------------------- (BIOS Only) Available
  34. item --key e menuetos          [E] Boot MenuetOS ------------------------ (BIOS Only) Available
  35. item --key w gocloud           [W] Install openwrt X86 ------------------ (BIOS Only) Available
  36. item --gap --
  37. item --gap --                  ----------------------- Other Tools ------------------
  38. item --key m memtest           [M] Boot Memtest x86 --------------------- (BIOS/UEFI) Available
  39. item --key g GhostDos          [G] Boot GhostDos ------------------------ (BIOS Only) Available
  40. item --key d MaxDos            [D] Boot MaxDos -------------------------- (BIOS Only) Available
  41. item --gap --
  42. #item --gap --                  ---------------------- Exit Boot -----------
  43. item --key x exit              [X] Exit iPXE and continue boot ----------------------
  44. item --gap --
  45. item --gap --
  46. item --gap --                  ----------------------- Advanced options -------------
  47. item --key c config            [C] Configure settings -------------------------------
  48. item --key i shell             [I] Enter iPXE shell ---------------------------------
  49. item --key r reboot            [R] Reboot -------------------------------------------
  50. item --key s power             [S] Shutdown -----------------------------------------
  51. choose --timeout ${menu-timeout} --default ${menu-default} selected
  52. goto ${selected}
  53. #choose --default exit --timeout ${menu-timeout} target && goto ${target}

  54. ########## UTILITY ITEMS ####################
  55. :local80
  56. sanboot --no-describe --drive 0x80

  57. :local81
  58. sanboot --no-describe --drive 0x81

  59. :isoboot
  60. initrd ${boot-url}/sources/boot.iso || goto Failed
  61. chain ${boot-url}/memdisk iso raw || goto Failed
  62. boot || goto Failed

  63. :WinPE_x86
  64. iseq ${platform} efi && set bootfile bootia32.efi && set bcdfile efi-BCD && set wimbootfile wimboot.efi || set bootfile bootmgr && set bcdfile bios-BCD && set wimbootfile wimboot
  65. kernel ${boot-url}/${wimbootfile}      || goto Failed
  66. initrd ${boot-url}/boot/${bootfile}    || goto Failed        
  67. initrd ${boot-url}/boot/${bcdfile} BCD || goto Failed           
  68. initrd ${boot-url}/boot/boot.sdi       || goto Failed            
  69. initrd ${boot-url}/sources/boot32.wim  || goto Failed         
  70. boot || goto Failed
  71. goto start

  72. :WinPE_x64
  73. iseq ${platform} efi && set bootfile bootix64.efi && set bcdfile efi-bcd && set wimbootfile wimboot.efi || set bootfile bootmgr && set bcdfile bios-bcd && set wimbootfile wimboot
  74. kernel ${boot-url}/${wimbootfile} ${wimbootfile} || goto Failed
  75. initrd ${boot-url}/boot/${bootfile}  ${bootfile} || goto Failed
  76. initrd ${boot-url}/boot/${bcdfile}           BCD || goto Failed
  77. initrd ${boot-url}/boot/boot.sdi        BOOT.SDI || goto Failed
  78. initrd  ${boot-url}/sources/boot64.wim  boot.wim || goto Failed
  79. boot || goto Failed
  80. goto start
  81.    
  82. :TinyCore
  83. kernel ${boot-url}/sources/vmlinuz root=/dev/null vga=788 autologin     || goto Failed
  84. initrd ${boot-url}/sources/core.gz    || goto Failed
  85. boot || goto Failed
  86.    
  87. :Slitaz
  88. kernel ${boot-url}/sources/bzImage root=/dev/null vga=788 autologin     || goto Failed
  89. initrd ${boot-url}/sources/rootfs.gz    || goto Failed
  90. boot || goto Failed

  91. :kolibri
  92. initrd ${boot-url}/images/kolibri.img   || goto Failed
  93. chain ${boot-url}/memdisk img raw       || goto Failed
  94. boot || goto Failed

  95. :menuetos
  96. initrd ${boot-url}/images/menuetos.img   || goto Failed
  97. chain ${boot-url}/memdisk img raw       || goto Failed
  98. boot || goto Failed

  99. :gocloud
  100. chain ${boot-url}/oppxeins       || goto Failed
  101. boot || goto Failed

  102. :memtest
  103. chain ${boot-url}/images/memtest || goto Failed
  104. boot || goto Faild
  105. goto start
  106.   

  107. :GhostDos
  108. initrd ${boot-url}/images/ghost.img   || goto Failed
  109. chain ${boot-url}/memdisk img raw     || goto Failed
  110. boot || goto Failed

  111. :MaxDos
  112. initrd ${boot-url}/images/MAXDOS.img      || goto Failed
  113. chain ${boot-url}/memdisk ima raw         || goto Failed
  114. boot || goto Failed

  115. :Failed
  116. echo Booting Failed, dropping to shell
  117. goto shell
  118.    
  119. :shell
  120. echo Type exit to get the back to the menu
  121. shell
  122. set menu-timeout 0
  123. goto start


  124. :reboot
  125. reboot

  126. :Power
  127. poweroff

  128. :exit
  129. exit

  130. :config
  131. config
  132. goto start
复制代码

点评

我不知道仔细读了TinyPXE的菜单没有,记不起了。不过我还是坚持把bios和efi分开的观点。毕竟差异比较大,efi中的工具也少,不然要不断地进行判断,人为增加菜单难度,牺牲可读性没必要。何况efi中还有32位与64位要判  详情 回复 发表于 2021-4-14 16:53
回复

使用道具 举报

 楼主| 发表于 2021-4-14 16:53:52 | 显示全部楼层
邪恶海盗 发表于 2021-4-14 16:10
我的菜单,貌似是用的TinyPXE的改的:

我不知道仔细读了TinyPXE的菜单没有,记不起了。不过我还是坚持把bios和efi分开的观点。毕竟差异比较大,efi中的工具也少,不然要不断地进行判断,人为增加菜单难度,牺牲可读性没必要。何况efi中还有32位与64位要判断。

点评

不需要分开,更不需要判断环境,完你还可以交给电脑自己来判断,脑洞够大的据说还可以这样写  详情 回复 发表于 2021-4-14 18:02
我觉得我的菜单可读性还是不错的,当然每个人的习惯不一样,适合自己的才是最好的  详情 回复 发表于 2021-4-14 17:22
回复

使用道具 举报

发表于 2021-4-14 17:22:18 | 显示全部楼层
hhh333 发表于 2021-4-14 16:53
我不知道仔细读了TinyPXE的菜单没有,记不起了。不过我还是坚持把bios和efi分开的观点。毕竟差异比较大, ...

我觉得我的菜单可读性还是不错的,当然每个人的习惯不一样,适合自己的才是最好的
回复

使用道具 举报

发表于 2021-4-14 18:02:50 | 显示全部楼层
本帖最后由 江南一根葱 于 2021-4-14 18:58 编辑
hhh333 发表于 2021-4-14 16:53
我不知道仔细读了TinyPXE的菜单没有,记不起了。不过我还是坚持把bios和efi分开的观点。毕竟差异比较大, ...

不需要分开,更不需要判断,脑洞够大的话,据说还可以这样写
  • :wimmenu
  • menu wimfile
  •    item --gap Choose Resolution ratio
  •    item --key 1 win8.wim           1. win8pe
  •    item --key 2 win9.wim           2. win9pe
  •    item --key 3 win10.wim          3. win10pe
  •    item --key m menu             M. Back to menu
  • choose --timeout ${bootfile-timeout} --default 800x600 selected ||
  • iseq ${selected} menu && goto menu ||
  • set wim ${selected} && goto wimboot ||
  • :wimboot
  • kernel ${booturl}/app/wimboot/wimboot ||
  • initrd ${booturl}/app/wimboot/bootmgr.exe bootmgr.exe ||
  • initrd ${booturl}/app/wimboot/bootx64.efi bootx64.efi ||
  • initrd ${booturl}/app/wimboot/bootia32.efi bootia32.efi ||
  • initrd ${booturl}/app/wimboot/bcd bcd ||
  • initrd ${booturl}/app/wimboot/boot.sdi boot.sdi ||
  • initrd -n boot.wim ${booturl}/${wim}  boot.wim ||
  • boot || goto wimmenu

通吃bios/uefi64/uefi32

点评

呵,三个启动都down下来,确实也是个思路,不过不经济吧,浪费两个文件  详情 回复 发表于 2021-4-15 10:07
回复

使用道具 举报

发表于 2021-4-15 00:32:39 | 显示全部楼层
神贴,看来我的菜单还是小儿科了
回复

使用道具 举报

 楼主| 发表于 2021-4-15 10:07:24 | 显示全部楼层
江南一根葱 发表于 2021-4-14 18:02
不需要分开,更不需要判断,脑洞够大的话,据说还可以这样写
  • :wimmenu
  • menu wimfile

  • 呵,三个启动都down下来,确实也是个思路,不过不经济吧,浪费两个文件

    点评

    哈哈,你更浪费啊,,每个wim都配一份bcd和bootmgfw.efi, 用你的文件的话,连wimboot都不需要的  详情 回复 发表于 2021-4-15 10:47
    回复

    使用道具 举报

    发表于 2021-4-15 10:47:57 | 显示全部楼层
    本帖最后由 江南一根葱 于 2021-4-15 10:49 编辑
    hhh333 发表于 2021-4-15 10:07
    呵,三个启动都down下来,确实也是个思路,不过不经济吧,浪费两个文件

    哈哈,你更浪费啊,,每个wim都配一份bcd和bootmgfw.efi,
    用你的文件的话,连wimboot都不需要的,而且,这样让电脑自己去判断,还不会出错,“代码”也有高强的可读性

    点评

    我浪费几个字,你浪费流量,就这区别  详情 回复 发表于 2021-4-15 11:45
    回复

    使用道具 举报

     楼主| 发表于 2021-4-15 11:45:18 | 显示全部楼层
    江南一根葱 发表于 2021-4-15 10:47
    哈哈,你更浪费啊,,每个wim都配一份bcd和bootmgfw.efi,
    用你的文件的话,连wimboot都不需要 ...

    我浪费几个字,你浪费流量,就这区别

    点评

    [*]喜欢改文件名且又想节省几m流量的话,再加个判断,这样写姿势更丰富,更容易看懂(个人觉得)。 #判断 [*]issq ${platform} pcbios && set msboot bootmgr.exe || [*]issq ${platform} efi && set msboo  详情 回复 发表于 2021-4-15 13:43
    回复

    使用道具 举报

    发表于 2021-4-15 13:43:44 | 显示全部楼层
    hhh333 发表于 2021-4-15 11:45
    我浪费几个字,你浪费流量,就这区别

    • 喜欢改文件名且又想节省几m流量的话,再加个判断,这样写姿势更丰富,更容易看懂(个人觉得)。
         #判断
    • issq ${platform} pcbios && set msboot bootmgr.exe ||
    • issq ${platform} efi && set msboot bootx64.efi ||
         #启动
    • :wimboot
    • kernel ${booturl}/app/wimboot/wimboot ||
    • initrd ${booturl}/app/wimboot/${msboot} ${msboot} ||
    • initrd ${booturl}/app/wimboot/bcd bcd ||
    • initrd ${booturl}/app/wimboot/boot.sdi boot.sdi ||
    • initrd -n boot.wim ${booturl}/${wim}  boot.wim ||
    • boot || goto wimmenu
    至于其它提高代码可读性的方法,我觉得稍对齐些(完全遵守缩进规则太难),用notepad艹打开编辑,完全没问题。

    回复

    使用道具 举报

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

    本版积分规则

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

    闽公网安备 35020302032614号

    GMT+8, 2024-4-19 09:19

    Powered by Discuz! X3.3

    © 2001-2017 Comsenz Inc.

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