wok-6.x 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 | 1d1bb51299ff |
children | 884b79c38a75 |
files | gpxe/receipt gpxe/stuff/default_boot.u |
line diff
1.1 --- a/gpxe/receipt Sun Jun 29 18:45:01 2008 +0000 1.2 +++ b/gpxe/receipt Sun Jun 29 22:43:02 2008 +0000 1.3 @@ -24,4 +24,12 @@ 1.4 { 1.5 mkdir -p $fs/boot 1.6 cp $src/src/bin/gpxe.lkrn $fs/boot/gpxe 1.7 + # install 127 bytes of forced url at offset 519 1.8 + echo -n "http://boot.slitaz.org/gpxe" | cat - /dev/zero | \ 1.9 + dd bs=1 seek=519 count=127 conv=notrunc of=$fs/boot/gpxe 1.10 + # Package all gpxe pkgs 1.11 + for i in $(cd $WOK; ls -d gpxe-*) 1.12 + do 1.13 + tazwok genpkg $i 1.14 + done 1.15 }
2.1 --- a/gpxe/stuff/default_boot.u Sun Jun 29 18:45:01 2008 +0000 2.2 +++ b/gpxe/stuff/default_boot.u Sun Jun 29 22:43:02 2008 +0000 2.3 @@ -1,12 +1,110 @@ 2.4 +--- gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S 2.5 ++++ gpxe-0.9.3/src/arch/i386/prefix/lkrnprefix.S 2.6 +@@ -441,6 +441,8 @@ 2.7 + /* Calculated lcall to _start with %cs:0000 = image start */ 2.8 + lret 2.9 + 2.10 ++boot_url: 2.11 ++ .space 128, 0 2.12 + 2.13 + .org PREFIXSIZE 2.14 + /* 2.15 +@@ -453,6 +455,13 @@ 2.16 + movw %bx, %ss 2.17 + movw $_estack16, %sp 2.18 + 2.19 ++ /* Copy our boot_url structure to the forced_url variable */ 2.20 ++ movw %bx, %es 2.21 ++ movw $forced_url, %di 2.22 ++ movw $boot_url, %si 2.23 ++ movw $128, %cx 2.24 ++ rep movsb 2.25 ++ 2.26 + /* Jump to .text16 segment */ 2.27 + pushw %ax 2.28 + pushw $1f 2.29 + 2.30 +--- gpxe-0.9.3/src/arch/i386/prefix/pxeprefix.S 2.31 ++++ gpxe-0.9.3/src/arch/i386/prefix/pxeprefix.S 2.32 +@@ -19,6 +19,8 @@ 2.33 + .section ".prefix" 2.34 + /* Set up our non-stack segment registers */ 2.35 + jmp $0x7c0, $1f 2.36 ++boot_url: 2.37 ++ .space 128, 0 2.38 + 1: movw %cs, %ax 2.39 + movw %ax, %ds 2.40 + movw $0x40, %ax /* BIOS data segment access */ 2.41 +@@ -703,16 +705,22 @@ 2.42 + /* Set up real-mode stack */ 2.43 + movw %bx, %ss 2.44 + movw $_estack16, %sp 2.45 +- 2.46 ++ movw %bx, %es 2.47 ++ 2.48 + #ifdef PXELOADER_KEEP_UNDI 2.49 + /* Copy our undi_device structure to the preloaded_undi variable */ 2.50 +- movw %bx, %es 2.51 + movw $preloaded_undi, %di 2.52 + movw $undi_device, %si 2.53 + movw $undi_device_size, %cx 2.54 + rep movsb 2.55 + #endif 2.56 + 2.57 ++ /* Copy our boot_url structure to the forced_url variable */ 2.58 ++ movw $forced_url, %di 2.59 ++ movw $boot_url, %si 2.60 ++ movw $128, %cx 2.61 ++ rep movsb 2.62 ++ 2.63 + /* Jump to .text16 segment with %ds pointing to .data16 */ 2.64 + movw %bx, %ds 2.65 + pushw %ax 2.66 + 2.67 --- gpxe-0.9.3/src/usr/autoboot.c 2.68 +++ gpxe-0.9.3/src/usr/autoboot.c 2.69 -@@ -150,2 +150,3 @@ 2.70 +@@ -120,6 +120,11 @@ 2.71 + return -ENOTSUP; 2.72 + } 2.73 + 2.74 ++struct _forced_url { 2.75 ++ char url[128]; 2.76 ++}; 2.77 ++struct _forced_url __data16 ( forced_url ); 2.78 ++#define forced_url __use_data16 ( forced_url ) 2.79 + /** 2.80 + * Boot from a network device 2.81 + * 2.82 +@@ -139,15 +144,21 @@ 2.83 + if ( ( rc = dhcp ( netdev ) ) != 0 ) 2.84 + return rc; 2.85 + route(); 2.86 +- 2.87 ++ 2.88 + /* Try to boot an embedded image if we have one */ 2.89 + rc = boot_embedded_image (); 2.90 + if ( rc != ENOENT ) 2.91 + return rc; 2.92 + 2.93 ++ /* Try to boot a forced url if we have one */ 2.94 ++ strcpy ( buf, forced_url.url ); 2.95 ++ if ( forced_url.url[0] == 0 ) { 2.96 ++ 2.97 + /* Try to download and boot whatever we are given as a filename */ 2.98 + dhcp_snprintf ( buf, sizeof ( buf ), 2.99 find_global_dhcp_option ( DHCP_BOOTFILE_NAME ) ); 2.100 -+default_boot: 2.101 ++ } 2.102 ++ while (1) { 2.103 if ( buf[0] ) { 2.104 -@@ -164,3 +165,4 @@ 2.105 + printf ( "Booting from filename \"%s\"\n", buf ); 2.106 + return boot_filename ( buf ); 2.107 +@@ -162,7 +173,8 @@ 2.108 + } 2.109 + 2.110 printf ( "No filename or root path specified\n" ); 2.111 - return -ENOENT; 2.112 + strcpy ( buf, "http://boot.slitaz.org/gpxe" ); 2.113 -+ goto default_boot; 2.114 ++ } 2.115 } 2.116 + 2.117 + /**