The future is already here or coding right in the browser

I'll tell you about a curious situation that happened to me, and how to become a contributor to a well-known project.

Not so long ago, I was fiddling with one idea: booting Linux directly from UEFI ...
The idea is not new and there are a number of manuals on this topic. One of them can be seen here

Actually, my long-standing attempts to solve this issue resulted in a completely formalized decision. The solution is quite working and I use it on some of my home machines. This solution is described in a little more detail. here.

The essence of UEFI-Boot is that the ESP (EFI System Partition) partition is combined with the /boot directory. Those. all kernels and boot images (initrd) are placed on the same partition from which UEFI can run executable files and, in particular, run system boot loaders. But the Linux kernel itself is already assembled in many distributions with the UEFISTUB option, which allows the kernel itself to be launched from UEFI.

This solution has one unpleasant moment - the ESP partition is formatted in FAT32, on which it is impossible to create hard links (which the system creates regularly when updating the initrd). And there is nothing particularly criminal in this, but seeing system warnings when updating kernel components is not very pleasant ...

There is another way.

The UEFI boot manager (the one where you need to register the OS loader) can, in addition to boot loaders / Linux kernels, also load drivers. So you can load the driver of the file system where you have /boot and directly load the kernel using UEFI from there. The driver, of course, needs to be put in the ESP section. This is what boot loaders like GRUB do. But the highlight is that all the frequently used GRUB functions are already in UEFI. More precisely in his download manager. And to be even more boring, then the UEFI boot manager has even more options in some areas.

It seems to be a beautiful solution, but there is one β€œBUT” (or rather, it was, but more on that later). The fact is that the UEFI driver system is rather unpretentious. There is no such thing as mounting a file system or associating a driver with a specific device. There is a system call with the conditional name Map (English) which takes each driver in turn and tries to associate it with all, at the very least, suitable devices. And if the driver could pick up the device, then a mapping is created - a linking record. This is how the newly loaded driver should be initialized in a common heap with everyone else. And that's all you need - in the driver boot record, set one bit (LOAD_OPTION_FORCE_RECONNECT) to 1 and UEFI will do this very global remap after loading it.

But it's not so easy to do this. The standard efibootmgr utility (which is used to configure the UEFI unload manager) does not know how (or rather, did not know how) to set this bit. I had to put it in by hand through a rather complicated and dangerous procedure.

And once again trying to do it with my hands, I could not stand it and designed issue on GitHub asking the developers to add this feature.

Several days passed, but no one paid attention to my request. And out of curiosity, I looked at the source codes ... forked, and figured β€œon my knees” how to add this feature ... β€œOn my knees” because I didn’t set anything like that for myself and edited the source codes directly in the browser.

I know C (programming language) very superficially, but I roughly threw in a solution (mostly copy-paste) ... well, then I thought - but at least I probably have a lot of errors there (my past attempts to edit someone else's C-code were going to time from the 10th) I will issue a Pull Request. Well designed.

And there Travis CI turned out to be attached to check pull requests. And he diligently gave me all my mistakes. Well, if errors are known - no matter what to fix: again right in the browser, and on the fourth attempt the code was assembled (an achievement for me).

And so, without getting out of the browser, I designed a very real Pull Request into a utility that is used in almost all modern Linux distributions.

I myself was surprised by the fact that I didn’t really know the language, and didn’t set anything up (there, according to dependencies, not a small pack of libraries is needed for assembly) and I never even launched the compiler, I just β€œcoded” a completely working and useful feature in the browser .

However, my request has been hanging without a response since March 19, 2019, and I have already begun to forget about it.

But yesterday this request was added to master.

So what is my story about? And he is talking about the fact that, within the framework of modern technologies, it turned out that real code can already be written in the browser without deploying any developer tools and dependencies locally.

And, I must admit, this is my second pull request to well-known (at least in narrow circles) utilities. Last time, my request to correct the display of some fields in the SyncThing web interface resulted in my literally one-line edit in an environment that I do not know at all.

Only registered users can participate in the survey. Sign in, you are welcome.

Should I still write or not?

  • Yes

  • not worth it

294 users voted. 138 users abstained.

Source: habr.com

Add a comment