Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Luakernel – Lua + SQLite + musl libc running on x86 (github.com/ers35)
115 points by ers35 on Oct 21, 2014 | hide | past | favorite | 24 comments



Since there is nothing obvious on the page: This is Lua+SQLite running on bare metal x86.

Lots of questions: does it actually have any performance benefits? A network stack? How do the mechanics of getting/editing files work?


The codebase is so small that it's quite easy to take a look to answer the questions:

* no networking at all

* performance - doing what?

* file primitives are implemented purely in Lua, and what is currently there resembles a pre-initialized ramfs. Closing a file is a NOP, the concept of numerical file descriptors is not fully implemented yet. So - no block devices yet.

* aside from file primitives, you have lua coroutines as the core of the scheduling, inb()/outb() (bytewise port I/O), and putpixel/clearscreen in the API implemented in C, as well as basic keyboard handling (using inb/outb wrappers) and graphics primitives (using putpixel/clearscreen) implemented in Lua.

I suggest to take a quick peek at luakernel.c and luakernel.lua in the codebase.


If you want Lua running on bare metal with a network stack you can use the rump kernel[1].

[1] http://rumpkernel.org/


Consider this somewhat similar to booting up an 8-bit home-computer and get thrown into a BASIC prompt. It's a fun toy and a great experiment. It's not a "product".

Play with it if you want to experiment with Lua and/or experiment with a simple OS built around a higher level language. Don't play with it if you want something to build your next app on.


It would be very interesting if this could be combined with snabbswitch for some truly awesome bare-metal lua networking.


I've never seen snabbswitch before, are there any lua extensions to get it to emulate tcp/ip stack and present the data stream to your lua code??


It basically talks to certain network-cards directly, bypassing the TCP/IP stack. AFAIK it presents raw ethernet packets to the lua code which have to be parsed by the application (i don't know exactly if there isn't some code present in the repo to deal with sockets and such directly). The repo: https://github.com/SnabbCo/snabbswitch Under src/apps there are some examples.


is it a .ko or an user space app?


Userspace, it mmaps that PCI space itself.


Downloaded the iso and ran under a vm but it crashes as soon as I try any command.

I'm curious what's the easiest way to test this?

[1] https://github.com/ers35/luakernel/blob/master/bin/luakernel...


Try running it under qemu[1] or bochs[2]. A "virtual machine" software such as VMWare or Virtualbox is not the same as a low-level "bare metal" CPU emulator such as the two I suggested. The latter programs make assumptions about how the guest OS will behave that probably aren't valid for this project.

I suggest starting with bochs since this project has a bochsrc.txt in the git root that will be automatically picked up if you just run "bochs" in that directory.

[1] http://wiki.qemu.org/Main_Page

[2] http://bochs.sourceforge.net/


What command did you try? I am able to run the iso in QEMU, VirtualBox, Bochs, and on real hardware.

This is still in the early stages of development, and much is not yet implemented. One way to trigger a crash is to call an unimplemented system call.


Pretty interesting, just a pity he didn't specified an actual license, as "disclaims all copyright" has no legal value and even if it had, it would certainly mean different things from one country to an other (for example in France you can't, even yourself, put something you've produced in the public domain as you can't cede your paternity 'right')


Surely, a formal license or public-domain-dedication (such as 'CC0') would be better – and perhaps especially better for the author, who could then clearly disclaim other implied warranties.

But the "disclaims copyright" language probably has some legal value, in many jurisdictions. It might be interpreted as a public-domain dedication, where those have meaning. Or, as a promise which was relied upon, preventing a later copyright-enforcement claim by estoppel doctrines.

A lawyer could say, and of course the advantage of existing licenses/dedications is that they've already been legally reviewed for clarity across many jurisdictions. But this sort of overt declaration may still protect many re-users if push ever came to legal shove. And it might even be useful to establish such a precedent – that sharing is safe with only such a small, clear, plain, blanket statement.


Not in a fair number of European countries (France, Germany, ...) - as the op stated you can not cede your copyright which is granted by law. You can't even sign it away (instead have to grant an unlimited + exclusive license to your employer for example)


In France at least you can cede what in English would be called copyright. What you can not sell are the moral rights, and this is the case or a bunch of European countries.

I'm not aware of any European countries where you can not cede reproduction rights / proprietary rights?


Good to know! (That's why I included the qualifier "in many jurisdictions".)

Here, also, Creative Commons' "CC0" declaration is a friend of authors who want to be universally open. CC0 was designed with multiple fallback clauses, intended to also handle copyright systems like those of France or Germany.


The ISC license is much simpler: https://www.isc.org/downloads/software-support-policy/isc-li...

But perhaps not as universal?


CC0 doesn't even necessarily require that you distribute the license text or copyright notice. You can use it as you'd use a public domain work - do anything with it.


I took inspiration from SQLite: https://www.sqlite.org/copyright.html https://github.com/ers35/luakernel/blob/master/dep/sqlite3/s...

I agree that the licensing terms need clarification.


Richard Hipp went on to say he wishes he didn't use public domain, because of its ambiguity.

see: https://web.archive.org/web/20120510151444/http://methodlogi...


SQLite does seem to have that effect of inspiring other public domain works: http://unlicense.org



What does this need to be useful for real work? Ie serve html? A network stack, file system, process mgmt?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: