tiny-slitaz view step5.php @ rev 29

No hard coded boot menu
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Sep 20 21:20:45 2019 +0200 (2019-09-20)
parents 912635ac019d
children f03cb925353c
line source
1 <?php
3 function show_size($file)
4 {
5 return shell_exec("du -h ".$_POST['tmp_dir'].
6 "$file | awk '{ printf \"%s\",$1 }'");
7 }
9 if (isset($_POST['toconfigure']) && $_POST['toconfigure'] == ""
10 && $output == "") {
11 shell_exec("sudo ./helper --mkrootfs ".$_POST['tmp_dir']);
12 ?>
14 <div class="box">
15 <h3 id="get">[Step 5/5] Get Tiny SliTaz files</h3>
17 <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="config">
19 <?php post_hidden(); ?>
21 <table>
22 <tr><td class="first">Bootable images:</td><td>
23 <div id="floppyset">
24 <select name="fdsize" id="fdsize" onchange="floppy_form()">
25 <?php
26 $title="Neither Windows nor emm386 supported. Needs a real mode DOS";
27 if (!file_exists($_POST['tmp_dir']."out"))
28 shell_exec("sudo ./helper --mkimg ".$_POST['tmp_dir']);
29 if (!isset($_POST['fdsize'])) $_POST['fdsize']="1474560";
30 foreach(array("737280" => "720K", "1228800" => "1.2M",
31 "1474560" => "1.44M", "1720320" => "1.68M",
32 "1966080" => "1.92M", "2949120" => "2.88M") as $sz => $nm) {
33 echo " <option value=\"$sz\"";
34 if ($sz == $_POST['fdsize']) echo " selected";
35 echo ">$nm</option>\n";
36 } ?>
37 </select>
38 </div>
39 <input name="download" value="DOS/EXE" type="submit"
40 title="<?php echo $title; ?>" />
41 <?php if (file_exists("/boot/isolinux/isolinux.bin")) {
42 $title="Can be burnt on to a CD-ROM or written on to a USB Key / memory card";
43 if (file_exists("/usr/bin/iso2exe"))
44 $title .= ", or renamed with the .exe suffix and run with DOS or Windows";
45 ?>
46 <input name="download" value="ISO image" type="submit"
47 title="<?php echo $title; ?>" />
48 <?php } ?>
49 </td></tr>
52 <tr><td class="first">Files for bootloaders:</td><td>
54 <input name="download" value="Kernel (<?php echo show_size("fs/boot/bzImage");
55 ?>)" type="submit" />
56 <input name="download" value="Rootfs (<?php echo show_size("rootfs.gz");
57 ?>)" title="For the initrd= parameter" type="submit" />
58 <?php echo shell_exec("sudo ./helper --boot-files ".$_POST['tmp_dir']); ?>
59 </td></tr>
62 <tr><td class="first">Configuration info:</td><td>
64 <input name="download" value="Configuration files" type="submit" />
65 <input name="download" value="packages.conf (<?php
66 echo show_size("fs/etc/packages.conf"); ?>)" type="submit" />
67 </td></tr>
70 <?php if (show_size("fs/boot/System.map") != "") { ?>
71 <tr><td class="first">Debug info:</td><td>
73 <input name="download" value="System.map (<?php echo show_size("fs/boot/System.map");
74 ?>)" type="submit" />
75 <input name="download" value="linux.config (<?php echo show_size("fs/boot/config");
76 ?>)" type="submit" />
77 <br>
78 <input name="download" value="busybox.config (<?php echo show_size("fs/boot/config-busybox");
79 ?>)" type="submit" />
80 <input name="download" value="post_install.log (<?php echo show_size("post_install.log");
81 ?>)" type="submit" />
82 </td></tr>
84 <?php } ?>
86 </table>
87 </form>
88 </div>
90 <script>
91 function floppy_form()
92 {
93 var element;
94 var fds=document.getElementById("fdsize");
95 for (i=1;;i++) {
96 element=document.getElementById("Floppy"+i);
97 if (element) document.getElementById("floppyset").removeChild(element);
98 else break;
99 }
100 for (i=<?php echo filesize($_POST['tmp_dir']."out"); ?>, j=1; i > 0; j++, i -= fds.value) {
101 element = document.createElement("input");
102 element.name = "download";
103 element.type = "submit";
104 element.value = element.id = "Floppy"+j;
105 element.title = "You can use dd or rawrite to create the floppy disk";
106 document.getElementById("floppyset").appendChild(element);
107 }
108 if (j == 2) element.value = "Floppy image";
109 }
111 floppy_form();
112 </script>
114 <h2>Going further</h2>
116 <p>Tiny SliTaz should be smaller to have more functionality and/or needs less
117 RAM.<br>
118 The kernel can be <a href="http://elinux.org/Linux_Tiny">tuned/patched</a> or
119 you can use an earlier version.</p>
121 <p>You can test Tiny SliTaz without pre-historic hardware using qemu (needs the
122 <tt>ne.ko</tt> module):</p>
124 <pre>
125 qemu -cpu 486 -m 4 -net nic,model=ne2k_isa -net tap -fda slitaz.img
126 </pre>
128 <p>Or</p>
130 <pre>
131 qemu -cpu 486 -m 4 -net nic,model=ne2k_isa -net tap -kernel kernel -initrd rootfs.gz /dev/null
132 </pre>
134 <p>And the executable file <code>/etc/qemu-ifup</code>:</p>
136 <pre>
137 #!/bin/sh
139 tunctl -u $(id -un) -t $1
140 ifconfig $1 192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0
141 </pre>
143 <?php
144 }
145 ?>