IRC channel logs
2022-05-12.log
back to list of logs
<achaninja>ekaitz: yeah I'm using cproc and qbe because I know the authors of both <ekaitz>achaninja: they did a nice job on that. I really like the ideas behind those projects <stikonas>well, I guess right now cproc and qbe are alternatives to newer tcc versions <stikonas>for now one still has to go via tcc-0.9.26 <stikonas>it would become very interesting if at some point cproc/qbe could be build with mescc <stikonas>I guess the same license applies to wrappe scripts in top level directory of boot2now? <rickmasters>stikonas: yes, whoops i neglected to add the notices, will do so <stikonas>initially I even neglecged to look at notices... <rickmasters>orianjs: i provided a 384 byte bootstrap so i guess it depends on the goals <oriansj>stikonas: we don't need it but it is another route to build the hex0 <stikonas>oh you mean bootOS->hex0 and do builder-hex0.hex0->builder-hex0.img <oriansj>as in the hex0 in builder-hex0.hex0 could be built by bootOS <stikonas>oriansj: anyway, with builder-hex0 you probably won't have to worry about writing kernel in assembly. Next kernel can be written in M2-Planet subset <stikonas>though I think you said M2-Planet subset is still a bit annoying to write kernels in <stikonas>or maybe we get lucky and mes-m2 runs on builder-hex0 <doras>stikonas: I see that the permissions are different all the way to guile-3.0.7_0.x86.xbps. <doras>So... something is fishy here. <oriansj>well mes.c does require a couple more syscalls than what was listed. <stikonas>oriansj: do you remember which syscalls? <stikonas>at least some of that was just detecting interactive mode <rickmasters>even hex2 would be a lot easier than hex0, those jumps... <stikonas>you are just limitted to smaller programs <stikonas>and builder-hex0 is maybe three times as big as hex0+kaem-optional-seed <oriansj>rickmasters: M0 is even a viable option for bare metal <stikonas>yes, but since builder-hex0 can go to at least M2-Mesoplanet we don't need to use M0 later <rickmasters>it seems like a kernel would have a mix of assembly and higher level <rickmasters>i don't know enough about the syscall requirements beyond stage0-posix <oriansj>well M2-Mesolplanet does support inline assembly so we can definitely do a Kernel in it <rickmasters>builder-hex0 does not really implement chmod or access so they would need to be reimplemented as well <oriansj>rickmasters: chmod+access would only matter if we needed them for the filesystem we would be working with. <rickmasters>the file system is ... primitive, probably needs a rewrite - you can't really expand a file after closing it <oriansj>rickmasters: that isn't an issue for us <oriansj>mescc just does a single write as well <oriansj>TCC and above however would be an issue <rickmasters>i thought i read somewhere here that tar was capturing file modes and affecting checksums <stikonas>rickmasters: yes, recently live-bootstrap switched to creating some hand-rolled packages <stikonas>basically just .tar.bz2 with contents of make install DESTDIR=/tmp/destdir <stikonas>rather than just checksumming binary files <stikonas>but with old tar the problem is that order is not deterministic <stikonas>seems to work fine in tmpfs but if you run it outside tmpfs, the order might be different <stikonas>in principle yes, we use patches in live-bootstrap <stikonas>but that might not be the easiest solution <stikonas>that's the latest tar that can be built with mes libc <stikonas>but then we still have an issue with permissions if one tries to run everything rootless <rickmasters>i should also mention that builder-hex0 only supports one outstanding child with fork, if anything forks a lot (like make), it won't work <stikonas>and tcc is already too complicated for builder-hex0 <stikonas>I was actually thinking of moving make immediately after tcc in live-bootstrap <stikonas>I've also experimented a bit with newer tar 1.13 (haven't tried even newer ones) <stikonas>tar 1.13 is missing two functions in meslibc <rickmasters>a much more capable kernel beyond builder-hex0 would be needed for make <stikonas>yes, but from what oriansj said, even tcc wouldn't run on builder-hex0 <stikonas>so as long as we keep make after tcc, we should be fine <stikonas>and wouldn't add any additional constraints <stikonas>well, in bootstrap we deliberately used few syscalls early on <stikonas>e.g. kaem does not use dup or any other similar stuff <stikonas>we can't implement $(command) then but at least it can run on simple kernel <rickmasters>yes, i was surprised how for it got on so few syscalls <stikonas>we only start using pipes once we reach bash <stikonas>before that scripting does not use "tar xzf" but uses two steps (unpack and untar) <stikonas>but it was still a bit of guess work since we didn't have any kernel <stikonas>just in general attempted not to use complex stuff <rickmasters>adding it up: file system, paging, multitasking, pipes, dup, etc <rickmasters>nice - looking for existing work is my instinct, maybe porting it M2-Mesoplanet <stikonas>also it would be nice if newer kernels supported something like kexec... <stikonas>then one can easily do automatic chaining <stikonas>hopefully kexec shouldn't be hard to implement, just loading new kernel somewhere and jumping into it <oriansj>we might also end up having to extend what M2-Planet/M2-Mesoplanet supports <stikonas>well, last upgrade already extended it quite a bit <stikonas>1.10 has quite a few extra things compared to 1.9 <oriansj>but rickmasters your work is epicly impressive and you should feel very proud <rickmasters>oriansj: and contributors, honestly don't know the history, but it seems you are the focal <oriansj>rickmasters: everyone here is excellent and if it wasn't for their help it would have taken another decade to get this far <rickmasters>stikonas: thank you, i've read a lot about live-bootstrap and mes, its all great work <stikonas>well, it was inspired by guix and follows work done there <rickmasters>not too familiar with guix, did it approach boostrapping more from a top down perspective? <stikonas>and was trimming down its bootstrap seed <stikonas>live-bootstrap was done bottom-up and hence is more strict with pregenerated files <stikonas>but it was made possible by combining both approaches <stikonas>mes/mescc came from top down approach (with the goal of building gcc) <stikonas>and stage0/stage0-posix was building from hex0 <stikonas>and it was about 1.5 years ago when the gap got closed <stikonas>though it took some time to get everything into released versions <rickmasters>so, besides the kernel, is the bootstrap to gcc completely done? <stikonas>although we couldn't bootstrap gnu autogen for regenerating top-level configure script in gcc <rickmasters>stikonas: ok, i watched a presentation that said there was some missing work on mes or something but that may have been old <stikonas>but running ./configure in gcc subdirectories works around this <oriansj>so yeah, your kernel work, puts us very close to doing a bare metal x86 to full Linux distro <stikonas>yes, I expected it would take a few years to get to this stage <oriansj>assuming we get a little more advanced kernel written in C that M2-Mesoplanet/M2-Planet can build supporting maybe 31 more syscalls; we would be able to build Linux and the rest would be details <oriansj>we might actually be done before bootstrappable hits the 10 year mark <rickmasters>oriansj: i've been thinking that there would need to be utilities build to format a file system and lay down bootloaders, grub/lilo <stikonas>rickmasters: worth emailing your work to bootsrappable mailing list <stikonas>but live-bootstrap does need a real disk for system c which is preformatted and loaded with source tarballs <rickmasters>i guess the transition from 32 bit to 64 bit linux is well established? <oriansj>indeed and trivial after one has binutils, gcc and guile <rickmasters>just wondering if its been automated before but shouldn't be a problem <stikonas>live-bootstrap for now stays in 32-bit mode <rickmasters>which makes sense, a full 64 bit bootstrap is hard to imagine <rickmasters>i mean starting in 64 bit, like with a 64 bit kernel, i'm not signing up <rickmasters>is cross compiling to other architectures a sufficient strategy for those architectures or will is it an open goal to try to boostsrap every architecture from bare metal? <oriansj>rickmasters: personally, I want to do *every* architecture from bare metal but doing just 1 is enough to show that it is possible and end the debate <oriansj>and provide a root capable of enabling DDC to find all trusting trust attacks in the entire ecosystem <oriansj>doing all of the architectures would even allow us to even detect hardware level subversion <rickmasters>oriansj: i see. thats ... ambitious and i don't disagree because 386 may not last forever <rickmasters>carting emulators around will get tiresome - the bootstrap will need to keep up with the times, someone will port to apple M9 in 2093 and never look back <rickmasters>the more implementations the better i guess is what i'm trying to say, but cross compiling seems find to me for now <oriansj>well you just showed that the root kernel can be *MUCH* simpler than I planned and going by time to completion for the cc_* rewrites: ^_^ that isn't very far off <oriansj>if we do the C kernel in a cross-platform manner, we create another universal base and porting to new architectures becomes a 4 step process: M2-Planet+mescc-tools, stage0-posix, C kernel and builder-hex0 rewrite. <rickmasters>yeah i guess i'm imagining how hard it would have been to write builder-hex0 in 64 bit from scratch - just unknown to me. maybe its not so bad <oriansj>rickmasters: well, if it had been me: Write in M1 first and then use emacs macros to do the conversions to hex2 and then calculate the labels and then jumps/calls <rickmasters>i decided not to do that on principle, but it would have been a lot easier <rickmasters>spending 6 hours isolating a typo'd opcode is no fun <oriansj>and honestly all the more impressive <rickmasters>oriansj: excited to see where this goes. great meeting you and everyone. near my bedtime but i'll be back in 9 hours or so <oriansj>a pleasure rickmasters and stay awesome <fossy>rickmasters: this is absolutely insane, amazing work <fossy>rickmasters: this is a *massive* development, thank you very much for your contribution <Hagfish>yeah, it's like Christmas has come early for the bootstrappers this year :) <fossy>arches my personal opinion is cross compiling is good for everything BUT i would like it if we can someday make an open arch the "base" arch that everything can be cross compiled from <fossy>stikonas[m]: FYI i've nearly finished sysc network source download, but disk-source behaviour will be retained, behind command-line flag for rootfs.py & used if found within the disk <stikonas[m]>fossy: can you add an option to specify remote mirror for downloads? <fossy>stikonas[m]: no, that seems simple to me, i'll add that <Franciman>i was thinking about how much would it take to add a bytecode interpreter <Franciman>i'm working on my bootstrappable scheme (before i knew about mes, but now i keep going cuz it's fun lol) <stikonas[m]>fossy: BTW, are you going to format disk in sysb in download mode? Or not planned right now? <fossy>stikonas[m]: yes, disk formatted in sysb, if it has no existing partitions <fossy>rickmasters: is there a known limit to the size of helloworld.src? i tried adding mes to it, but it fails in the src file src file stage, kernel crashes <rickmasters>fossy: hmm, no, but i did run into bugs as it got bigger and bigger, so not too surprised <rickmasters>wait, now that I check - there is a 1M limit total in build.sh near the top <fossy>oh, ok, that makes sense, it was around 5M <rickmasters>you should be able to just change 2056 to (size / 512) + 8 <janneke>the numbers seem all off / don't seem to work? <janneke>ah, something had me terribly confused by equating riscv64 with s390? <achaninja>janneke: what does the -DBOOTSTRAP do in your tcc? <achaninja>I also wonder about LONG_LONG_STUB, but i guess that just emulates LONG_LONG by computing only the low 32 bits? <achaninja>I guess it looks like it removes some features mescc can't support <janneke>mescc does not support floats, so they are compiled in in several steps <janneke>achaninja: see boot.sh, which is called several times by build.sh <achaninja>thanks, I made the mistake of not using them properly and ended up with a mostly working tcc <achaninja>janneke: I have new appreciation for the work you put into patching tcc <janneke>it's all pretty much a best-effort thing <janneke>not really what we want the "final" full source bootstrap to look like ;) <achaninja>Well I will be happy to see the progress as it occurs <stikonas[m]>Well, progress is happening. We can now do bootstrap using released mes. Hopefully gash will soon run on mes. Then we'll be able to use mes/mescc build system <stikonas[m]>janneke: have you seen the new kernel? Might be nice if we get mes running on it (if that is possible) <janneke>stikonas[m]: oooh, that's awesome rickmasters *janneke would like to see that! <unmatched-paren>rickmasters: thanks again for your work! i can't get builder-hex0 to run on my guix system though; i'm running `make` in a `guix shell qemu xxd make`, but all i get is "No bootable device" from the qemu firmware <rickmasters>unmatched-paren: i guess i would start by seeing what did work, maybe ls -ltr <rickmasters>cut builder-hex0.hex0 -f1 -d'#' | cut -f1 -d';' | xxd -r -p > builder-hex0-seed.bin <rickmasters>does it run without error but produce an empty file? <unmatched-paren>oh, i see. that command produces the right file, but the mini-seed is 0 bytes large <rickmasters>so sorry cut builder-hex0-mini.hex0 -f1 -d'#' | cut -f1 -d';' | xxd -r -p > builder-hex0-mini-seed.bin <rickmasters>are you in the boot2now repo, that was just the builder <rickmasters>boot2now combines that (it has its own snapshot of builder-hex0) with the stage-posix source <unmatched-paren>rickmasters: btw, i just noticed a number of improvements that could be made to the builder-hex0 makefile <rickmasters>stikonas: i am not opposed to git submodules but it wasn't my immediate preference <stikonas[m]>No, it's up to you, I was just asking if there is some particular reason <rickmasters>stage0-posix can add stuff (like access recently) that i may not support yet, so i was trying to control what snapshot to use <rickmasters>i'm sure there is a way with git submodules but after an hour or two of research it wasn't crystal clear so i just did the copy pattern <stikonas[m]>git submodules point to specific commit, so that should be fine <rickmasters>i removed the make variables to its easy to cut and paste at the command line (as demonstrated above) <rickmasters>but i agree its kinda best practice for maintenance of the makefile <rickmasters>unmatched-paren: no doubt submodules would work, i don't have a strong feeling about it <rickmasters>i just read scary stories about merging and branches and forgetting to update and just said, ah screw it <unmatched-paren>i _think_ the branching/merging problems only happen if two people add submodules seperately and try to merge <unmatched-paren>forgetting to update sounds like more of a problem with just copying it in :P <rickmasters>then i read about git subtrees and experienced a little analysis paralysis, had to move on <rickmasters>unmatched-paren: i'll work on switching to submodules <unmatched-paren>i'm implementing some things in m2libc that seem to be defined using restrict in typical libcs, so i was wondering whether i should use it <Franciman>is there any document explaining the subset of C supported by mescc and m2-planet? <stikonas>Franciman: you can get some idea of what is supported by M2-Planet if you look at function names in cc_core.c <stikonas>I'm less familiar with mescc but mescc is far more capable <stikonas>but some stuff is missing, e.g. i++ wouldn't work or int i[2][3] <stikonas>also no support for structs on stack, structs have to be used via pointer <stikonas>M2-Planet itself is written in simpler dialect, so that cc_x86 and other cc_* compiler could build it <muurkha>oh, you just mean in the compiler, I thought you meant in the preprocessor <muurkha>I want to point out that #define SUM(A, B) A + B is bad style unless it's working around a preprocessor limitation <muurkha>because SUM(x ^ y, z) ends up as x ^ y + z which misparses as x ^ (y + z) <muurkha>#define SUM(A, B) (A) + (B) solves that problem <stikonas[m]>Well, that works too, I was just pointing out that function type macros work <muurkha>yeah, it's a tangent, but I thought it was worth mentioning because that's a "red alert" line of code <muurkha>sorry to distract from your intended point