wok view gpxe/stuff/default_boot.u @ rev 962

gpxe: add forced_url
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jun 29 22:43:02 2008 +0000 (2008-06-29)
parents a9ff8c135e36
children da7eea2e2d10
line source
1 --- gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S
2 +++ gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S
3 @@ -441,6 +441,8 @@
4 /* Calculated lcall to _start with %cs:0000 = image start */
5 lret
7 +boot_url:
8 + .space 128, 0
10 .org PREFIXSIZE
11 /*
12 @@ -453,6 +455,13 @@
13 movw %bx, %ss
14 movw $_estack16, %sp
16 + /* Copy our boot_url structure to the forced_url variable */
17 + movw %bx, %es
18 + movw $forced_url, %di
19 + movw $boot_url, %si
20 + movw $128, %cx
21 + rep movsb
22 +
23 /* Jump to .text16 segment */
24 pushw %ax
25 pushw $1f
27 --- gpxe-0.9.3/src/arch/i386/prefix/pxeprefix.S
28 +++ gpxe-0.9.3/src/arch/i386/prefix/pxeprefix.S
29 @@ -19,6 +19,8 @@
30 .section ".prefix"
31 /* Set up our non-stack segment registers */
32 jmp $0x7c0, $1f
33 +boot_url:
34 + .space 128, 0
35 1: movw %cs, %ax
36 movw %ax, %ds
37 movw $0x40, %ax /* BIOS data segment access */
38 @@ -703,16 +705,22 @@
39 /* Set up real-mode stack */
40 movw %bx, %ss
41 movw $_estack16, %sp
42 -
43 + movw %bx, %es
44 +
45 #ifdef PXELOADER_KEEP_UNDI
46 /* Copy our undi_device structure to the preloaded_undi variable */
47 - movw %bx, %es
48 movw $preloaded_undi, %di
49 movw $undi_device, %si
50 movw $undi_device_size, %cx
51 rep movsb
52 #endif
54 + /* Copy our boot_url structure to the forced_url variable */
55 + movw $forced_url, %di
56 + movw $boot_url, %si
57 + movw $128, %cx
58 + rep movsb
59 +
60 /* Jump to .text16 segment with %ds pointing to .data16 */
61 movw %bx, %ds
62 pushw %ax
64 --- gpxe-0.9.3/src/usr/autoboot.c
65 +++ gpxe-0.9.3/src/usr/autoboot.c
66 @@ -120,6 +120,11 @@
67 return -ENOTSUP;
68 }
70 +struct _forced_url {
71 + char url[128];
72 +};
73 +struct _forced_url __data16 ( forced_url );
74 +#define forced_url __use_data16 ( forced_url )
75 /**
76 * Boot from a network device
77 *
78 @@ -139,15 +144,21 @@
79 if ( ( rc = dhcp ( netdev ) ) != 0 )
80 return rc;
81 route();
82 -
83 +
84 /* Try to boot an embedded image if we have one */
85 rc = boot_embedded_image ();
86 if ( rc != ENOENT )
87 return rc;
89 + /* Try to boot a forced url if we have one */
90 + strcpy ( buf, forced_url.url );
91 + if ( forced_url.url[0] == 0 ) {
92 +
93 /* Try to download and boot whatever we are given as a filename */
94 dhcp_snprintf ( buf, sizeof ( buf ),
95 find_global_dhcp_option ( DHCP_BOOTFILE_NAME ) );
96 + }
97 + while (1) {
98 if ( buf[0] ) {
99 printf ( "Booting from filename \"%s\"\n", buf );
100 return boot_filename ( buf );
101 @@ -162,7 +173,8 @@
102 }
104 printf ( "No filename or root path specified\n" );
105 - return -ENOENT;
106 + strcpy ( buf, "http://boot.slitaz.org/gpxe" );
107 + }
108 }
110 /**