1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
elua/doc/en/tut_bootpc.html
James Snyder bd1465ca50 Merge 0.6 branch to trunk.
Conflicts:
	SConstruct
	doc/en/arch_platform.html
	doc/en/comunity.html
	doc/en/overview.html
	doc/en/refman.html
	doc/en/refman_gen.html
	doc/en/status.html
	doc/en/tut_bootstick.html
	doc/images/lng_pt.png
	doc/images/minusnode.png
	doc/images/next.png
	doc/images/node.png
	doc/images/nodelast.png
	doc/images/plusnode.png
	doc/images/plusnodelast.png
	doc/images/previous.png
	doc/images/showall.png
	doc/images/sync.png
	doc/images/vertline.png
	doc/pt/arch.html
	doc/pt/arch_coding.html
	doc/pt/arch_con_term.html
	doc/pt/arch_newport.html
	doc/pt/arch_overview.html
	doc/pt/arch_platform.html
	doc/pt/arch_tcpip.html
	doc/pt/building.html
	doc/pt/comunity.html
	doc/pt/dl_binaries.html
	doc/pt/dl_old.html
	doc/pt/dl_sources.html
	doc/pt/downloads.html
	doc/pt/examples.html
	doc/pt/faq.html
	doc/pt/installing_i386.html
	doc/pt/installing_lm3s.html
	doc/pt/news.html
	doc/pt/overview.html
	doc/pt/refman_dep.html
	doc/pt/refman_gen.html
	doc/pt/status.html
	doc/pt/tc_386.html
	doc/pt/toolchains.html
	doc/pt/tut_openocd.html
	doc/pt/using.html
	romfs/LM3S.lua
	romfs/led.lua
	romfs/morse.lua
	romfs/pong.lua
	src/lua/linit.c
	src/modules/auxmods.h
	src/platform/lm3s/platform.c
	src/platform/lm3s/platform_conf.h
	src/platform/sim/platform_conf.h
2009-10-13 02:14:27 +00:00

97 lines
4.9 KiB
HTML

$$HEADER$$
<h3>Booting your PC in eLua</h3>
<p>That's right: after following this tutorial, your PC will boot
directly into Lua! No OS there (this explains why the boot process is
so fast), just you and Lua. You'll be able to use the regular Lua
interpreter to write your programs and even use "dofile" to execute Lua
code.</p>
<h2>Details</h2>
<p>Booting <b>eLua</b> involves using the well known <a href="http://www.gnu.org/software/grub/">GRUB</a> that will be used to load
a <a href="http://www.gnu.org/software/grub/manual/multiboot/">multiboot</a>
compliant ELF file that contains our <b>eLua</b> code. The code runs in protected mode, so you
have access to your whole memory. The code does not access any kind of
storage device (HDD, CDROM, floppy), so if you're worried that it might
brick your system, you can relax now :) I'm only using some very basic
keyboard and VGA textmode "drivers", so all you're risking is a system freeze
(even this is highly unlikely), nothing a good old RESET can't handle
(be sure to use the hardware reset though, CTRL+ALT+DEL is not handled
by the code). But just in case, see also the next section.</p>
<h2 style="background-color: orangered;">Disclaimer</h2>
<p>As already mentioned, the code won't try to access any kind
of storage (HDD, CDROM, floppy), not even for reading, so you don't
need to worry about that. Also it doesn't try to reprogram your video
card registers, so it can't harm it or your monitor. It only implements
a "protected mode keyboard driver" that can't physically damage
anything in your system. In short, I made every effort to make the code
as harmless as possible. I tested it on 5 different computers and in 2 <a href="http://www.virtualbox.org/">VirtualBox</a>
emulators, and nothing bad happened. That said, there are no warranties
of any kind. In the very unlikely event that something bad does happen
to your system, you have my sincere sympathy, but I can't be held
responsible for that.</p>
<h2>Prerequisites</h2>
<p>To boot your computer in Lua you'll need:</p>
<ul>
<li>a 386 or better computer running Linux. I actually tested
this only on Pentium class computers, but it should run on a 386
without problems.</li>
<li><a href="http://www.gnu.org/software/grub/">GRUB</a>.
Since you're running Linux, chances are you're already using GRUB as
your bootloader. If not, you must install it. You don't need to install
it on your HDD; a floppy, an USB stick or even a CDROM will work as
well. I won't cover the GRUB installation procedure here, just google
for "install grub on floppy/usb/cdrom" and you'll sure find what you're
looking for. You can try for example <a href="http://orgs.man.ac.uk/documentation/grub/grub_3.html">here</a>,
<a href="http://www.freesoftwaremagazine.com/articles/grub_intro/">here</a> or
<a href="http://www.mayrhofer.eu.org/Default.aspx?pageindex=6&amp;pageid=45">here</a>.</li>
<li>The <b>eLua</b> i386 ELF file, see <a href="downloads.html">here</a> for instructions on how to obtain it. OR <a href="downloads.html">download the eLua source distribution</a> and compile it
for the i386 architecture using a toolchain that you can build by following <a href="tc_386.html">this tutorial</a>.</li>
<li>a text editor to edit your GRUB configuration file.</li>
</ul>
<p>The rest of this tutorial assumes that you're using Linux with GRUB,
and that GRUB is located in <i>/boot/grub</i>, which is true for many Linux
distributions.</p>
<h2>Let's do this</h2>
<p>First, copy the eLua ELF file to your "/boot" directory:</p>
<pre><code>$ sudo cp surprise /boot<br></code></pre>
<p>Next you need to add another entry to your GRUB menu file (<i>/boot/grub/menu.lst</i>). Edit it and add this entry:</p>
<pre><code> title eLua
root (hd0,0)
kernel /boot/elua_lua_i386.elf <b>(change this if the eLua file name is different)</b>
boot</code></pre>
<p>You may need to modify the <i>root (hd0,0)</i> line above to match your
boot device. The best way to do this is to look in the <i>menu.lst</i> file
for the entry that boots your Linux kernel. It should look similar to
this:</p>
<pre><code> title Ubuntu, kernel 2.6.20-16-generic
<b>root (hd0,2)</b>
kernel /boot/vmlinuz-2.6.20-16-generic
initrd /boot/initrd.img-2.6.20-16-generic
savedefault</code></pre>
<p>After you find it, simply use the <i>root (hdx,y)</i> line from that entry
(<i>root (hd0,2)</i> in the example above) in your newly created entry instead
of root (hd0,0).<br>
That's it! Now reboot your computer, and when the GRUB boot menu
appears, choose "eLua" from it. See <a href="using.html">using eLua</a> for
instructions on how to use your newly installed self-booting programming language :)</p>
<p>As usual, if you need more details, you can <a href="overview.html#contacts">contact us</a>.
Also, if you want to go one step ahead and have you own USB stick that boots <b>eLua</b>, check <a href="tut_bootstick.html">this tutorial</a>.</p>
$$FOOTER$$