-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstep5.php
161 lines (132 loc) · 4.91 KB
/
step5.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
function show_size($file)
{
return shell_exec("du -h ".$_POST['tmp_dir'].
"$file | awk '{ printf \"%s\",$1 }'");
}
if (isset($_POST['toconfigure']) && $_POST['toconfigure'] == ""
&& $output == "") {
shell_exec("sudo ./helper --mkrootfs ".$_POST['tmp_dir']);
?>
<div class="box">
<h3 id="get">[Step 5/5] Get Tiny SliTaz files</h3>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="config">
<?php post_hidden(); ?>
<table>
<tr><td class="first">Bootable images:</td><td>
<div id="floppyset">
<select name="fdsize" id="fdsize" onchange="floppy_form()"
title="Select the size of the floppies">
<?php
$title="Neither Windows nor emm386 supported. Needs a real mode DOS";
if (!file_exists($_POST['tmp_dir']."out"))
shell_exec("sudo ./helper --mkimg ".$_POST['tmp_dir']);
if (!isset($_POST['fdsize'])) $_POST['fdsize']="1474560";
$use_optgroup=0;
foreach(array("360K 5¼-inch" => "", "368640" => "360K", "409600" => "400K",
"720K 3½-inch" => "", "737280" => "720K", "819200" => "800K",
"1.2M 5¼-inch" => "", "1228800" => "1.2M",
"1.44M 3½-inch" => "", "1474560" => "1.44M", "1720320" => "1.68M",
"1966080" => "1.92M",
"2.88M 3½-inch" => "", "2949120" => "2.88M", "5898240" => "3.36M") as $sz => $nm) {
if ($nm == "") {
if ($use_optgroup != 0) echo " </optgroup>\n";
echo " <optgroup label=\"$sz\">\n";
$use_optgroup=1;
}
else {
echo " <option value=\"$sz\"";
if ($sz == $_POST['fdsize']) echo " selected";
echo ">$nm</option>\n";
}
}
if ($use_optgroup != 0) echo " </optgroup>\n";
?>
</select>
</div>
<input name="download" value="DOS/EXE" type="submit"
title="<?php echo $title; ?>" />
<?php if (file_exists("/boot/isolinux/isolinux.bin")) {
$title="Can be burnt on to a CD-ROM or written on to a USB Key / memory card";
if (file_exists("/usr/bin/iso2exe"))
$title .= ", or renamed with the .exe suffix and run with DOS or Windows";
?>
<input name="download" value="ISO image" type="submit"
title="<?php echo $title; ?>" />
<?php } ?>
</td></tr>
<tr><td class="first">Files for bootloaders:</td><td>
<input name="download" value="Kernel (<?php echo show_size("fs/boot/bzImage");
?>)" title="A bzImage with a basic embbeded initramfs.
Can boot from floppy or DOS in real mode." type="submit" />
<input name="download" value="Rootfs (<?php echo show_size("rootfs.gz");
?>)" title="Extra initramfs for the initrd= parameter" type="submit" />
<?php echo shell_exec("sudo ./helper --boot-files ".$_POST['tmp_dir']); ?>
</td></tr>
<tr><td class="first">Configuration info:</td><td>
<input name="download" value="Configuration files" type="submit" />
<input name="download" value="packages.conf (<?php
echo show_size("fs/etc/packages.conf"); ?>)" type="submit" />
</td></tr>
<?php if (show_size("fs/boot/System.map") != "") { ?>
<tr><td class="first">Debug info:</td><td>
<input name="download" value="System.map (<?php echo show_size("fs/boot/System.map");
?>)" type="submit" />
<input name="download" value="linux.config (<?php echo show_size("fs/boot/config");
?>)" type="submit" />
<br>
<input name="download" value="busybox.config (<?php echo show_size("fs/boot/config-busybox");
?>)" type="submit" />
<input name="download" value="post_install.log (<?php echo show_size("post_install.log");
?>)" type="submit" />
</td></tr>
<?php } ?>
</table>
</form>
</div>
<script>
function floppy_form()
{
var element;
var fds=document.getElementById("fdsize");
for (i=1;;i++) {
element=document.getElementById("Floppy"+i);
if (element) document.getElementById("floppyset").removeChild(element);
else break;
}
for (i=<?php echo filesize($_POST['tmp_dir']."out"); ?>, j=1; i > 0; j++, i -= fds.value) {
element = document.createElement("input");
element.name = "download";
element.type = "submit";
element.value = element.id = "Floppy"+j;
element.title = "You can use dd or rawrite to create the floppy disk";
document.getElementById("floppyset").appendChild(element);
}
if (j == 2) element.value = "Floppy image";
}
floppy_form();
</script>
<h2>Going further</h2>
<p>Tiny SliTaz should be smaller to have more functionality and/or needs less
RAM.<br>
The kernel can be <a href="http://elinux.org/Linux_Tiny">tuned/patched</a> or
you can use an earlier version.</p>
<p>You can test Tiny SliTaz without pre-historic hardware using qemu (needs the
<tt>ne.ko</tt> module, i.e select ne - Kernel module for the ne2000 driver in
Step 2/5):</p>
<pre>
qemu -cpu 486 -m 4 -net nic,model=ne2k_isa -net tap -fda slitaz.img
</pre>
<p>Or</p>
<pre>
qemu -cpu 486 -m 4 -net nic,model=ne2k_isa -net tap -kernel kernel -initrd rootfs.gz /dev/null
</pre>
<p>And the executable file <code>/etc/qemu-ifup</code>:</p>
<pre>
#!/bin/sh
tunctl -u $(id -un) -t $1
ifconfig $1 192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0
</pre>
<?php
}
?>