slitaz-forge diff mirror/floppies/builder/index.php @ rev 463

pkgs: fix maintainer cloud
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 18 10:29:24 2014 +0000 (2014-02-18)
parents 41bfd0397973
children a33dea8a7991
line diff
     1.1 --- a/mirror/floppies/builder/index.php	Wed Mar 20 19:56:45 2013 +0100
     1.2 +++ b/mirror/floppies/builder/index.php	Tue Feb 18 10:29:24 2014 +0000
     1.3 @@ -12,6 +12,7 @@
     1.4  	<meta name="author" content="SliTaz Contributors" />
     1.5  	<meta http-equiv="Refresh" content="0;url=http://mirror.slitaz.org/floppies/builder/index.php">
     1.6  </head>
     1.7 +</html>
     1.8  <?php
     1.9  }
    1.10  ini_set('upload_max_filesize','16M');
    1.11 @@ -46,8 +47,8 @@
    1.12  	<meta name="description" content="slitaz boot floppies builder" />
    1.13  	<meta name="robots" content="index, nofollow" />
    1.14  	<meta name="author" content="SliTaz Contributors" />
    1.15 -	<link rel="shortcut icon" href="/static/favicon.ico" />
    1.16 -	<link rel="stylesheet" type="text/css" href="/static/slitaz.css" />
    1.17 +	<link rel="shortcut icon" href="../static/favicon.ico" />
    1.18 +	<link rel="stylesheet" type="text/css" href="../static/slitaz.css" />
    1.19  	<style type="text/css">
    1.20  	
    1.21  input[type=text] {
    1.22 @@ -80,7 +81,7 @@
    1.23  	<div id="logo"></div>
    1.24  	<div id="network">
    1.25  		<a href="http://www.slitaz.org/">
    1.26 -		<img src="/static/home.png" alt="[ home ]" /></a>
    1.27 +		<img src="../static/home.png" alt="[ home ]" /></a>
    1.28  		<a href="bootloader" title="Build your floppy sets without Internet">Shell builder</a> |
    1.29  		<a href="../floppy-grub4dos" title="Boot tools">Generic boot floppy</a>
    1.30  	</div>
    1.31 @@ -129,6 +130,7 @@
    1.32  
    1.33  	$size = 0;
    1.34  	$initrd_size = 0;
    1.35 +	$info_size = 0;
    1.36  	
    1.37  	// Upload kernel
    1.38  	
    1.39 @@ -162,24 +164,21 @@
    1.40  				   $tmp_dir."kernel");
    1.41  		$kernel = $tmp_dir."kernel";
    1.42  		$boot_version = get_long($kernel,0x206) & 255;
    1.43 +		if (get_long($kernel,0x202) != 0x53726448) // 'HdrS' magic
    1.44 +			$boot_version = 0;
    1.45  		$size = get_long($kernel,0x1F4);	// syssize paragraphs
    1.46  		if ($boot_version < 4) $size &= 0xFFFF;	// 16 bits before 2.4
    1.47  		$size = ($size + 0xFFF) & 0xFFFF000;	// round up to 64K
    1.48  		$size <<= 4;				// paragraphs -> bytes
    1.49 -		if (get_long($kernel,0x202) != 0x53726448 ||	// 'HdrS' magic
    1.50 -		    (get_long($kernel,0x211) & 1 != 1)) {	// bzImage flag
    1.51 -			error("The file ".$_FILES["kernel"]['name'].
    1.52 -			      " is not a bzImage Linux kernel.");
    1.53 -			$size = 0;
    1.54 -		}
    1.55 -		else if ($boot_version < 2 && $_POST['cmdline']) { // before 2.2
    1.56 -			unset($_POST['cmdline']);
    1.57 -			error("This boot loader does not support Linux kernel ".
    1.58 -			      "prior 2.4.0-test3-pre3 command line.",
    1.59 -			      "Warning");
    1.60 -		}
    1.61  		$msg = "The size of the file ".$_FILES["kernel"]['name'];
    1.62  	}
    1.63 +
    1.64 +	if ($size && isset($_FILES["info"]['tmp_name']) &&
    1.65 +	    is_uploaded_file($_FILES["info"]['tmp_name'])) {
    1.66 +		move_uploaded_file($_FILES["info"]['tmp_name'],
    1.67 +				   $tmp_dir."info");
    1.68 +		$info_size = $_FILES["info"]['size'];
    1.69 +	}
    1.70  	
    1.71  	// Upload initrd
    1.72  	
    1.73 @@ -213,9 +212,13 @@
    1.74  	else {
    1.75  		$cmd = "./bootloader ".$tmp_dir."kernel --prefix "
    1.76  		     . $tmp_dir."fd --format 0 --flags ".$_POST['flags']
    1.77 -		     . " --video ".$_POST['video'];
    1.78 +		     . " --video ".$_POST['video']." --mem ".$_POST['ram'];
    1.79 +		if ($_POST['edit'] == "")
    1.80 +			$cmd .= " --dont-edit-cmdline";
    1.81  		if ($_POST['cmdline'])
    1.82  			$cmd .= " --cmdline '".$_POST['cmdline']."'";
    1.83 +		if ($info_size)
    1.84 +			$cmd .= " --info ".$tmp_dir."info";
    1.85  		if (file_exists($_POST['rdev']))
    1.86  			$cmd .= " --rdev ".$_POST['rdev'];
    1.87  		if ($initrd_size)
    1.88 @@ -278,7 +281,7 @@
    1.89  		$max = rtrim(ini_get('upload_max_filesize'),"M");
    1.90  		$max_post = rtrim(ini_get('post_max_size'),"M");
    1.91  		if ($max_post < $max) $max = $max_post;
    1.92 -		$msg = "the tiny boot loader can't load more than 15 MB";
    1.93 +		$msg = "the <acronym title=\"The linux kernel boot sector\">tiny boot loader</acronym> can't load more than 15 MB";
    1.94  		if ($max < 16)
    1.95  			$msg = "the web server can't upload more than $max MB";
    1.96  ?>
    1.97 @@ -286,21 +289,26 @@
    1.98  <table>
    1.99  	<tr>
   1.100  	<td>Linux kernel:</td>
   1.101 -	<td><input type="file" name="kernel" size="25" /> <i>required</i></td>
   1.102 +	<td><input type="file" name="kernel" size="37" /> <i>required</i></td>
   1.103  	</tr>
   1.104  	<tr>
   1.105  	<td>Initramfs / Initrd:</td>
   1.106 -	<td><input type="file" name="initrd" size="25" /> <i>optional</i></td>
   1.107 +	<td><input type="file" name="initrd" size="37" /> <i>optional</i></td>
   1.108  	</tr>
   1.109  	<tr>
   1.110  	<td>Extra initramfs:</td>
   1.111 -	<td><input type="file" name="initrd2" size="25" /> <i>optional</i></td>
   1.112 +	<td><input type="file" name="initrd2" size="37" /> <i>optional</i></td>
   1.113 +	</tr>
   1.114 +	<tr>
   1.115 +	<td>Boot message:</td>
   1.116 +	<td><input type="file" name="info" size="37" /> <i>optional</i></td>
   1.117  	</tr>
   1.118  	<tr>
   1.119  	<td>Default cmdline:</td>
   1.120  	<td><input type="text" name="cmdline" size="36" <?php 
   1.121  		if (isset($_GET['cmdline'])) echo 'value="'.$_GET['cmdline'].'"';
   1.122 -	?>/> <i>optional</i></td>
   1.123 +	?>/> <input type="checkbox" name="edit" checked="checked" />edit
   1.124 +	<i>optional</i></td>
   1.125  	</tr>
   1.126  	<tr>
   1.127  	<td>Root device:</td>
   1.128 @@ -333,41 +341,89 @@
   1.129  			$options[0xF07] = "80x60";
   1.130  			$options[0x30A] = "132x43";
   1.131  			$options[0x309] = "132x25";
   1.132 -			$options[0x338] = "320x200x8";
   1.133 +			$options[0x338] = "320x200x8"; // 382?
   1.134  			$options[0x30D] = "320x200x15";
   1.135  			$options[0x30E] = "320x200x16";
   1.136 -			$options[0x332] = "320x240x8";
   1.137 -			$options[0x335] = "320x240x16";
   1.138 -			$options[0x333] = "400x300x8";
   1.139 -			$options[0x336] = "400x300x16";
   1.140 -			$options[0x334] = "512x384x8";
   1.141 -			$options[0x337] = "512x384x16";
   1.142 +			$options[0x30F] = "320x200x24";
   1.143 +			$options[0x320] = "320x200x32";
   1.144 +			$options[0x332] = "320x240x8"; // 392?
   1.145 +			$options[0x393] = "320x240x15";
   1.146 +			$options[0x335] = "320x240x16";// 394?
   1.147 +			$options[0x395] = "320x240x24";
   1.148 +			$options[0x396] = "320x240x32";
   1.149 +			$options[0x333] = "400x300x8";// 3A2?
   1.150 +			$options[0x3A3] = "400x300x15";
   1.151 +			$options[0x336] = "400x300x16";// 3A4?
   1.152 +			$options[0x3A5] = "400x300x24";
   1.153 +			$options[0x3A6] = "400x300x32";
   1.154 +			$options[0x334] = "512x384x8";// 3B2?
   1.155 +			$options[0x3B3] = "512x384x15";
   1.156 +			$options[0x337] = "512x384x16";// 3B4?
   1.157 +			$options[0x3B5] = "512x384x24";
   1.158 +			$options[0x3B6] = "512x384x32";
   1.159 +			$options[0x3C2] = "640x350x8";
   1.160 +			$options[0x3C3] = "640x350x15";
   1.161 +			$options[0x3C4] = "640x350x16";
   1.162 +			$options[0x3C5] = "640x350x24";
   1.163 +			$options[0x3C6] = "640x350x32";
   1.164  			$options[0x300] = "640x400x8";
   1.165 -			$options[0x339] = "640x400x16";
   1.166 +			$options[0x383] = "640x400x15";
   1.167 +			$options[0x339] = "640x400x16";// 384?
   1.168 +			$options[0x385] = "640x400x24";
   1.169 +			$options[0x386] = "640x400x32";
   1.170  			$options[0x301] = "640x480x8";
   1.171  			$options[0x310] = "640x480x15";
   1.172  			$options[0x311] = "640x480x16";
   1.173  			$options[0x312] = "640x480x24";
   1.174 -			$options[0x33A] = "640x480x32";
   1.175 +			$options[0x33A] = "640x480x32";// 321?
   1.176 +			$options[879]   = "800x500x8";
   1.177 +			$options[880]   = "800x500x15";
   1.178 +			$options[881]   = "800x500x16";
   1.179 +			$options[882]   = "800x500x24";
   1.180 +			$options[883]   = "800x500x32";
   1.181  			//$options[770] = "800x600x4";
   1.182  			$options[0x303] = "800x600x8";
   1.183  			$options[0x313] = "800x600x15";
   1.184  			$options[0x314] = "800x600x16";
   1.185  			$options[0x315] = "800x600x24";
   1.186 -			$options[0x33B] = "800x600x32";
   1.187 +			$options[0x33B] = "800x600x32";//322?
   1.188 +			$options[815]   = "896x672x8";
   1.189 +			$options[816]   = "896x672x15";
   1.190 +			$options[817]   = "896x672x16";
   1.191 +			$options[818]   = "896x672x24";
   1.192 +			$options[819]   = "896x672x32";
   1.193 +			$options[874]   = "1024x640x8";
   1.194 +			$options[875]   = "1024x640x15";
   1.195 +			$options[876]   = "1024x640x16";
   1.196 +			$options[877]   = "1024x640x24";
   1.197 +			$options[878]   = "1024x640x32";
   1.198  			//$options[772] = "1024x768x4";
   1.199  			$options[0x305] = "1024x768x8";
   1.200  			$options[0x316] = "1024x768x15";
   1.201  			$options[0x317] = "1024x768x16";
   1.202  			$options[0x318] = "1024x768x24";
   1.203 -			$options[0x33C] = "1024x768x32";
   1.204 +			$options[0x33C] = "1024x768x32";//323?
   1.205 +			$options[869]   = "1152x720x8";
   1.206 +			$options[870]   = "1152x720x15";
   1.207 +			$options[871] =   "1152x720x16";
   1.208 +			$options[872] =   "1152x720x24";
   1.209 +			$options[873] =   "1152x720x32";
   1.210  			$options[0x307] = "1280x1024x8";
   1.211  			$options[0x319] = "1280x1024x15";
   1.212  			$options[0x31A] = "1280x1024x16";
   1.213  			$options[0x31B] = "1280x1024x24";
   1.214  			$options[0x33D] = "1280x1024x32";
   1.215 +			$options[835]   = "1400x1050x8";
   1.216 +			$options[837] =   "1400x1050x16";
   1.217 +			$options[838] =   "1400x1040x24";
   1.218 +			$options[864]   = "1440x900x8";
   1.219 +			$options[864]   = "1440x900x15";
   1.220 +			$options[866] =   "1440x900x16";
   1.221 +			$options[867] =   "1440x900x24";
   1.222 +			$options[868] =   "1440x900x32";
   1.223  			$options[0x330] = "1600x1200x8";
   1.224  			$options[0x331] = "1600x1200x16";
   1.225 +			$options[893]   = "1920x1200x8";
   1.226  			foreach ($options as $key => $value) {
   1.227  				echo '<option value="'.$key.'"';
   1.228  				if ($key == $selected || $value == $selected)
   1.229 @@ -383,12 +439,42 @@
   1.230  	<td><select name="size">
   1.231  <?php
   1.232  	foreach ($sizes as $key => $value) {
   1.233 +		switch ($key) {
   1.234 +		case "368640" :
   1.235 +			echo "		<optgroup label=\"5&frac14; SD\">\n";
   1.236 +			break;
   1.237 +		case "737280" :
   1.238 +			echo "		</optgroup>\n";
   1.239 +			echo "		<optgroup label=\"3&frac12; SD\">\n";
   1.240 +			break;
   1.241 +		case "1228800" :
   1.242 +			echo "		</optgroup>\n";
   1.243 +			echo "		<optgroup label=\"5&frac14; HD\">\n";
   1.244 +			break;
   1.245 +		case "1474560" :
   1.246 +			echo "		</optgroup>\n";
   1.247 +			echo "		<optgroup label=\"3&frac12; HD\">\n";
   1.248 +			break;
   1.249 +		case "2949120" :
   1.250 +			echo "		</optgroup>\n";
   1.251 +			echo "		<optgroup label=\"3&frac12; ED\">\n";
   1.252 +			break;
   1.253 +		case "0" :
   1.254 +			echo "		</optgroup>\n";
   1.255 +			break;
   1.256 +		}
   1.257  		echo "		<option value=\"$key\"";
   1.258  		if ($key == "1474560") echo " selected='selected'";
   1.259  		echo ">$value</option>\n";
   1.260  	}
   1.261  ?>
   1.262  	</select>&nbsp;
   1.263 +	RAM used&nbsp;<select name="ram">
   1.264 +<?php
   1.265 +	for ($i = 16; $i >= 4; $i--)
   1.266 +		echo "		<option value=\"$i\">$i MB</option>\n";
   1.267 +?>
   1.268 +	</select>&nbsp;
   1.269  		<input name="build" value="Build floppy set" type="submit" />
   1.270  	</td>
   1.271  	</tr>
   1.272 @@ -402,6 +488,9 @@
   1.273  <p>
   1.274  Note 2: the extra initramfs may be useful to add your own configuration files.
   1.275  </p>
   1.276 +<p>
   1.277 +Note 3: the keyboard is read for ESC or ENTER on every form feed (ASCII 12) in the boot message.
   1.278 +</p>
   1.279  EOT;
   1.280  	}
   1.281  	else {
   1.282 @@ -455,13 +544,13 @@
   1.283  <h4>How does it work ?</h4>
   1.284  <p>
   1.285  This tool updates the boot sector of your kernel with
   1.286 -<a href="http://hg.slitaz.org/wok/raw-file/b84ff32e3457/linux/stuff/linux-header-2.6.34.u">this patch</a>.
   1.287 +<a href="http://hg.slitaz.org/wok/raw-file/66e38bd6a132/linux/stuff/linux-header.u">this patch</a>.
   1.288  You may add a default cmdline and an initramfs. The cmdline can be edited at boot
   1.289 -time but the keyboard is not mandatory.
   1.290 +time but the <acronym title="Check for disk swap every 5 seconds">keyboard is not mandatory</acronym>.
   1.291  A <a href="bootloader"> standalone version</a> is available.
   1.292  </p>
   1.293  <p>
   1.294 -Each part (boot, setup, cmdline, kernel, initramfs) is aligned to 512 bytes.
   1.295 +Each part (boot, setup, boot message, cmdline, kernel, initramfs) is aligned to 512 bytes.
   1.296  The result is split to fit the floppy size.
   1.297  The last floppy image is padded with zeros.
   1.298  </p>
   1.299 @@ -490,13 +579,13 @@
   1.300  <!-- Bottom and logo's -->
   1.301  <div id="bottom">
   1.302  <p>
   1.303 -<a href="http://validator.w3.org/check?uri=referer"><img src="/static/xhtml10.png" alt="Valid XHTML 1.0" title="Code validé XHTML 1.0" style="width: 80px; height: 15px;" /></a>
   1.304 +<a href="http://validator.w3.org/check?uri=referer"><img src="../static/xhtml10.png" alt="Valid XHTML 1.0" title="Code validé XHTML 1.0" style="width: 80px; height: 15px;" /></a>
   1.305  </p>
   1.306  <p>
   1.307  	<img src="#" id="qrcodeimg" alt="#" width="60" height="60"
   1.308 -	     onmouseover= "this.title = location.href"
   1.309 -	     onclick= "this.width = this.height = 300" />
   1.310 -	<script type="text/javascript" src="/static/qrcode.js"></script>
   1.311 +	     onmouseover= "this.title = location.href" 
   1.312 +	     onclick= "this.width = this.height = 300;" />
   1.313 +	<script type="text/javascript" src="../static/qrcode.js"></script>
   1.314  	<script type="text/javascript">
   1.315  		document.getElementById('qrcodeimg').src =
   1.316  			QRCode.generatePNG(location.href, {ecclevel: 'H'});