summaryrefslogtreecommitdiffstats
path: root/docs/README.pxe
blob: 2ddd205fe250937ba460319bfc34dbc8db409a32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Here is a short description to configure a PXE server using dhcpd and tftpd.
This allows a network boot for your ethernet card conforming to the Interl
PXE specification.

********************************************************************************
**********                       General overview                   ************
********************************************************************************

You need a dhcp server and a tftp server on one or two machines to allow the 
network boot. We are not using a PXE server to achieve this as it is not
mandatory. 
You can install tftp-server and dhcp-server package from the Mandrake
distribution for example.

On the server machine at 192.168.2.1, you will find a "/etc/dhcpd.conf" sample
file written by Florin Grad <florin@mandrakesoft.com>, where "mydomain.com" is
assumed to be your domain name, and 192.168.1.1 a name server. All install are
done on subnet 192.168.2.0.

All the files that will be downloaded by the tftp daemon are located under 
"/tftpboot" :
  "/tftpboot/pxelinux.0" is a program that is loaded directly by the machine
                         where a network boot will be done, this program comes
                         from the SYSLINUX package by H. Peter Anvin. (look at
                         http://syslinux.zytor.com/pxe.php for more information)
  "/tftpboot/pxelinux.cfg/" is a directory where all configuration file for
                         pxelinux.0 will be found, pxelinux.0 will download
                         these file by itself. It searches first for a file
                         named accordind to the machine IP address in
			 hexadecimal, for example for 192.168.2.20, it
			 looks for "C0A80214" first, then "C0A8021" and so
			 on down to "C0", "C" and "default".
  "/tftpboot/network.rdz" is the standard network initrd for Mandrake installation.
  "/tftpboot/vmlinuz"    is the boot kernel for installation.
  "/tftpboot/help.msg"   is the message displayed by pxelinux.0, note that currently
                         graphical message (as for install using SYSLINUX 1.48 with
                         graphic patch by Mandrake) is not supported.

All file "network.rdz", "vmlinuz", "help.msg" can be found by mounting "network.img",
or the network floppy disk used for install, "pxelinux.cfg" is just an adaptation
of the file found on the "network.img" called "syslinux.cfg" but without the reference
to boot.msg (as it is not currently supported).

Update network configuration for your needs and start dhcp server on the machine and
tftp server and this should work.

********************************************************************************
* /etc/dhcpd.conf **************************************************************
********************************************************************************
ddns-update-style ad-hoc;

authoritative;

option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;

default-lease-time 28800;
max-lease-time 86400;

option domain-name "mydomain.com";
option domain-name-servers 192.168.1.1;

class "PXE" {
  match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
  option vendor-class-identifier "PXEClient";

  vendor-option-space PXE;
  option PXE.mtftp-ip 0.0.0.0;
  next-server 192.168.2.1; #tftp server location

  filename "pxelinux.0";          # standard TFTP

}

shared-network "mynetwork" {
  subnet 192.168.2.0 netmask 255.255.255.0 {
    option subnet-mask 255.255.255.0;
    option routers 192.168.2.1;

    ddns-domainname = "mydomain.com";

    pool {
      range 192.168.2.10 192.168.2.20;
      allow members of "PXE";
    }
  } 
}
********************************************************************************
* /tftpboot/pxelinux.cfg/default ***********************************************
********************************************************************************
default linux
prompt 1
timeout 72
display help.msg
label linux
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 vga=788
label vgalo
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 vga=785
label vgahi
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 vga=791
label vga16
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 vga16
label text
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 text
label patch
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 patch vga=788
label expert
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 expert vga=788
label rescue
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz  root=/dev/ram3 rescue rw
label oem
  kernel vmlinuz
  append ramdisk_size=32000 initrd=network.rdz automatic=method:cdrom root=/dev/ram3 rescue oem rw
********************************************************************************
* Usefull linkst ***************************************************************
********************************************************************************

http://syslinux.zytor.com/pxe.php
http://www.kano.org.uk/projects/pxe/
ss="hl opt">} sub set_loop { my ($file, $o_encrypt_key, $o_encryption) = @_; require modules; eval { modules::load('loop') }; my $dev = find_free_loop(); if ($o_encrypt_key && $o_encryption) { eval { modules::load('cryptoloop', arch() =~ /i.86/ ? 'aes-i586' : 'aes') }; my $cmd = "losetup -p 0 -e $o_encryption $dev $file"; log::l("calling $cmd"); open(my $F, "|$cmd"); print $F $o_encrypt_key; close $F or die "losetup failed"; } else { run_program::run("losetup", $dev, $file) || run_program::run("losetup", "-r", $dev, $file) or return; } $dev; } sub find_compressed_image { my ($name) = @_; foreach (0..255) { my $dev = make("loop$_"); my ($file) = `losetup $dev 2>/dev/null` =~ m!\((.*?)\)! or return; $file =~ s!^/sysroot/!/!; basename($file) eq $name and return $dev, $file; } undef; } sub get_dynamic_major { my ($name) = @_; cat_('/proc/devices') =~ /^(\d+) \Q$name\E$/m && $1; } sub init_device_mapper() { require modules; eval { modules::load('dm-mod') }; make('urandom'); my $control = '/dev/mapper/control'; if (! -e $control) { my ($major) = get_dynamic_major('misc') or return; my ($minor) = cat_('/proc/misc') =~ /(\d+) device-mapper$/m or return; mkdir_p(dirname($control)); syscall_('mknod', $control, c::S_IFCHR() | 0600, makedev($major, $minor)) or die "mknod $control failed: $!"; } } sub entry { my ($type, $major, $minor); local ($_) = @_; if (/^0x([\da-f]{3,4})$/i) { $type = c::S_IFBLK(); ($major, $minor) = unmakedev(hex $1); } elsif (/^sd(.)(\d{0,2})/) { $type = c::S_IFBLK(); $major = 8; $minor = 16 * (ord($1) - ord('a')) + ($2 || 0); } elsif (/^hd(.)(\d{0,2})/) { $type = c::S_IFBLK(); ($major, $minor) = @{ ${{'a' => [3, 0], 'b' => [3, 64], 'c' => [22,0], 'd' => [22,64], 'e' => [33,0], 'f' => [33,64], 'g' => [34,0], 'h' => [34,64], 'i' => [56,0], 'j' => [56,64], 'k' => [57,0], 'l' => [57,64], 'm' => [88,0], 'n' => [88,64],