Difference between revisions of "Building PXE-ready ReactOS"

From ReactOS Wiki
Jump to: navigation, search
m
(Preparing the LAN)
 
(45 intermediate revisions by 12 users not shown)
Line 1: Line 1:
This is a stub. It's conscious unlinked. '''Please do not remove/delete'''.<br />
+
<s>This sub-project has been suspended because of poor support for PXE and UEFI.</s> Not true anymore. Only UEFI is incomplete. <br />
 +
<s>You can use a Linux-Live-CD as a substitute.</s>
 +
<br />
 +
ReactOS PXE Project Team:<br />
 +
* [[User:Xpert|Xpert]]<br />
 +
* Shao of [http://www.etherboot.org/wiki/ Etherboot-project]<br />
 +
* [[User:Hpoussin|hpoussin]]
 +
* [[User:Heis_Spiter|Heis Spiter]]
 +
* [[User:BieHDC|BieHDC]]
 +
* [[User:Jedi-to-be|Jedi-to-be]] as a tester
 +
 
 +
Revision {{rev|51517}} of ReactOS introduced support for PXE boot. It is now ({{rev|65903}}) possible to completely load the OS in LiveCD mode from a client computer. Since revision [https://github.com/reactos/reactos/commit/9d1ee2400a64f14764edda1199828dd8467c62eb 0.4.11-dev-165-g9d1ee24] ReactOS can be also installed on hard-drive via PXE boot-strapping.<br>
 +
Freeldr must be compiled with GCC (MSVC builds present a bug at the moment), the rest can be compiled either by GCC or MSVC.
 +
 
 +
== Preparing the LAN ==
 +
 
 +
For this scenario, we need two computers. One client (may be diskless or empty HDD) and one server (Windows, or better, Linux). Both must be connected to the local network.
 +
 
 +
The server must run a DHCP-server and a TFTP-server. The client must have a PXE-ready network card (most onboard network cards support it) and not less than 300-400 MB of RAM installed.
 +
 
 +
== Preparing the server ==
 +
Install a TFTP server and a DHCP server on the remote computer. These steps will be only lightly covered here.
 +
Let's assume now that your TFTP server root is in /path/to/tftpboot, and that PXE boot filename is pxelinux.0
  
ReactOS PXE Project Team:<br />
+
== Creating contents on TFTP server ==
[[User:Xpert|Xpert]]<br />
+
 
Mambo<br />
+
Download the ReactOS LiveCD and/or BootCD ISO file(s) [https://www.reactos.org/download here]
Tux.<br />
+
 
Fernandoc1<br />
+
Put the ISO file(s) in ''/path/to/tftpboot'' with the name ''ReactOS-LiveCD.iso'' and ''ReactOS-BootCD.iso''
 +
 
 +
Extract ''loader/freeldr.sys'' to ''/path/to/tftpboot'' in case of BootCD '''OR''' <br>
 +
Extract ''loader/setupldr.sys'' to ''/path/to/tftpboot'', and rename it to ''freeldr.sys'' in case of LiveCD
 +
 
 +
You must download SysLinux 4.05, or a more recent version (but at the moment all newer versions than 4.X have the regression in 'keeppxe' option and do not work with ReactOS), for example [https://www.kernel.org/pub/linux/utils/boot/syslinux/ here]
  
== Get Driver ==
+
Extract ''core/pxelinux.0'' and ''com32/modules/chain.c32'' to ''/path/to/tftpboot''
tbd
 
  
== Prepare RosBE ==
+
Create ''/path/to/tftpboot/pxelinux.cfg'' directory and put in it a file named ''default'' (no extension) with the following contents:
tbd
 
  
== Prepare LAN ==
+
DEFAULT chain.c32
 +
APPEND file=freeldr.sys seg=0x0F80 keeppxe
  
For this scenario we need two computer. One client (may be diskless or empty HDD), one server (Windows or better Linux).
+
Create ''/path/to/tftpboot/freeldr.ini'' with the following contents:
Both have to be connected to the local network.
+
[FREELOADER]
 +
DefaultOS=LiveCD_Debug
 +
TimeOut=3
 +
 +
[Display]
 +
TitleText=ReactOS LiveCD
 +
StatusBarColor=Cyan
 +
StatusBarTextColor=Black
 +
BackdropTextColor=White
 +
BackdropColor=Blue
 +
BackdropFillStyle=Medium
 +
TitleBoxTextColor=White
 +
TitleBoxColor=Red
 +
MessageBoxTextColor=White
 +
MessageBoxColor=Blue
 +
MenuTextColor=Gray
 +
MenuColor=Black
 +
TextColor=Gray
 +
SelectedTextColor=Black
 +
SelectedColor=Gray
 +
ShowTime=No
 +
MenuBox=No
 +
CenterMenu=No
 +
MinimalUI=Yes
 +
TimeText=Seconds until highlighted choice will be started automatically:
 +
 +
[Operating Systems]
 +
LiveCD="LiveCD"
 +
LiveCD_Debug="LiveCD (Debug)"
 +
LiveCD_Screen="LiveCD (Screen)"
 +
Setup="BootCD"
 +
 +
[LiveCD]
 +
BootType=Windows2003
 +
SystemPath=ramdisk(0)\reactos
 +
Options=/MININT /RDPATH=net(0)\ReactOS-LiveCD.iso /RDEXPORTASCD
 +
 +
[LiveCD_Debug]
 +
BootType=Windows2003
 +
SystemPath=ramdisk(0)\reactos
 +
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=net(0)\ReactOS-LiveCD.iso /RDEXPORTASCD
 +
 +
[LiveCD_Screen]
 +
BootType=Windows2003
 +
SystemPath=ramdisk(0)\reactos
 +
Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /RDPATH=net(0)\ReactOS-LiveCD.iso /RDEXPORTASCD
 +
 +
[Setup]
 +
BootType=ReactOSSetup
 +
SystemPath=ramdisk(0)\
 +
Options=/RDPATH=net(0)\ReactOS-BootCD.iso /RDEXPORTASCD
 +
 
 +
NOTE: Since revision {{rev|65982}} you can specify the file for /RDPATH the "usual" (i.e. Windows') way, i.e. without the "net(0)\" part (that was here just because we couldn't load the file relative to the "current boot device" before...).
  
The server must running a DHCP-server and a TFTP-server. Additionally we need a pxe-client: pxelinux.
 
The client need a pxe-ready network card. Most onboard network card are capable.
 
  
===The Linux way===
+
=== The Linux way ===
  
 
I used dhcp3 and tftpd-hpa. Use your favorite Linux and install them. I used Bind at home, but you can leave that out.
 
I used dhcp3 and tftpd-hpa. Use your favorite Linux and install them. I used Bind at home, but you can leave that out.
Line 42: Line 118:
 
         option domain-name-servers myserver.home.local;
 
         option domain-name-servers myserver.home.local;
 
         option domain-name "home.local";
 
         option domain-name "home.local";
         option routers 10.0.0.254;
+
         option routers IPofYourServer;
 
         option broadcast-address 10.0.0.255;
 
         option broadcast-address 10.0.0.255;
 
         default-lease-time 28800; # 8 hrs
 
         default-lease-time 28800; # 8 hrs
 
         max-lease-time 86400; # 1 day
 
         max-lease-time 86400; # 1 day
 
         allow bootp;
 
         allow bootp;
+
 
 
         host myclient
 
         host myclient
 
         {
 
         {
Line 69: Line 145:
 
         user            = root
 
         user            = root
 
         server          = /usr/sbin/in.tftpd
 
         server          = /usr/sbin/in.tftpd
         server_args    = -vv -s /srv/tftp/
+
         server_args    = -vv -s /path/to/tftpboot/
         bind            = 10.0.0.254
+
         bind            = IPofYourServer
 
  }
 
  }
  
Pxelinux config in /srv/tftp/pxelinux.0
+
=== The Windows way ===
 +
 
 +
On the Windows server, a combination of the free tools [http://tftpd32.jounin.net/ TFTPD32] (you'll only need the DHCP server!) and the [http://www.solarwinds.com/products/freetools/free_tftp_server.aspx SolarWinds TFTP server] (because the built-in server of TFTPD32 does not work well with its DHCPD) has been proven to work.
 +
 
 +
Remember that both DHCP and TFTP servers should be running and there should not be another DHCP server in the same network.
 +
 
 +
Jedi-to-be has discovered that the TFTPD32-only setup works well too. See screenshots for details.
 +
<gallery>
 +
File:Pxe1.png|PXE file system
 +
File:Pxe2.png|TFTP server ip configuration
 +
File:Pxe3.png|TFTPD32 general settings
 +
File:Pxe4.png|TFTP role configuration
 +
File:Pxe5.png|DHCP role configuration
 +
</gallery>
 +
 
 +
In case you have issues on certain hardware, try setting ''PXE Compatibility'' as seen in ''TFTP role configuration''
 +
 
 +
See this video for demonstration  https://www.youtube.com/watch?v=5ycbPb4KgY8 by Jedi-to-be
  
DEFAULT vesamenu.c32
+
=== The QEMU way ===
MENU BACKGROUND bootscreen.png
+
 
+
Add "-net nic -net user,bootfile=pxelinux.0,tftp=/path/to/tftpboot" to your usual QEMU command line.
PROMPT 0
 
NOESCAPE 1
 
TIMEOUT 200
 
MENU WIDTH 45
 
MENU MARGIN 9
 
MENU PASSWORDMARGIN 9
 
MENU ROWS 14
 
MENU TABMSGROW 25
 
MENU CMDLINEROW 18
 
MENU ENDROW 25
 
MENU PASSWORDROW 18
 
MENU TIMEOUTROW 24
 
MENU HSHIFT 1
 
MENU VSHIFT 5
 
 
menu color screen 37;40 #80ffffff #00000000 std
 
menu color border 37;40 #40000000 #ff8093a1 std
 
menu color title 1;37;40 #ffff8b00 #ff8093a1 std
 
menu color unsel 37;40 #fff0f0f0 #ff8093a1 std
 
menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std
 
menu color sel 7;37;40 #ff1c2a33 #667799bb all
 
menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all
 
menu color scrollbar 37;40 #40000000 #ee000000 std
 
menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std
 
menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std
 
menu color cmdline 37;40 #fff0f0f0 #ff8093a1 std
 
menu color pwdborder 37;40 #40000000 #ff8093a1 std
 
menu color pwdheader 37;40 #ffff8b00 #ff8093a1 std
 
menu color pwdentry 37;40 #ffff8b00 #ff8093a1 std
 
menu color timeout_msg 37;40 #afac2a33 #00000000 none
 
menu color timeout 1;37;40 #ffff8b00 #00000000 std
 
menu color help 37;40 #ff1c2a33 #00000000 none
 
menu color msg07 37;40 #90ffffff #00000000 std
 
 
MENU AUTOBOOT Selection starts in # seconds
 
 
MENU TITLE Menu
 
 
label harddisk
 
        localboot 0x80
 
        MENU DEFAULT
 
 
label mdisk ROS live
 
        kernel kernel/memdisk
 
        append iso bigraw initrd=bootimages/ros-live.iso
 
 
label pxelinux
 
        kernel pxelinux.0
 
  
 +
=== The VirtualBox way ===
  
===The Windows way===
+
Note that to have it working, you must use NAT network configuration for your VM (virtual machine), and only one of the PCnet network cards. Otherwise, it won't work.
On the Windows server, a combination of the free tools [http://tftpd32.jounin.net TFTPD32] (you'll only need the DHCP server!) and the [http://www.solarwinds.com/products/freetools/free_tftp_server.aspx SolarWinds TFTP server] (because the built-in server of TFTD32 does not work well with its DHCPD) has been proven working.
 
  
In your TFTP working directory, you'll need a config file ''pxelinux.cfg/default'' (no extension) with these contents:
+
You must move your TFTP root directory into your personnal VBox directory using the name TFTP. For instance, in Linux, it would be in ~/.VirtualBox/TFTP
 +
For instance, in Windows 7, it would be in С:\Users\UserName\.VirtualBox\TFTP
  
DEFAULT menu.c32
+
You then must rename the pxelinux.0 file to VMName.pxe where VMName is the name of your VM in VBox. Then, in this TFTP directory, proceed as with any other TFTP configuration described upper.
 
PROMPT 0
 
NOESCAPE 1
 
TIMEOUT 200
 
 
label mdisk ROS live
 
        menu default
 
        kernel memdisk
 
        append iso bigraw initrd=bootimages/ros-live.iso
 
 
label pxelinux
 
        kernel pxelinux.0
 
  
This config file provides a simple boot menu which allows you to boot the ReactOS live image. Remember that both DHCP and TFTP servers should be running and there should not be another DHCP server in the same network.
+
For instance, if your VM is named "ROSPXE", your ~/.VirtualBox/TFTP will contain:
 +
chain.c32  freeldr.ini  freeldr.sys  pxelinux.cfg/default  ReactOS-LiveCD.iso  ReactOS-BootCD.iso  ROSPXE.pxe
  
 
== Booting ==
 
== Booting ==
tbd
+
 
 +
Try to boot your client computer via PXE. After some seconds, a RAM disk is loaded and ReactOS starts.
 +
 
 +
[[Category:Building]]
 +
[[Category:Tutorial]]

Latest revision as of 00:17, 4 October 2019

This sub-project has been suspended because of poor support for PXE and UEFI. Not true anymore. Only UEFI is incomplete.
You can use a Linux-Live-CD as a substitute.
ReactOS PXE Project Team:

Revision r51517 of ReactOS introduced support for PXE boot. It is now (r65903) possible to completely load the OS in LiveCD mode from a client computer. Since revision 0.4.11-dev-165-g9d1ee24 ReactOS can be also installed on hard-drive via PXE boot-strapping.
Freeldr must be compiled with GCC (MSVC builds present a bug at the moment), the rest can be compiled either by GCC or MSVC.

Preparing the LAN

For this scenario, we need two computers. One client (may be diskless or empty HDD) and one server (Windows, or better, Linux). Both must be connected to the local network.

The server must run a DHCP-server and a TFTP-server. The client must have a PXE-ready network card (most onboard network cards support it) and not less than 300-400 MB of RAM installed.

Preparing the server

Install a TFTP server and a DHCP server on the remote computer. These steps will be only lightly covered here. Let's assume now that your TFTP server root is in /path/to/tftpboot, and that PXE boot filename is pxelinux.0

Creating contents on TFTP server

Download the ReactOS LiveCD and/or BootCD ISO file(s) here

Put the ISO file(s) in /path/to/tftpboot with the name ReactOS-LiveCD.iso and ReactOS-BootCD.iso

Extract loader/freeldr.sys to /path/to/tftpboot in case of BootCD OR
Extract loader/setupldr.sys to /path/to/tftpboot, and rename it to freeldr.sys in case of LiveCD

You must download SysLinux 4.05, or a more recent version (but at the moment all newer versions than 4.X have the regression in 'keeppxe' option and do not work with ReactOS), for example here

Extract core/pxelinux.0 and com32/modules/chain.c32 to /path/to/tftpboot

Create /path/to/tftpboot/pxelinux.cfg directory and put in it a file named default (no extension) with the following contents:

DEFAULT chain.c32
APPEND file=freeldr.sys seg=0x0F80 keeppxe

Create /path/to/tftpboot/freeldr.ini with the following contents:

[FREELOADER]
DefaultOS=LiveCD_Debug
TimeOut=3

[Display]
TitleText=ReactOS LiveCD
StatusBarColor=Cyan
StatusBarTextColor=Black
BackdropTextColor=White
BackdropColor=Blue
BackdropFillStyle=Medium
TitleBoxTextColor=White
TitleBoxColor=Red
MessageBoxTextColor=White
MessageBoxColor=Blue
MenuTextColor=Gray
MenuColor=Black
TextColor=Gray
SelectedTextColor=Black
SelectedColor=Gray
ShowTime=No
MenuBox=No
CenterMenu=No
MinimalUI=Yes
TimeText=Seconds until highlighted choice will be started automatically:

[Operating Systems]
LiveCD="LiveCD"
LiveCD_Debug="LiveCD (Debug)"
LiveCD_Screen="LiveCD (Screen)"
Setup="BootCD"

[LiveCD]
BootType=Windows2003
SystemPath=ramdisk(0)\reactos
Options=/MININT /RDPATH=net(0)\ReactOS-LiveCD.iso /RDEXPORTASCD

[LiveCD_Debug]
BootType=Windows2003
SystemPath=ramdisk(0)\reactos
Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT /RDPATH=net(0)\ReactOS-LiveCD.iso /RDEXPORTASCD

[LiveCD_Screen]
BootType=Windows2003
SystemPath=ramdisk(0)\reactos
Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT /RDPATH=net(0)\ReactOS-LiveCD.iso /RDEXPORTASCD

[Setup]
BootType=ReactOSSetup
SystemPath=ramdisk(0)\
Options=/RDPATH=net(0)\ReactOS-BootCD.iso /RDEXPORTASCD

NOTE: Since revision r65982 you can specify the file for /RDPATH the "usual" (i.e. Windows') way, i.e. without the "net(0)\" part (that was here just because we couldn't load the file relative to the "current boot device" before...).


The Linux way

I used dhcp3 and tftpd-hpa. Use your favorite Linux and install them. I used Bind at home, but you can leave that out.

# Sample configuration file for ISC dhcpd for Debian
# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "home.local";
option domain-name-servers 10.0.0.254;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
subnet 10.0.0.0 netmask 255.255.255.0
{
        range 10.0.0.10 10.0.0.19;
        option domain-name-servers myserver.home.local;
        option domain-name "home.local";
        option routers IPofYourServer;
        option broadcast-address 10.0.0.255;
        default-lease-time 28800; # 8 hrs
        max-lease-time 86400; # 1 day
        allow bootp;
        host myclient
        {
                hardware ethernet 00:0F:EA:66:07:48;
                fixed-address myclient.home.local;
                filename "pxelinux.0";
                server-name "myserver.home.local";
        }
}

Check if present, xinetd/inetd config for tftpd.

service tftp
{
        disable         = no
        log_type        = SYSLOG daemon info
        log_on_access   = PID HOST USERID EXIT DURATION
        socket_type     = dgram
        protocol        = udp
        wait            = yes
        user            = root
        server          = /usr/sbin/in.tftpd
        server_args     = -vv -s /path/to/tftpboot/
        bind            = IPofYourServer
}

The Windows way

On the Windows server, a combination of the free tools TFTPD32 (you'll only need the DHCP server!) and the SolarWinds TFTP server (because the built-in server of TFTPD32 does not work well with its DHCPD) has been proven to work.

Remember that both DHCP and TFTP servers should be running and there should not be another DHCP server in the same network.

Jedi-to-be has discovered that the TFTPD32-only setup works well too. See screenshots for details.

In case you have issues on certain hardware, try setting PXE Compatibility as seen in TFTP role configuration

See this video for demonstration https://www.youtube.com/watch?v=5ycbPb4KgY8 by Jedi-to-be

The QEMU way

Add "-net nic -net user,bootfile=pxelinux.0,tftp=/path/to/tftpboot" to your usual QEMU command line.

The VirtualBox way

Note that to have it working, you must use NAT network configuration for your VM (virtual machine), and only one of the PCnet network cards. Otherwise, it won't work.

You must move your TFTP root directory into your personnal VBox directory using the name TFTP. For instance, in Linux, it would be in ~/.VirtualBox/TFTP For instance, in Windows 7, it would be in С:\Users\UserName\.VirtualBox\TFTP

You then must rename the pxelinux.0 file to VMName.pxe where VMName is the name of your VM in VBox. Then, in this TFTP directory, proceed as with any other TFTP configuration described upper.

For instance, if your VM is named "ROSPXE", your ~/.VirtualBox/TFTP will contain:

chain.c32  freeldr.ini  freeldr.sys  pxelinux.cfg/default  ReactOS-LiveCD.iso  ReactOS-BootCD.iso  ROSPXE.pxe

Booting

Try to boot your client computer via PXE. After some seconds, a RAM disk is loaded and ReactOS starts.