wok diff 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 diff
1.1 --- a/gpxe/stuff/default_boot.u Fri Jun 27 20:38:59 2008 +0000 1.2 +++ b/gpxe/stuff/default_boot.u Sun Jun 29 22:43:02 2008 +0000 1.3 @@ -1,12 +1,110 @@ 1.4 +--- gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S 1.5 ++++ gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S 1.6 +@@ -441,6 +441,8 @@ 1.7 + /* Calculated lcall to _start with %cs:0000 = image start */ 1.8 + lret 1.9 + 1.10 ++boot_url: 1.11 ++ .space 128, 0 1.12 + 1.13 + .org PREFIXSIZE 1.14 + /* 1.15 +@@ -453,6 +455,13 @@ 1.16 + movw %bx, %ss 1.17 + movw $_estack16, %sp 1.18 + 1.19 ++ /* Copy our boot_url structure to the forced_url variable */ 1.20 ++ movw %bx, %es 1.21 ++ movw $forced_url, %di 1.22 ++ movw $boot_url, %si 1.23 ++ movw $128, %cx 1.24 ++ rep movsb 1.25 ++ 1.26 + /* Jump to .text16 segment */ 1.27 + pushw %ax 1.28 + pushw $1f 1.29 + 1.30 +--- gpxe-0.9.3/src/arch/i386/prefix/pxeprefix.S 1.31 ++++ gpxe-0.9.3/src/arch/i386/prefix/pxeprefix.S 1.32 +@@ -19,6 +19,8 @@ 1.33 + .section ".prefix" 1.34 + /* Set up our non-stack segment registers */ 1.35 + jmp $0x7c0, $1f 1.36 ++boot_url: 1.37 ++ .space 128, 0 1.38 + 1: movw %cs, %ax 1.39 + movw %ax, %ds 1.40 + movw $0x40, %ax /* BIOS data segment access */ 1.41 +@@ -703,16 +705,22 @@ 1.42 + /* Set up real-mode stack */ 1.43 + movw %bx, %ss 1.44 + movw $_estack16, %sp 1.45 +- 1.46 ++ movw %bx, %es 1.47 ++ 1.48 + #ifdef PXELOADER_KEEP_UNDI 1.49 + /* Copy our undi_device structure to the preloaded_undi variable */ 1.50 +- movw %bx, %es 1.51 + movw $preloaded_undi, %di 1.52 + movw $undi_device, %si 1.53 + movw $undi_device_size, %cx 1.54 + rep movsb 1.55 + #endif 1.56 + 1.57 ++ /* Copy our boot_url structure to the forced_url variable */ 1.58 ++ movw $forced_url, %di 1.59 ++ movw $boot_url, %si 1.60 ++ movw $128, %cx 1.61 ++ rep movsb 1.62 ++ 1.63 + /* Jump to .text16 segment with %ds pointing to .data16 */ 1.64 + movw %bx, %ds 1.65 + pushw %ax 1.66 + 1.67 --- gpxe-0.9.3/src/usr/autoboot.c 1.68 +++ gpxe-0.9.3/src/usr/autoboot.c 1.69 -@@ -150,2 +150,3 @@ 1.70 +@@ -120,6 +120,11 @@ 1.71 + return -ENOTSUP; 1.72 + } 1.73 + 1.74 ++struct _forced_url { 1.75 ++ char url[128]; 1.76 ++}; 1.77 ++struct _forced_url __data16 ( forced_url ); 1.78 ++#define forced_url __use_data16 ( forced_url ) 1.79 + /** 1.80 + * Boot from a network device 1.81 + * 1.82 +@@ -139,15 +144,21 @@ 1.83 + if ( ( rc = dhcp ( netdev ) ) != 0 ) 1.84 + return rc; 1.85 + route(); 1.86 +- 1.87 ++ 1.88 + /* Try to boot an embedded image if we have one */ 1.89 + rc = boot_embedded_image (); 1.90 + if ( rc != ENOENT ) 1.91 + return rc; 1.92 + 1.93 ++ /* Try to boot a forced url if we have one */ 1.94 ++ strcpy ( buf, forced_url.url ); 1.95 ++ if ( forced_url.url[0] == 0 ) { 1.96 ++ 1.97 + /* Try to download and boot whatever we are given as a filename */ 1.98 + dhcp_snprintf ( buf, sizeof ( buf ), 1.99 find_global_dhcp_option ( DHCP_BOOTFILE_NAME ) ); 1.100 -+default_boot: 1.101 ++ } 1.102 ++ while (1) { 1.103 if ( buf[0] ) { 1.104 -@@ -164,3 +165,4 @@ 1.105 + printf ( "Booting from filename \"%s\"\n", buf ); 1.106 + return boot_filename ( buf ); 1.107 +@@ -162,7 +173,8 @@ 1.108 + } 1.109 + 1.110 printf ( "No filename or root path specified\n" ); 1.111 - return -ENOENT; 1.112 + strcpy ( buf, "http://boot.slitaz.org/gpxe" ); 1.113 -+ goto default_boot; 1.114 ++ } 1.115 } 1.116 + 1.117 + /**