Skip to content

Instantly share code, notes, and snippets.

@andrearug
Forked from robinsmidsrod/_README.md
Created May 1, 2018 01:45
Show Gist options
  • Save andrearug/46d6d4cc1c5120a1d25cd8397f657a40 to your computer and use it in GitHub Desktop.
Save andrearug/46d6d4cc1c5120a1d25cd8397f657a40 to your computer and use it in GitHub Desktop.

Revisions

  1. @robinsmidsrod robinsmidsrod revised this gist Aug 2, 2013. 2 changed files with 6 additions and 11 deletions.
    2 changes: 1 addition & 1 deletion _README.md
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,4 @@ Build iPXE like this:

    cd src && make EMBED=../nic-menu.ipxe && cd ..

    Requirements: current iPXE as of 2013-07-15 (for proper behavior of autoboot with a network device specified, netX feature and PCI vendor/device ID display)
    Requirements: current iPXE as of 2013-08-01 (for proper behavior of autoboot with a network device specified, netX feature, PCI vendor/device ID display and inc command)
    15 changes: 5 additions & 10 deletions nic-menu.ipxe
    Original file line number Diff line number Diff line change
    @@ -7,16 +7,11 @@ menu Network boot options for ${uuid}
    item --key a default Try to boot (a)ll network adapters in turn
    item
    item --gap -- --- Detected network adapters ---
    ifopen net0 && item --key 0 net0 net(0): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net1 && item --key 1 net1 net(1): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net2 && item --key 2 net2 net(2): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 3 net3 net(3): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 4 net4 net(4): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 5 net5 net(5): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 6 net6 net(6): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 7 net7 net(7): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 8 net8 net(8): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 9 net9 net(9): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    set i:int8 0
    :loop
    ifopen net${i} && item --key ${i} net${i} net(${i}): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    inc i
    iseq ${i} 10 || goto loop
    item
    item --gap -- --- Alternatives ---
    item --key c config Open (c)onfiguration
  2. @robinsmidsrod robinsmidsrod revised this gist Jul 16, 2013. 2 changed files with 42 additions and 54 deletions.
    4 changes: 2 additions & 2 deletions _README.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    Go into your git checkout folder of ipxe.

    Save the below file as `nic_menu.ipxe`.
    Save the below file as `nic-menu.ipxe`.

    Build iPXE like this:

    cd src && make EMBED=../nic-menu.ipxe && cd ..

    Requirements: current iPXE as of 2013-07-13
    Requirements: current iPXE as of 2013-07-15 (for proper behavior of autoboot with a network device specified, netX feature and PCI vendor/device ID display)
    92 changes: 40 additions & 52 deletions nic-menu.ipxe
    Original file line number Diff line number Diff line change
    @@ -1,78 +1,66 @@
    #!ipxe

    set timeout 1000

    :menu
    menu Network boot options for ${uuid}
    item --key d all Try to boot (a)ll adapters in turn
    item --key a default Try to boot (a)ll network adapters in turn
    item
    item --gap -- --- Detected network adapters ---
    ifopen net0 && goto setup-net0 || ifclose net0 ||
    :menu-net1
    ifopen net1 && goto setup-net1 || ifclose net1 ||
    :menu-net2
    ifopen net2 && goto setup-net2 || ifclose net2 ||
    :menu-net3
    ifopen net3 && goto setup-net3 || ifclose net3 ||
    :menu-bottom
    ifopen net0 && item --key 0 net0 net(0): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net1 && item --key 1 net1 net(1): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net2 && item --key 2 net2 net(2): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 3 net3 net(3): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 4 net4 net(4): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 5 net5 net(5): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 6 net6 net(6): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 7 net7 net(7): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 8 net8 net(8): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    ifopen net3 && item --key 9 net9 net(9): ${netX/mac} - ${netX/bustype} ${netX/busloc:busdevfn} ${pci/${netX/busloc}.0.2}:${pci/${netX/busloc}.2.2} ${netX/chip} ; ifclose
    item
    item --gap -- --- Alternatives ---
    item --key c config Open (c)onfiguration
    item --key r reboot (R)eboot computer
    item --key s shell Drop to iPXE (s)hell
    item --key x exit E(x)it and continue BIOS boot order
    choose --timeout 1000 --default all selected && goto ${selected} || goto default
    choose --timeout ${timeout} selected && goto select || goto default
    goto menu

    :setup-net0
    item --key 0 net0 Boot adapter (0): ${net0/bustype} ${net0/busloc:busdevfn} - ${net0/mac} - ${pci/${net0/busloc}.0.2}:${pci/${net0/busloc}.2.2} - ${net0/chip}
    ifclose net0 ||
    goto menu-net1
    :select
    isset ${${selected}/mac} && goto nic || goto label

    :setup-net1
    item --key 1 net1 Boot adapter (1): ${net1/bustype} ${net1/busloc:busdevfn} - ${net1/mac} - ${pci/${net1/busloc}.0.2}:${pci/${net1/busloc}.2.2} - ${net1/chip}
    ifclose net1 ||
    goto menu-net2
    :nic
    autoboot ${selected} && goto exit ||
    echo Booting '${selected}' failed, exiting iPXE...
    goto exit

    :setup-net2
    item --key 2 net2 Boot adapter (2): ${net2/bustype} ${net2/busloc:busdevfn} - ${net2/mac} - ${pci/${net2/busloc}.0.2}:${pci/${net2/busloc}.2.2} - ${net2/chip}
    ifclose net2 ||
    goto menu-net3
    :label
    goto ${selected} ||
    echo The label '${selected}' could not be found, returning to menu...
    sleep 2
    goto restart

    :setup-net3
    item --key 3 net3 Boot adapter (3): ${net2/bustype} ${net2/busloc:busdevfn} - ${net3/mac} - ${pci/${net3/busloc}.0.2}:${pci/${net3/busloc}.2.2} - ${net3/chip}
    ifclose net3 ||
    goto menu-bottom
    :default
    autoboot && goto exit ||
    echo Booting failed, exiting iPXE...
    goto exit

    :config
    config
    goto menu
    goto restart

    :shell
    shell
    goto menu

    :exit
    exit
    goto restart

    :all
    :default
    autoboot || goto failed
    exit

    :net0
    ifopen net0 || goto failed
    goto autoboot

    :net1
    ifopen net1 || goto failed
    goto autoboot

    :net2
    ifopen net2 || goto failed
    goto autoboot
    :restart
    set timeout 0
    goto menu

    :net3
    ifopen net3 || goto failed
    goto autoboot
    :reboot
    reboot

    :autoboot
    autoboot netX || goto failed
    :exit
    echo Continuing BIOS boot order...
    sleep 1
    exit
  3. @robinsmidsrod robinsmidsrod revised this gist Jul 13, 2013. 2 changed files with 23 additions and 20 deletions.
    2 changes: 2 additions & 0 deletions _README.md
    Original file line number Diff line number Diff line change
    @@ -5,3 +5,5 @@ Save the below file as `nic_menu.ipxe`.
    Build iPXE like this:

    cd src && make EMBED=../nic-menu.ipxe && cd ..

    Requirements: current iPXE as of 2013-07-13
    41 changes: 21 additions & 20 deletions nic-menu.ipxe
    Original file line number Diff line number Diff line change
    @@ -15,31 +15,36 @@ ifopen net3 && goto setup-net3 || ifclose net3 ||
    :menu-bottom
    item
    item --gap -- --- Alternatives ---
    item --key c config Open (c)onfiguration
    item --key s shell Drop to iPXE (s)hell
    item --key x exit E(x)it and continue BIOS boot order
    choose --timeout 2000 --default all selected && goto ${selected} || goto default
    choose --timeout 1000 --default all selected && goto ${selected} || goto default
    goto menu

    :setup-net0
    item --key 0 net0 Boot adapter (0): ${net0/busid} - ${net0/mac}
    item --key 0 net0 Boot adapter (0): ${net0/bustype} ${net0/busloc:busdevfn} - ${net0/mac} - ${pci/${net0/busloc}.0.2}:${pci/${net0/busloc}.2.2} - ${net0/chip}
    ifclose net0 ||
    goto menu-net1

    :setup-net1
    item --key 1 net1 Boot adapter (1): ${net1/busid} - ${net1/mac}
    item --key 1 net1 Boot adapter (1): ${net1/bustype} ${net1/busloc:busdevfn} - ${net1/mac} - ${pci/${net1/busloc}.0.2}:${pci/${net1/busloc}.2.2} - ${net1/chip}
    ifclose net1 ||
    goto menu-net2

    :setup-net2
    item --key 2 net2 Boot adapter (2): ${net2/busid} - ${net2/mac}
    item --key 2 net2 Boot adapter (2): ${net2/bustype} ${net2/busloc:busdevfn} - ${net2/mac} - ${pci/${net2/busloc}.0.2}:${pci/${net2/busloc}.2.2} - ${net2/chip}
    ifclose net2 ||
    goto menu-net3

    :setup-net3
    item --key 3 net3 Boot adapter (3): ${net3/busid} - ${net3/mac}
    item --key 3 net3 Boot adapter (3): ${net2/bustype} ${net2/busloc:busdevfn} - ${net3/mac} - ${pci/${net3/busloc}.0.2}:${pci/${net3/busloc}.2.2} - ${net3/chip}
    ifclose net3 ||
    goto menu-bottom

    :config
    config
    goto menu

    :shell
    shell
    goto menu
    @@ -49,29 +54,25 @@ exit

    :all
    :default
    goto autoboot
    autoboot || goto failed
    exit

    :net0
    set nic net0
    goto specific
    ifopen net0 || goto failed
    goto autoboot

    :net1
    set nic net1
    goto specific
    ifopen net1 || goto failed
    goto autoboot

    :net2
    set nic net2
    goto specific
    ifopen net2 || goto failed
    goto autoboot

    :net3
    set nic net3
    goto specific

    :specific
    ifopen ${nic}
    dhcp ${nic}
    set use-cached 1
    ifopen net3 || goto failed
    goto autoboot

    :autoboot
    autoboot
    autoboot netX || goto failed
    exit
  4. @robinsmidsrod robinsmidsrod revised this gist Oct 11, 2012. 1 changed file with 3 additions and 8 deletions.
    11 changes: 3 additions & 8 deletions nic-menu.ipxe
    Original file line number Diff line number Diff line change
    @@ -52,31 +52,26 @@ exit
    goto autoboot

    :net0
    ifopen net0
    dhcp net0
    set nic net0
    goto specific

    :net1
    ifopen net1
    dhcp net1
    set nic net1
    goto specific

    :net2
    ifopen net2
    dhcp net2
    set nic net2
    goto specific

    :net3
    ifopen net3
    dhcp net3
    set nic net3
    goto specific

    :specific
    ifopen ${nic}
    dhcp ${nic}
    set use-cached 1

    :autoboot
    autoboot
    exit
  5. @robinsmidsrod robinsmidsrod revised this gist Oct 11, 2012. 2 changed files with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion _README.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ Save the below file as `nic_menu.ipxe`.

    Build iPXE like this:

    cd src && make EMBED=../nic_menu.ipxe && cd ..
    cd src && make EMBED=../nic-menu.ipxe && cd ..
    File renamed without changes.
  6. @robinsmidsrod robinsmidsrod revised this gist Oct 11, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion _README.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ Save the below file as `nic_menu.ipxe`.

    Build iPXE like this:

    cd src && make bin/ipxe.pxe EMBED=../nic_menu.ipxe && cd ..
    cd src && make EMBED=../nic_menu.ipxe && cd ..
  7. @robinsmidsrod robinsmidsrod revised this gist Oct 11, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion _README.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,6 @@ Go into your git checkout folder of ipxe.

    Save the below file as `nic_menu.ipxe`.

    Build iPXE normally like this:
    Build iPXE like this:

    cd src && make bin/ipxe.pxe EMBED=../nic_menu.ipxe && cd ..
  8. @robinsmidsrod robinsmidsrod revised this gist Oct 11, 2012. 2 changed files with 46 additions and 26 deletions.
    7 changes: 7 additions & 0 deletions _README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Go into your git checkout folder of ipxe.

    Save the below file as `nic_menu.ipxe`.

    Build iPXE normally like this:

    cd src && make bin/ipxe.pxe EMBED=../nic_menu.ipxe && cd ..
    65 changes: 39 additions & 26 deletions nic_menu.ipxe
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,42 @@
    #!ipxe

    :menu
    menu Choose network adapter to boot
    item default Try to boot each adapter in turn
    menu Network boot options for ${uuid}
    item --key d all Try to boot (a)ll adapters in turn
    item
    item --gap -- Detected network adapters --
    ifopen net0 && goto setup-net0 || ifclose net0
    ifopen net1 && goto setup-net1 || ifclose net1
    ifopen net2 && goto setup-net2 || ifclose net2
    ifopen net3 && goto setup-net3 || ifclose net3
    item --gap -- --- Detected network adapters ---
    ifopen net0 && goto setup-net0 || ifclose net0 ||
    :menu-net1
    ifopen net1 && goto setup-net1 || ifclose net1 ||
    :menu-net2
    ifopen net2 && goto setup-net2 || ifclose net2 ||
    :menu-net3
    ifopen net3 && goto setup-net3 || ifclose net3 ||
    :menu-bottom
    item
    item --gap -- Alternatives --
    item shell Drop to iPXE shell
    item exit Exit and continue BIOS boot order
    choose --timeout 2000 --default default selected && goto ${selected} || goto default
    item --gap -- --- Alternatives ---
    item --key s shell Drop to iPXE (s)hell
    item --key x exit E(x)it and continue BIOS boot order
    choose --timeout 2000 --default all selected && goto ${selected} || goto default
    goto menu

    :setup-net0
    item net0 Boot adapter ${net0/busid} ||
    item --key 0 net0 Boot adapter (0): ${net0/busid} - ${net0/mac}
    ifclose net0 ||
    goto menu-bottom
    goto menu-net1

    :setup-net1
    item net1 Boot adapter ${net1/busid} ||
    item --key 1 net1 Boot adapter (1): ${net1/busid} - ${net1/mac}
    ifclose net1 ||
    goto menu-bottom
    goto menu-net2

    :setup-net2
    item net2 Boot adapter ${net2/busid} ||
    item --key 2 net2 Boot adapter (2): ${net2/busid} - ${net2/mac}
    ifclose net2 ||
    goto menu-bottom
    goto menu-net3

    :setup-net3
    item net3 Boot adapter ${net3/busid} ||
    item --key 3 net3 Boot adapter (3): ${net3/busid} - ${net3/mac}
    ifclose net3 ||
    goto menu-bottom

    @@ -44,26 +47,36 @@ goto menu
    :exit
    exit

    :all
    :default
    autoboot
    exit
    goto autoboot

    :net0
    ifopen net0
    dhcp net0
    autoboot
    exit
    set nic net0
    goto specific

    :net1
    ifopen net1
    dhcp net1
    autoboot
    exit
    set nic net1
    goto specific

    :net2
    ifopen net2
    dhcp net2
    autoboot
    exit
    set nic net2
    goto specific

    :net3
    ifopen net3
    dhcp net3
    set nic net3
    goto specific

    :specific
    set use-cached 1
    :autoboot
    autoboot
    exit
  9. @robinsmidsrod robinsmidsrod renamed this gist Oct 11, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. @robinsmidsrod robinsmidsrod revised this gist Oct 11, 2012. No changes.
  11. @robinsmidsrod robinsmidsrod revised this gist Oct 11, 2012. 1 changed file with 40 additions and 8 deletions.
    48 changes: 40 additions & 8 deletions dhcp_menu.ipxe
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,45 @@
    #!ipxe

    menu Choose interface to boot
    item default Just use the first working one
    ifopen net0 && item net0 ${net0/busid} || ifclose net0
    ifopen net1 && item net1 ${net1/busid} || ifclose net1
    ifopen net2 && item net2 ${net2/busid} || ifclose net2
    ifopen net3 && item net3 ${net3/busid} || ifclose net3
    item exit Skip booting from the network
    choose --timeout 5000 --default default selected && goto ${selected} || goto default
    :menu
    menu Choose network adapter to boot
    item default Try to boot each adapter in turn
    item
    item --gap -- Detected network adapters --
    ifopen net0 && goto setup-net0 || ifclose net0
    ifopen net1 && goto setup-net1 || ifclose net1
    ifopen net2 && goto setup-net2 || ifclose net2
    ifopen net3 && goto setup-net3 || ifclose net3
    :menu-bottom
    item
    item --gap -- Alternatives --
    item shell Drop to iPXE shell
    item exit Exit and continue BIOS boot order
    choose --timeout 2000 --default default selected && goto ${selected} || goto default
    goto menu

    :setup-net0
    item net0 Boot adapter ${net0/busid} ||
    ifclose net0 ||
    goto menu-bottom

    :setup-net1
    item net1 Boot adapter ${net1/busid} ||
    ifclose net1 ||
    goto menu-bottom

    :setup-net2
    item net2 Boot adapter ${net2/busid} ||
    ifclose net2 ||
    goto menu-bottom

    :setup-net3
    item net3 Boot adapter ${net3/busid} ||
    ifclose net3 ||
    goto menu-bottom

    :shell
    shell
    goto menu

    :exit
    exit
  12. @robinsmidsrod robinsmidsrod created this gist Oct 11, 2012.
    37 changes: 37 additions & 0 deletions dhcp_menu.ipxe
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    #!ipxe

    menu Choose interface to boot
    item default Just use the first working one
    ifopen net0 && item net0 ${net0/busid} || ifclose net0
    ifopen net1 && item net1 ${net1/busid} || ifclose net1
    ifopen net2 && item net2 ${net2/busid} || ifclose net2
    ifopen net3 && item net3 ${net3/busid} || ifclose net3
    item exit Skip booting from the network
    choose --timeout 5000 --default default selected && goto ${selected} || goto default

    :exit
    exit

    :default
    autoboot
    exit

    :net0
    dhcp net0
    autoboot
    exit

    :net1
    dhcp net1
    autoboot
    exit

    :net2
    dhcp net2
    autoboot
    exit

    :net3
    dhcp net3
    autoboot
    exit