Live data from Hacker News

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

lwn.net

31–40 of 49 posts

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

#31

I'm one of the authors of BITS, and the presenter of the PyCon presentation this article discusses. Happy to answer any questions here.

How big is the base image, e.g. printing "hello world" to the console? Is it modular, e.g. if you don't need networking[1] how hard is it to not include networking?

[1] I'm using networking as an example package, not knowing what other semi-optional packages could be used as an example.

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

#32
post #30
post #29

Earlier quoted context omitted.

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.

JoshTriplett's comment was a response to "why would they not use lua?" The points were all made relative to "C and assembly programmers" using Python vs. the same using Lua.

You can't simply pull a few words out of the comment and assume it means there is no mismatch what C programmers expect and what Python offers. It doesn't mean that and wasn't meant to mean that.

You wrote "Lua's target audience is, at least in part, C programmers". That is also true of CPython. Bear in mind that these facts aren't that relevant. This code is not mean for the wider class of "C programmers". The relevant bit is "the target audience writes assembly and C". This is far different than "the target audience is assembly and C programmers", which appears to be what you think it says.

Instead, the target audience is the narrower class of people writing EFI binaries and working with the EFI protocol. As JoshTriplett further clarified, the "existing development tools in that area already support Python", but apparently not in Lua.

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

#33
post #30
post #29

Earlier quoted context omitted.

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.

Found the Lua developer!

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

#34
post #32
post #30

Earlier quoted context omitted.

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.

JoshTriplett's comment was a response to "why would they not use lua?" The points were all made relative to "C and assembly programmers" using Python vs. the same using Lua. You can't simply pull a few words out of the comment and assume it means there is no mismatch what C programmers expect and what Python offers. It doesn't mean that and wasn't meant to mean that. You wrote "Lua's target audience is, at least in p…

To sum up, the target audience was EFI developers who would prefer to write Python than write assembly, C or Lua.

No problem. I get it.

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

#36

How is this different from micropython?

Micropython is a independent implementation of Python with some microcontroller-specific extensions and able to run on smallish microcontrollers, this is a slightly modified "standard" CPython für x86.

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

#37

Earlier quoted context omitted.

I am always interested to hear when a language is ported to a new plaform, in this case Python (or a subset of) on GRUB. The question would be why? Is this because you have lots of test cases already in Python and can easily deployed those test cases on using this?

Originally, it was because we had a lot of one-off test cases not written in Python. Before BITS, most BIOS test programs consisted of one-off DOS programs, or later one-off EFI programs. If you wanted a new test, or you wanted a customer to quickly gather some information for you, you sent them a new test program, or a bootable image. Now, many of those one-off tests have become Python one-liners, and you can use Py…

Wow. I thought this was one of those "just because you can," projects, but it looks like there are some real practical uses for firmware developers/testers.

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

#39

is BITS building for ARM ?

No. We don't have any need for that ourselves, but if someone wanted to work on that, and produced a clean patch that wasn't filled with #ifdefs in C and ifs in Python, we'd take it.

The biggest challenge would be adding equivalents of the assembly that implements SMP support (waking up other CPUs and putting them into a loop ready to run code on request).

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

#40

I'm one of the authors of BITS, and the presenter of the PyCon presentation this article discusses. Happy to answer any questions here.

Awesome stuff! What are your future plans in this effort?

Could you envision a (G)UI toolkit written in Python that could be used to write applications that run in EFI?

Post reply on HN