diff --git a/tftpboot/grub.exe b/tftpboot/grub.exe new file mode 100644 index 0000000..529126d Binary files /dev/null and b/tftpboot/grub.exe differ diff --git a/tftpboot/ipxe_scripts/01-00:50:56:22:11:11 b/tftpboot/ipxe_scripts/01-00:50:56:22:11:11 deleted file mode 100644 index 8591b59..0000000 --- a/tftpboot/ipxe_scripts/01-00:50:56:22:11:11 +++ /dev/null @@ -1,12 +0,0 @@ -#!ipxe -set timeout 0 -set timeout-style hidden -set ISODIR ogLive -set default 0 -set kernelargs ro boot=oginit quiet splash irqpoll acpi=on og2nd=sqfs ogprotocol=smb ogactiveadmin=true ogdebug=true ogtmpfs=15 oglivedir=${ISODIR} LANG=es_ES.UTF-8 ip=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11:eth0:none group=Aula_virtual ogrepo=192.168.2.1 oglive=192.168.2.1 oglog=192.168.2.1 ogshare=192.168.2.1 ogprof=false vga=788 - -kernel tftp://172.17.8.71/ogLive/ogvmlinuz ${kernelargs} -initrd tftp://172.17.8.71/ogLive/oginitrd.img -boot - - diff --git a/tftpboot/ipxe_scripts/default.ipxe b/tftpboot/ipxe_scripts/default.ipxe index af00c40..fb785a1 100644 --- a/tftpboot/ipxe_scripts/default.ipxe +++ b/tftpboot/ipxe_scripts/default.ipxe @@ -1,14 +1,103 @@ #!ipxe -set timeout 0 -set timeout-style hidden -set ISODIR ogLive -set default 0 -set kernelargs ro boot=oginit quiet splash irqpoll acpi=on og2nd=sqfs ogprotocol=smb ogactiveadmin=true ogdebug=true ogtmpfs=15 oglivedir=${ISODIR} LANG=es_ES.UTF-8 ip=192.168.2.11:192.168.2.1:192.168.2.1:255.255.255.0:pc11:eth0:none group=Aula_virtual ogrepo=192.168.2.1 oglive=192.168.2.1 oglog=192.168.2.1 ogshare=192.168.2.1 ogprof=false vga=788 -echo "OgLive $ISODIR" -ifopen net0 -route -kernel tftp://SERVERIP/ogLive/ogvmlinuz ${kernelargs} -initrd tftp://SERVERIP/ogLive/oginitrd.img -boot +# Detectar si se está ejecutando en modo UEFI o BIOS +iseq ${platform} efi && goto uefi_menu || goto bios_mbr + +:bios_mbr +echo "Running in BIOS mode - Booting MBR" +chain tftp://172.17.8.61/grub.exe --config-file="title MBR;chainloader (hd0)+1;rootnoverify (hd0);boot" || echo "Failed to boot MBR in BIOS mode" +exit + +:uefi_menu +echo "Running in UEFI mode - Searching boot loaders" + +set detected no + +# Buscar y configurar opciones de arranque +echo "Searching Grub" +sanboot --no-describe --drive 0 --filename \EFI\grub\Boot\grubx64.efi && goto add_grub + +:add_grub +set detected yes +echo "Grub found" +goto boot_grub + +:boot_grub +echo "Booting Grub" +sanboot --no-describe --drive 0 --filename \EFI\grub\Boot\grubx64.efi || echo "Failed to boot Grub" +exit + +:refind +echo "Searching rEFInd" +sanboot --no-describe --drive 0 --filename \EFI\refind\shimx64.efi.signed && goto add_refind + +:add_refind +set detected yes +echo "rEFInd found" +goto boot_refind + +:boot_refind +echo "Booting rEFInd" +sanboot --no-describe --drive 0 --filename \EFI\refind\shimx64.efi.signed || echo "Failed to boot rEFInd" +exit + +:part_01_02 +echo "Searching Part-01-02" +sanboot --no-describe --drive 0 --filename \EFI\Part-01-02\Boot\ogloader.efi && goto add_part_01_02 + +:add_part_01_02 +set detected yes +echo "Part-01-02 found" +goto boot_part_01_02 + +:boot_part_01_02 +echo "Booting Part-01-02" +sanboot --no-describe --drive 0 --filename \EFI\Part-01-02\Boot\ogloader.efi || echo "Failed to boot Part-01-02" +exit + +:part_01_03 +echo "Searching Part-01-03" +sanboot --no-describe --drive 0 --filename \EFI\Part-01-03\Boot\ogloader.efi && goto add_part_01_03 + +:add_part_01_03 +set detected yes +echo "Part-01-03 found" +goto boot_part_01_03 + +:boot_part_01_03 +echo "Booting Part-01-03" +sanboot --no-describe --drive 0 --filename \EFI\Part-01-03\Boot\ogloader.efi || echo "Failed to boot Part-01-03" +exit + +:microsoft +echo "Searching Microsoft" +sanboot --no-describe --drive 0 --filename \EFI\Microsoft\Boot\bootmgfw.efi && goto add_microsoft + +:add_microsoft +set detected yes +echo "Microsoft Boot Manager found" +goto boot_microsoft + +:boot_microsoft +echo "Booting Microsoft Boot Manager" +sanboot --no-describe --drive 0 --filename \EFI\Microsoft\Boot\bootmgfw.efi || echo "Failed to boot Microsoft Boot Manager" +exit + +:ubuntu +echo "Searching Ubuntu" +sanboot --no-describe --drive 0 --filename \EFI\ubuntu\grubx64.efi && goto add_ubuntu + +:add_ubuntu +set detected yes +echo "Ubuntu found" +goto boot_ubuntu + +:boot_ubuntu +echo "Booting Ubuntu" +sanboot --no-describe --drive 0 --filename \EFI\ubuntu\grubx64.efi || echo "Failed to boot Ubuntu" +exit + +:no_os_detected +iseq ${detected} no && echo "OpenGnsys no ha detectado ningún sistema operativo en este equipo" +exit diff --git a/tftpboot/ipxe_scripts/templates/firstDisk b/tftpboot/ipxe_scripts/templates/firstDisk new file mode 100644 index 0000000..491c5a4 --- /dev/null +++ b/tftpboot/ipxe_scripts/templates/firstDisk @@ -0,0 +1,15 @@ +#!ipxe + +# Detectar si se está ejecutando en modo UEFI o BIOS +iseq ${platform} efi && goto uefi_boot || goto bios_boot + +:bios_boot +echo "Running in BIOS mode - Booting first disk" +chain http://__SERVERIP__/tftpboot/grub.exe --config-file="title FirstHardDisk;chainloader (hd0)+1;rootnoverify (hd0);boot" || echo "Failed to boot in BIOS mode" +exit + +:uefi_boot +echo "Running in UEFI mode - Booting first disk" +sanboot --no-describe --drive 0 --filename \EFI\grub\Boot\grubx64.efi || echo "Failed to boot in UEFI mode" +exit + diff --git a/tftpboot/ipxe_scripts/templates/firstDisk_firstPartition b/tftpboot/ipxe_scripts/templates/firstDisk_firstPartition new file mode 100644 index 0000000..fdbbe17 --- /dev/null +++ b/tftpboot/ipxe_scripts/templates/firstDisk_firstPartition @@ -0,0 +1,15 @@ +#!ipxe + +# Detectar si se está ejecutando en modo UEFI o BIOS +iseq ${platform} efi && goto uefi_boot || goto bios_boot + +:bios_boot +echo "Running in BIOS mode - Booting first disk, first partition" +chain http://__SERVERIP__/tftpboot/grub.exe --config-file="title FirstHardDisk-FirstPartition;root (hd0,0);chainloader (hd0,0)+1;boot" || echo "Failed to boot in BIOS mode" +exit + +:uefi_boot +echo "Running in UEFI mode - Booting first disk, first partition" +sanboot --no-describe --drive 0 --filename \EFI\Part-01-01\Boot\ogloader.efi || echo "Failed to boot in UEFI mode" +exit + diff --git a/tftpboot/ipxe_scripts/templates/firstDisk_secondPartition b/tftpboot/ipxe_scripts/templates/firstDisk_secondPartition new file mode 100644 index 0000000..e4d2691 --- /dev/null +++ b/tftpboot/ipxe_scripts/templates/firstDisk_secondPartition @@ -0,0 +1,15 @@ +#!ipxe + +# Detectar si se está ejecutando en modo UEFI o BIOS +iseq ${platform} efi && goto uefi_boot || goto bios_boot + +:bios_boot +echo "Running in BIOS mode - Booting first disk, second partition" +chain http://__SERVERIP__/tftpboot/grub.exe --config-file="title FirstHardDisk-SecondPartition;root (hd0,1);chainloader (hd0,1)+1;boot" || echo "Failed to boot in BIOS mode" +exit + +:uefi_boot +echo "Running in UEFI mode - Booting first disk, second partition" +sanboot --no-describe --drive 0 --filename \EFI\Part-01-02\Boot\ogloader.efi || echo "Failed to boot in UEFI mode" +exit + diff --git a/tftpboot/ipxe_scripts/templates/firstDisk_thirdPartition b/tftpboot/ipxe_scripts/templates/firstDisk_thirdPartition new file mode 100644 index 0000000..39e48c6 --- /dev/null +++ b/tftpboot/ipxe_scripts/templates/firstDisk_thirdPartition @@ -0,0 +1,15 @@ +#!ipxe + +# Detectar si se está ejecutando en modo UEFI o BIOS +iseq ${platform} efi && goto uefi_boot || goto bios_boot + +:bios_boot +echo "Running in BIOS mode - Booting first disk, third partition" +chain http://__SERVERIP__/tftpboot/grub.exe --config-file="title FirstHardDisk-ThirdPartition;root (hd0,2);chainloader (hd0,2)+1;boot" || echo "Failed to boot in BIOS mode" +exit + +:uefi_boot +echo "Running in UEFI mode - Booting first disk, third partition" +sanboot --no-describe --drive 0 --filename \EFI\Part-01-03\Boot\ogloader.efi || echo "Failed to boot in UEFI mode" +exit + diff --git a/tftpboot/ipxe_scripts/templates/pxe_default b/tftpboot/ipxe_scripts/templates/oglive similarity index 100% rename from tftpboot/ipxe_scripts/templates/pxe_default rename to tftpboot/ipxe_scripts/templates/oglive diff --git a/tftpboot/ipxe_scripts/templates/pxe b/tftpboot/ipxe_scripts/templates/pxe deleted file mode 100644 index a17e34b..0000000 --- a/tftpboot/ipxe_scripts/templates/pxe +++ /dev/null @@ -1,9 +0,0 @@ -#!ipxe -set timeout 0 -set timeout-style hidden - -set ISODIR ogLive -set default 0 -set kernelargs __INFOHOST__ -kernel tftp://__SERVERIP__/ogLive/ogvmlinuz ${kernelargs} -initrd tftp://__SERVERIP__/ogLive/oginitrd.img