summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2011-01-28 13:44:06 +0100
committerDidier Raboud <odyx@debian.org>2011-01-28 17:55:27 +0100
commit61e7dae042308d010ff897c7a7df9e98ac030be7 (patch)
tree0aeb0dda95bcd0114bfbd3dee9d2677afcc9e2c7
parent87e172dac3e57cbb4524fa88453dd2c99398ecb3 (diff)
Add PXE functionality (Closes: #607417)
Thanks to: Papakirikou Vaggelis <papakiru@cti.gr> Georgopoulos Alkis <alkisg@gmail.com> Siahos Yannis <Siahos@cti.gr> for the patch.
-rw-r--r--Makefile16
-rw-r--r--l10n/win32-loader.c1
-rw-r--r--main.nsi68
-rw-r--r--templates/ternary_choice.ini33
4 files changed, 114 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 911c8e5..ada77c4 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,11 @@ ifdef NETWORK_BASE_URL
MAKENSIS += -DNETWORK_BASE_URL=$(NETWORK_BASE_URL) -DNOCD=yes
endif
+# PXE version (which is standalone too)
+ifdef PXE
+MAKENSIS += -DPXE=yes -DNOCD=yes
+endif
+
# hard disk
GRUB_MODULES += biosdisk
# partmap
@@ -35,6 +40,10 @@ GRUB_MODULES += fat ntfs ntfscomp
GRUB_MODULES += search linux bsd vbe boot
# might be useful for debugging
GRUB_MODULES += minicmd cat cpuid chain halt help ls reboot
+ifdef PXE
+# Booting the pxe.lkrn requires linux16
+GRUB_MODULES += linux16
+endif
all: win32-loader.exe g2ldr g2ldr.mbr
@@ -53,9 +62,16 @@ loadlin.pif: genpif
loadlin.exe: /usr/lib/loadlin/loadlin.exe.gz
gunzip -c $^ > $@
+ifdef PXE
+pxe.target: pxe.lkrn templates/ternary_choice.ini
+else
+pxe.target:
+endif
+
win32-loader.exe: main.nsi maps.ini \
templates/binary_choice.ini templates/graphics.ini templates/custom.ini templates/4_choices.ini \
plugins/cpuid/test64.dll plugins/systeminfo/systeminfo.dll plugins/string.dll \
+ pxe.target \
swirl.ico license loadlin.pif loadlin.exe g2ldr g2ldr.mbr
$(MAKE) -C l10n
$(MAKENSIS) main.nsi
diff --git a/l10n/win32-loader.c b/l10n/win32-loader.c
index 1eb1877..bcc847d 100644
--- a/l10n/win32-loader.c
+++ b/l10n/win32-loader.c
@@ -89,6 +89,7 @@ main (int argc, char **argv)
langstring ("expert1", _("Select install mode:"));
langstring ("expert2", _("Normal mode. Recommended for most users."));
langstring ("expert3", _("Expert mode. Recommended for expert users who want full control of the install process."));
+ langstring ("expert4", _("PXE mode: install a PXE loader to allow remote kernel loading."));
langstring ("rescue1", _("Select action:"));
langstring ("rescue2", _("Begin install on this computer."));
langstring ("rescue3", _("Repair an installed system (rescue mode)."));
diff --git a/main.nsi b/main.nsi
index 6431f70..53e7a4c 100644
--- a/main.nsi
+++ b/main.nsi
@@ -212,22 +212,42 @@ c_is_initialized:
StrCpy $INSTDIR "$c\win32-loader"
SetOutPath $INSTDIR
+!ifdef PXE
+ File /oname=$PLUGINSDIR\expert.ini templates/ternary_choice.ini
+ WriteINIStr $PLUGINSDIR\expert.ini "Field 4" "Text" $(expert4)
+!else ;PXE
File /oname=$PLUGINSDIR\expert.ini templates/binary_choice.ini
+!endif ;PXE
WriteINIStr $PLUGINSDIR\expert.ini "Field 1" "Text" $(expert1)
WriteINIStr $PLUGINSDIR\expert.ini "Field 2" "Text" $(expert2)
WriteINIStr $PLUGINSDIR\expert.ini "Field 3" "Text" $(expert3)
InstallOptions::dialog $PLUGINSDIR\expert.ini
Var /GLOBAL expert
- ReadINIStr $0 $PLUGINSDIR\expert.ini "Field 3" "State"
+!ifdef PXE
+ Var /GLOBAL pxe_mode
+ ReadINIStr $0 $PLUGINSDIR\expert.ini "Field 4" "State"
${If} $0 == "1"
- StrCpy $expert true
- ${Else}
+ StrCpy $pxe_mode true
StrCpy $expert false
- ${Endif}
+ ${Else}
+ StrCpy $pxe_mode false
+!endif ; PXE
+ ReadINIStr $0 $PLUGINSDIR\expert.ini "Field 3" "State"
+ ${If} $0 == "1"
+ StrCpy $expert true
+ ${Else}
+ StrCpy $expert false
+ ${Endif}
+!ifdef PXE
+ ${Endif} ; Field 4 (PXE) checked ?
+!endif ;PXE
FunctionEnd
Function ShowRescue
+!ifdef PXE
+ ${If} $pxe_mode == "false"
+!endif ;PXE
File /oname=$PLUGINSDIR\rescue.ini templates/binary_choice.ini
WriteINIStr $PLUGINSDIR\rescue.ini "Field 1" "Text" $(rescue1)
WriteINIStr $PLUGINSDIR\rescue.ini "Field 2" "Text" $(rescue2)
@@ -240,6 +260,9 @@ Function ShowRescue
$preseed_cfg$\n\
d-i rescue/enable boolean true"
${Endif}
+!ifdef PXE
+ ${Endif} ; $pxe_mode == "false"
+!endif ;PXE
FunctionEnd
Function ShowKernel
@@ -670,6 +693,9 @@ Section "Installer Loader"
Quit
${EndIf}
!else
+!ifdef PXE
+ ${If} $pxe_mode == "false"
+!endif ;PXE
${If} $kernel == "linux"
Push "false"
Push "linux"
@@ -693,6 +719,9 @@ Section "Installer Loader"
Push "$base_url"
Call Download
${EndIf}
+!ifdef PXE
+ ${EndIf} ; $pxe_mode == "false"
+!endif ;PXE
!endif
; We're about to write down our preseed line. This would be a nice place
@@ -708,6 +737,13 @@ Section "Installer Loader"
StrCpy $0 "$c\win32-loader\grub.cfg"
DetailPrint "$(generating)"
FileOpen $0 $c\win32-loader\grub.cfg w
+!ifdef PXE
+ ${If} $pxe_mode == "true"
+ FileWrite $0 "\
+linux16 /win32-loader/pxe.lkrn$\n\
+boot$\n"
+ ${Else}
+!endif ;PXE
${If} $kernel == "linux"
FileWrite $0 "\
linux /win32-loader/linux $preseed_cmdline$\n\
@@ -722,8 +758,14 @@ set kFreeBSD.hw.ata.ata_dma=0 # needed for qemu hard disk # TODO: delete$\n\
set kFreeBSD.hw.ata.atapi_dma=0 # needed for qemu cd # TODO: 1$\n\
boot$\n"
${EndIf}
+!ifdef PXE
+ ${EndIf} ; $pxe_mode == "true"
+!endif ;PXE
FileClose $0
+!ifdef PXE
+ ${If} $pxe_mode == "false"
+!endif ; PXE
; ********************************************** cpio hack
File /oname=$INSTDIR\cpio.exe /usr/share/win32/cpio.exe
File /oname=$INSTDIR\gzip.exe /usr/share/win32/gzip.exe
@@ -761,6 +803,9 @@ ${If} $kernel == "linux"
Quit
${Endif}
${EndIf}
+!ifdef PXE
+ ${EndIf} ; $pxe_mode == "false"
+!endif ; PXE
; ********************************************** Do bootloader last, because it's the most dangerous
${If} $windows_boot_method == ntldr
@@ -779,6 +824,11 @@ ${EndIf}
!else
File /oname=$c\g2ldr g2ldr
File /oname=$c\g2ldr.mbr g2ldr.mbr
+ !ifdef PXE
+ ${If} $pxe_mode == "true"
+ File /oname=$INSTDIR\pxe.lkrn pxe.lkrn
+ ${EndIf} ; $pxe_mode == "true"
+ !endif ; PXE
!endif
!else
ClearErrors
@@ -833,6 +883,11 @@ ${EndIf}
!else
File /oname=$c\g2ldr g2ldr
File /oname=$c\g2ldr.mbr g2ldr.mbr
+ !ifdef PXE
+ ${If} $pxe_mode == "true"
+ File /oname=$INSTDIR\pxe.lkrn pxe.lkrn
+ ${EndIf} ; $pxe_mode == "true"
+ !endif ; PXE
!endif
!else
ClearErrors
@@ -891,6 +946,11 @@ ${EndIf}
${ElseIf} $kernel == "kfreebsd"
nsExec::Exec '"compact" /u $INSTDIR\kfreebsd.gz $INSTDIR\initrd.gz'
${EndIf}
+!ifdef PXE
+ ${If} $pxe_mode == "true"
+ nsExec::Exec '"compact" /u $INSTDIR\pxe.lkrn'
+ ${EndIf}
+!endif ;PXE
SectionEnd
diff --git a/templates/ternary_choice.ini b/templates/ternary_choice.ini
new file mode 100644
index 0000000..9e95e2a
--- /dev/null
+++ b/templates/ternary_choice.ini
@@ -0,0 +1,33 @@
+; Ini file generated by the HM NIS Edit IO designer.
+[Settings]
+NumFields=4
+
+[Field 1]
+Type=Label
+Left=0
+Right=-1
+Top=1
+Bottom=9
+
+[Field 2]
+Type=RadioButton
+Left=3
+Right=-7
+Top=18
+Bottom=48
+State=1
+
+[Field 3]
+Type=RadioButton
+Left=3
+Right=-7
+Top=58
+Bottom=88
+
+[Field 4]
+Type=RadioButton
+Left=3
+Right=-7
+Top=98
+Bottom=128
+