Live data from Hacker News

Porting Python to GRUB: “Networking without an operating system”

lwn.net

21–30 of 49 posts

Re: Porting Python to GRUB: “Networking without an operating system”

#21

Earlier quoted context omitted.

Did you modify the CPython binary to run in the BIOS, or did you write a new interpreter from scratch? What was the hardest part of implementing this?

We build CPython's source into BITS, which runs as an EFI binary. (Or as a non-EFI image bootable on a BIOS, but that version doesn't include network support.) We have almost no changes to CPython itself, other than a couple of minor fixes to enable some additional calling conventions in the ctypes module. The hardest part of porting Python in general was porting libffi to support the EFI calling convention, which re…

It sounds like IOCP on Windows. For example, asyncio.ProactorEventLoop and multiprocessing's PipeConnection can use it.

Re: Porting Python to GRUB: “Networking without an operating system”

#22

why would they not use lua ? which is pretty popular (and pretty much designed) as embedded scripting languages. Not to mention much more lightweight than python.. and has a much smaller footprint. Nginx is a pretty good example of this.

What is it that makes the language suitable for being embedded? Actually, what does it mean to be embedded?

Lua as mentioned before is very suited to run in an embedded environment because of it small size (both when executing and the actual source code size) and its modules, which makes it trivial to remove everything except the core language (IO support etc).

I'm running Lua on a DLX like processor implemented on a fpga, in this context Lua performs the same role as Basic did on many home computers in the 80's, a small IPL is setting up the machine and loading Lua on boot.

Re: Porting Python to GRUB: “Networking without an operating system”

#23

why would they not use lua ? which is pretty popular (and pretty much designed) as embedded scripting languages. Not to mention much more lightweight than python.. and has a much smaller footprint. Nginx is a pretty good example of this.

Why would they not use C? Or forth, or any number of alternatives. You would get the same question with the names shuffled around whichever one you chose.

If you want forth in your BIOS, buy a Sun workstation.

/snark:off

Re: Porting Python to GRUB: “Networking without an operating system”

#25

Was the talk recorded and can we expect it on the Pycon 2016 youtube channel[0] at some point? It's not there right now as far as I can tell. [0] https://www.youtube.com/c/pycon2016/videos

Yes: https://www.youtube.com/watch?v=AlkKvetGFSk The first few minutes of the talk got cut off; the conference organizers have the original footage and plan to re-cut and re-upload it at some point. The talk from PyCon 2015 on the Python port itself is available as well: https://www.youtube.com/watch?v=bYQ_lq5dcvM

Huh, I loaded all the way back to Pycon 2015 videos CTRL+F "Josh" or "Triplett" didn't find anything on my laptop. Strange

Anyway, thanks for the links!

Re: Porting Python to GRUB: “Networking without an operating system”

#27

Earlier quoted context omitted.

Why would they not use C? Or forth, or any number of alternatives. You would get the same question with the names shuffled around whichever one you chose.

If you want forth in your BIOS, buy a Sun workstation. /snark:off

[deleted]

Re: Porting Python to GRUB: “Networking without an operating system”

#28

why would they not use lua ? which is pretty popular (and pretty much designed) as embedded scripting languages. Not to mention much more lightweight than python.. and has a much smaller footprint. Nginx is a pretty good example of this.

> why would they not use lua ? The target audience for this is BIOS developers and firmware engineers. Several existing development tools in that area already support Python, including Simics and the Intel ITP, so the target audience is used to it. Lua also has several other impedance mismatches with the target audience, such as 1-based array indexing (remember, the target audience writes assembly and C). While peopl…

"... the target audience writes assembly and C)."

In C, I make frequent use of "switch" statements.

Does CPython have a switch statment?

Re: Porting Python to GRUB: “Networking without an operating system”

#29
post #28

Earlier quoted context omitted.

> why would they not use lua ? The target audience for this is BIOS developers and firmware engineers. Several existing development tools in that area already support Python, including Simics and the Intel ITP, so the target audience is used to it. Lua also has several other impedance mismatches with the target audience, such as 1-based array indexing (remember, the target audience writes assembly and C). While peopl…

"... the target audience writes assembly and C)." In C, I make frequent use of "switch" statements. Does CPython have a switch statment?

The context is that Lua has "several other impedance mismatches" beyond Python, not that Python-the-language is like C.

Note that Lua also does not have a switch statement: http://lua-users.org/wiki/SwitchStatement .

Re: Porting Python to GRUB: “Networking without an operating system”

#30
post #29
post #28

Earlier quoted context omitted.

"... the target audience writes assembly and C)." In C, I make frequent use of "switch" statements. Does CPython have a switch statment?

The context is that Lua has "several other impedance mismatches" beyond Python, not that Python-the-language is like C. Note that Lua also does not have a switch statement: http://lua-users.org/wiki/SwitchStatement .

I made no mention of Lua. The context is C and assembly programmers as an audience.

But let's consider Lua. Most of the Lua pogrammers I know also know C. How do they handle the so-called "impedence mismatches"? (Should this be plural? What else besides 1-based arrays?)

As far as I know Lua's target audience is, at least in part, C programmers. That's why it's made to be easy to embed in a C program.

Post reply on HN