IRC channel logs

2022-11-10.log

back to list of logs

<zacque>Hi, I've just started learning about bootstrappable builds. I've done `nasm -o stage0_monitor stage0_monitor.S`, but how can test the output?
<zacque>The instruction states `qemu -fda stage0_monitor`, but there is no qemu, only qemu-* on my system. (x86_64, Linux, Ubuntu)
<zacque>My qemu is version 7.1.0
<zacque>Oh, I can boot with `qemu-system-x86_64 stage0_monitor` instead! Thanks, myself =D
<rickmasters>zacque: maybe you know this but stage0_monitor is very low level program to start with.
<rickmasters>zacque: running "./kaem.x86" from the top will run the normal build
<stikonas[m]>./will start with bash. If you to use kaem run bootstrap-seeds/POSIX/AMD64/kaem-optional-seed
<stikonas[m]>zacque: oh and you might want to start with stage0-posix first
<zacque>rickmasters: Thanks! I'm fascinated by the idea that one can bootstrap everything from stage0_monitor(?), so I'm eager to study how it works
<stikonas[m]>leave stage0 baremetal bootstrap for later
<zacque>stikonas[m]: Oh, is stage0 and stage0-posix not the same?
<zacque>Ahh, I see, thanks!
<stikonas[m]>No, one is running on Linux, the other is baremetal
<stikonas[m]>We also have WIP stage0-uefi
<stikonas[m]>That runs as UEFI application
<stikonas[m]> https://git.stikonas.eu/andrius/stage0-uefi
<zacque>Wow!
<stikonas[m]>Though it still needs a bit more work on C library
<stikonas[m]>But we are able to build C compiler there
<zacque>Wow, that's good to know!
<stikonas[m]>rickmasters also has very small kernel that uses BIOS calls to run stage0-posix
<zacque>Oh, is it the live-bootstrap project?
<stikonas[m]>It can build up to tcc
<stikonas[m]>No, at least not yet
<rickmasters>it's here: https://github.com/ironmeld/boot2now
<stikonas[m]>Since that builder-hex0 kernel can't run make yet
<zacque>Oh, thanks!
<stikonas[m]>So we are still a bit away from being able to build Linux with it
<rickmasters>the kernel builder-hex0 is a submodule and the source is from live-bootstrap, another submodule
<stikonas[m]>And stage0-uefi stops even earlier
<zacque>Wow, all these sound amazing, and intrigue me to learn more! =D
<zacque>I'm gonna start learning from hex0? Is this a good place to start?
<rickmasters>zacque: yes, it was for me
<stikonas[m]>Yes, it's fairly simple though you need to pick arch
<zacque>That's good to know, thanks!
<stikonas[m]>e.g. x86 amd64, risc-v, aarch64
<zacque>I'm on x86_64, so it's AMD64 for me
<stikonas[m]>Start with C or assembly prototype https://github.com/oriansj/stage0-posix-amd64/blob/master/NASM/hex0_AMD64.S
<stikonas[m]> https://github.com/oriansj/stage0-posix/blob/master/High%20Level%20Prototypes/hex0.c
<stikonas[m]>Or you can look at uefi versions
<stikonas[m]> https://git.stikonas.eu/andrius/stage0-uefi/src/branch/main/Development/hex0.c
<stikonas[m]>Opening file is much harder in uefi
<zacque>Ah, I'm not family with uefi, so I'll start with POSIX one
<zacque>Thanks for the C and assembly prototype! Now things start to make sense!
<stikonas[m]>We probably need nicer M0 defines though, I've switched cc_amd to newer style that are closer to GAS syntax
<stikonas[m]>But early programs use more custom ones
<stikonas[m]>E.g. https://github.com/oriansj/stage0-posix-amd64/blob/master/Development/M0_AMD64.M1 vs https://github.com/oriansj/stage0-posix-amd64/blob/master/GAS/cc_amd64.S
<stikonas[m]>Anyway, that will become clearer as you go through hex0, hex1 hex2 M0 and cc_amd64
<rickmasters>for hex0, I found that understanding the first command in x86/mescc-tools-seed-kaem.kaem was a good place to start because it's basically building itself
<stikonas[m]>Basically it strips comments and converts ASCII encoded hexadecimals into bytes
<rickmasters>AMD64/mescc-tools-seed-kaem.kaem for AMD64
<stikonas[m]>Yes, kaem scripts are also good place to look at
<zacque>I see, I'm looking at AMD64/mescc-tools-seed-kaem now
<zacque>Can I know what does "kaem" stand for?
<zacque>Not sure how to pronounce it as well, kaa-emm?
<rickmasters>I don't know where kaem comes from. That's probably a question for oriansj
<rickmasters>In my head, its kaym
<zacque>Ahh, I see =D
<rickmasters>kaem is a puzzled "make" according to https://logs.guix.gnu.org/bootstrappable/2021-05-18.log
<zacque>Aha! Thanks!
<zacque>This link has other useful info as well!
<rickmasters>yeah, the chat logs are invaluable, but unfortunately the search is not very good
<zacque>Oh, the previous kaem-optional-seed.hex0 is rename to kaem-minimal.hex0?
<zacque>And so kaem-minimal.hex0 is still 1:1 to kaem-optional-seed?
<rickmasters>AMD64/kaem-minimal.hex0 and bootstrap-seeds/POSIX/AMD64/kaem-minimal.hex0 are the same
<rickmasters>I'm not sure why the duplication but bootstrap-seeds is a submodule so its probably for convenience
<rickmasters>but yes, I'm pretty sure the kaem-optional-seed binary originates from kaem-minimal.hex0
<zacque>Aha, thanks!
<rickmasters>Everyone: I have an update on my efforts on the next bootstrap kernel.
<rickmasters>As a reminder, I reported on 10/17 that my efforts to build Linux with tcc were failing.
<rickmasters>On 10/18 fossy referred me to the linux clone https://github.com/mikaku/Fiwix.
<rickmasters>This project was started about 25 years ago and is still being worked on.
<rickmasters>Some history: https://www.osnews.com/story/4839/the-gnufiwix-operating-system/
<rickmasters>I have spent the last three weeks working with Fiwix and I believe it fits our requirements
<rickmasters>for the next kernel system which can carry us the rest of the way to building and booting Linux.
<rickmasters>I'm still in the early stages of this effort but I've learned a lot and solved some difficult problems along the way.
<rickmasters>My initial focus has been on building it normally (with gcc), running it in qemu, and booting from a large ram drive.
<rickmasters>I had to get really familiar with how it boots and manages memory, which evolves in several stages,
<rickmasters>so that I could implement a new strategy for booting off a very large ram disk.
<rickmasters>I'm pretty happy with how I got that working so I'm going to proceed soon on to building it with tcc.
<rickmasters>There are errors compiling some of the assembly language with tcc so I'll have to work though that.
<rickmasters>Anyway, I've got a pretty good idea of all the work that will be needed.
<rickmasters>It will probably take a number of months to do but I'm pretty hopeful I'll be able to get it done.
<rickmasters>I'll try to post updates periodically of my progress.
<zacque>Okay! Now I've got an rough idea. But question: At the end of kaem.run, what do I have at my disposal? Is it M2-Planet or M2-Mesoplanet?
<zacque>And how can I use it?
<zacque>I don't see any mescc-tool around?
<zacque>Ah, I get it, I get it. Thanks =D
<stikonas[m]>zacque: you have both
<stikonas[m]>M2-Mesoplanet is just a C preprocessor that can invoke M2-Planet, M1 and hex2
<stikonas[m]>M2-Planet has far weaker preprocess integrated but it has no include support
<stikonas[m]>But it has basic #if defined #else, #define, etc
<oriansj>zacque: I suggest learning posix -> uefi -> Bare metal and hex0->hex1->hex2->M0->cc_amd64->M2-Planet (yes kaem [I pronounce it like common] is just make scrambled ^_^)
<oriansj>and of course rickmasters' kernel is currently the most advanced x86 bare-metal bootstrap to date
<zacque>stikonas[m] oriansj: I see, thanks!
<oriansj>zacque: and if anything doesn't seem obvious in bootstrap-seeds, stage0, stage0-posix, mescc-tools, mescc-tools-extra, M2-Planet or M2-Mesoplanet doesn't appear totally obvious please tell me as I consider that a defect that needs to be fixed.