<oriansj>I really need to find time to fix M2-Mesoplanet's nested macro support ***janneke_ is now known as janneke
***gio_ is now known as gio
<oriansj>stikonas: good news. I've fixed nest #if blocks in M2-Mesoplanet <oriansj>it now correctly compiles on all architectures <stikonas>oriansj: oh nice. Maybe worth backporting to M2-Planet? <oriansj>now just to start testing bigger programs to flush out additional bugs <oriansj>probably should add a little logic to keep the tempfile around if we need to dig in <stikonas>oriansj: also there is segfault if its build with M2-Planet <stikonas>might be something to do with tempfiles too... <stikonas>hmm, blood_elf.c fails with "non-line number: / provided to #FILENAME" <oriansj>./bin/M2-Mesoplanet -f ../mescc-tools/blood-elf.c -f ../mescc-tools/stringify.c -o foo <stikonas>oriansj: and you are using Mesoplanet built with M2-Planet? <stikonas>because I do get segfault with your command line <stikonas>but I can't see any backtrace with those binaries ***ChanServ sets mode: +o janneke
<alMalsamo>ALso why does it go MesCC --> TinyCC --> GCC 2.95.0 --> GCC 4.7.4 <alMalsamo>I understand TinyC to GCC but what is the purpose of compiling 2.95.0? Why not go straight from TinyCC to GCC 4.7.4? <alMalsamo>oops I meant to paste: stage0/stage3/M2-Planet_x86.c <alMalsamo>Does this mean M2-Planet is a part of stage0? <janneke>alMalsamo: because this was easier, we will want to get rid of gcc-2.95.3 some time soon <stikonas>alMalsamo: first of all you can't go to GCC 4.7.4 with stable TCC <stikonas>and that is what was done in live-bootstrap <stikonas>and to understand M2-Mesoplanet, I should first note that stage0 is for bootstrapping on baremetal <stikonas>but we have another similar project stage0-posix that assumes posix environent (i.e. some simple kernel) with basic syscalls <stikonas>in principle both stage0 and stage0-posix follow similar early steps, hex0->hex1 (simple linker)->hex2 (more advanced linker)->M0 (macro assembler) -> cc_* (C compiler written in assembly) -> M2-Planet <stikonas>and all those steps are designed to run on both POSIX and baremetal <stikonas>though obviously that would require much more manual work on baremetal unlike POSIX version which can be scripted <stikonas>because M2-Planet is designed to run on baremetal, there are some things it can't suppport, e.g. #include statements <stikonas>on baremetal, you would have to do #includes manually, i.e. combine sources <stikonas>so we are now working on M2-Mesoplanet which is specific to posix bootstrap <stikonas>and is basically a C preprocessor plus some wrapper around M2-Planet (it's similar to gcc vs cc1) <stikonas>(e.g. cc1 is a C compiler, then as is assembler, ld is linker) <stikonas>similarly, M2-Mesoplanet invokes M2-Planet, M1 and hex2 <stikonas>and to avoid confusion M1 is a cross-platform (written in C) equivalent of M0 (written in hex2) <stikonas>alMalsamo: hopefully that clarifies things a little bit <stikonas>these are fairly strict in not using any pre-generated files (not just pre-compiled binaries) <stikonas>can skip about half of them if you are not bothered by those <ekaitz>janneke: should I announce my future work now? <ekaitz>so the thing is that I'm going to work on backporting gcc for riscv <ekaitz>in order to have a bootstrappable compiler for riscv <ekaitz>I have a whole year for that since I got some funds <muurkha>I wonder if an emulator for an old processor that could run old versions of GCC would be less work <muurkha>we tend to default to i386, but MIPS might be easier to write an emulator for <stikonas>ekaitz: which versions are you going to target? <ekaitz>i talked with janneke and he suggests 4.6 <stikonas>well, if that works, we can always switch from 4.7.4 to 4.6 in bootstrap <ekaitz>but I was suggested to check 4.6 because of its code modularity if i'm not mistaken <ekaitz>i was going to ask janneke for more clarifications on that <ekaitz>i'm still preparing the project plan ***ChanServ sets mode: -o janneke
<janneke>ekaitz: the wip-full-source-bootstrap branch already uses gcc-4.6 but still has the gcc-2.95.3 intermediate step <ekaitz>janneke: but is there any issue with moving to 4.7? <janneke>for every iteration trying to build the first gcc-core, which can take many tries, you'll be unpacking a lot of unnecessary cruft <stikonas>unpacking 100MB isn't that long though... <stikonas>or maybe it's quicker because I have SSD... <stikonas>anyway, there is probably not significant difference in terms of bootstrap (4.6 vs 4.7.4) <alMalsamo>stikonas: Thanks for that link to the fosslinux github, this is a lot more complicated than I imagined! But to bootstrap following this process, won't I need to rely on something like the GNU Guix live image to have some sort of environment within which to run stage0-posix utilities and M2-Planet to finally get GNU Mes compiled? <stikonas>alMalsamo: no, it's completely self-contained <stikonas>you only need to start with hex0 and kaem-optional-seed (trivial shell) <stikonas>kaem-optional-seed is 757 byte long and can only read commands and their arguments from file and run it <stikonas>(well, and strip comments from that file) <stikonas>alMalsamo: but you need some kind of kernel anyway for GNU Mes <stikonas>GNU Mes does not run on baremetal systems <stikonas>and we don't have any simple kernel for bootstrapping right now <alMalsamo>stikonas: So what kernel should I be using if I want to try starting with hex0 and kaem-optional-seed? <alMalsamo>And is kaem in stage0-posix or where is the code for this, I haven't heard of this shell before... <stikonas>well, live-bootstrap needs 32-bit kernel (not 64) but early stages work fine with 64-bit kernels too <stikonas>alMalsamo: so you can do bootstrap in chroot, qemu or real system <stikonas>real system is the most involved though since you need to get some bootloader for linux kernel, etc... <stikonas>running it in qemu or chroot is of course much simpler <stikonas>and if you just run stage0-posix, you can run it without any isolation inside your distro <alMalsamo>Hmm well I want to end up with GNU Guix amd64 binaries, is this possible even if I start iwth an i686 kernel? <alMalsamo>I have two empty SSDs in my laptop without even a partition table on them, so I must install GNU Grub first somehow then boot an i686 Linux kernel? <stikonas>alMalsamo: kernel bits do not affect binaries <stikonas>but what you have to keep in mind that bootsrap process works ONLY on x86 <alMalsamo>Hmm okay that's a bummer I would like to do this on other microarchitectures eventually, but for now I only have x86_64 machines available so this doesn't bother me much FOR NOW <stikonas>stage0-posix supports x86 x86_64, aarch64, riscv32, riscv64 but further steps work only on x86 <stikonas>alMalsamo: well, contributions are welcome <alMalsamo>Oh cool even RISC-V support, I thought GNU Guix didn't even work on RISC-V yet <stikonas>and it builds M2-Planet and some utilities <alMalsamo>OKay I want some RISC-V hardware but i don't want SiFive chips because they are proprietary so I am looking for chips with libre HDL code <stikonas>so you are in C land for furthter bootstrap <stikonas>but yes, you don't need that if you have POSIX <stikonas>most people look at stage0-posix but there is some work on stage0 <muurkha>alMalsamo: there are a lot of libre RISC-V designs, like VexRiscV and PicoRV32. not sure if there's a fully libre toolchain to get them running on an FPGA but I think VexRiscV can <stikonas>e.g. bauen1 is trying to run bootstrap on baremetal ARM <alMalsamo>Yeah there is also Boomv2 from Berkely and Alibaba XuanTie E902, E906, C906 and C910 which are RISC-V 64-bit <alMalsamo>But I kind of want a SoC board with a GPU because I am a newb <muurkha>you can make your own copylefted derivative work if you want <muurkha>but the big problem for copylefted silicon is how do you tell if the silicon really implements the purported design and how do you run your changes if you make a changed versio <stikonas>well, toolchain to build it on FPGA will definitely be non-bootstrappable <stikonas>but CPU bootstrap vs bootstrap on FPGA is somewhat similar to stage0 vs stage0-posix <stikonas>except that it's probably easier to build simple kernel than your own hardware <muurkha>not forever. yosys/nextpnr is potentially bootstrappable