IRC channel logs

2023-04-20.log

back to list of logs

<roconnor> https://github.com/oriansj/stage0-posix/blob/master/makefile#L147 does test-all work? I thought each test requires it be run on a different architecture.
<muurkha>oh hi roconnor, glad to see you here! this is Kragen
<roconnor>Hey Kragen.
<muurkha>unfortunately I don't know the answer to your question
<roconnor>I've been playing with stage0-posix today. It's not nearly as intimidating as I thought it would be.
<muurkha>maybe if you have qemu-user installed you can get test-all to work?
<roconnor>I got all the right answers for https://github.com/oriansj/stage0-posix/blob/master/x86.answers so that is nice.
<fossy>Mikaku: i've just been playing a bit with the kexec stuff you impl'd in Fiwix, and I tried to see if it could load GRUB (from which we could load anything) - this is the image I used http://ttm.sh/WG7.img. grub-file believes it is multibootv1 compliant. however it just hangs on the actual kexec invocation after shutdown. any ideas?
<muurkha>awesome!
<Mikaku>fossy: well I've only tested it with the Fiwix kernel and this ELF has different addresses in PLOADS
<Mikaku>fossy: anyway, did you changed the hard core entry address?
<Mikaku> <https://github.com/mikaku/Fiwix/blob/a0d609968c671b3381772947bd5d97563bd73e50/kernel/kexec.c#L160>
<Mikaku>unfortunately this is hard coded meanwhile I find a way to pass two values to 'ljmp' in inline assembly code
<Mikaku>(I'll be away for a couple of hours, sorry)
<fossy>Mikaku: no, i didn't missed that reading over the code! (no worries abt being away, TZ make this kind of thing very asynchronous anyways)
<Mikaku>fossy: I'll use the file WG7.img to fix the kexec code and make a little bit more generic
<fossy>thank you for your work!
<fossy>fwiw, if i change that hardcoded address to grub's entrypoint 0x00009000 it does boot grub - however grub fails due to some kind of memory corruption - not sure why yet
<Mikaku>fossy: I'm seeing that 'objdump -S' is unable to disassemble WG7.img, but I don't know why
<Mikaku>the command 'file' says the same for WG7.img and for Fiwix, the only difference is that symbols in WG7.img are stripped
<Mikaku>but that shouldn't suppose a problem
<Mikaku>fossy: is this WG7.img a kind of a kernel? I mean, what should I expect to see if it runs correctly?
<fossy>Mikaku: this is a multiboot GRUB image
<fossy>as in, GRUB compiled into multibootv1 compatible elf
<Mikaku>I see, and it loads and runs correctly when calling (like a kernel) from another GRUB?
<fossy>yep!
<fossy>hmmm, or maybe it doesn't, and grub is actually just resetting lol
<fossy>it's a bit difficult to tell the difference...
<Mikaku>ah! :-)
<Mikaku>well, I think GRUB expects to be executed in real-mode, which is not the case when using kexec
<fossy>really? when I kexec'd it, it produced "Welcome to GRUB" at least, and got stuck on a sanity check
<fossy>i thought that since the image (WG7.img) is multibootv1 compatible, it would work..
<Mikaku>I'm not sure, of course
<Mikaku>in any case, is strange that objdump is unable to disassemble it
<fossy>yes, i do find that rather strange
<stikonas[m]>roconnor: yes, you need qemu for non native arches
<stikonas[m]>fossy: but can you build grub with tcc?
<river>has anybody got a completely linear shell build script to build gcc? [please do not go to any trouble to answer this, this is not for anything useful. i am just wondering]
<fossy>stikonas[m]: do you need to? this is to kexec fiwix->linux - we can build it with gcc
<stikonas[m]>fossy: oh true, I forgot that this is for booting Linux
<stikonas[m]>And no, we don't have linear shell script for gcc
<oriansj>river: but it is possible to generate one from the output of running of the makefile
<stikonas[m]>But it will be machine or libc specific
<oriansj>indeed
<stikonas[m]>And will need to create some extra files that autotools does for us
<stikonas[m]>Such as config.h or something similar
<river>alright! sounds like no one has bothered to do this
<river>so its not really a useful thing to have lying around
<oriansj>well, makefiles really are much easier to maintain than the corresponding list of shell commands
<stikonas[m]>No, in live-bootstrap we stop writing completely linear scripts after tcc
<stikonas[m]>Then we build make and switch to makefiles
<stikonas[m]>Which are still a bit annoying to write without configure but a bit easier
<stikonas[m]>Then after perl we switch to autotools
<river>alright!
<stikonas[m]>Perl itself is already bad enough.to configure...
<stikonas[m]>See https://github.com/fosslinux/live-bootstrap/blob/master/sysa/perl-5.6.2/files/config.h
<oriansj>river: bootstrapping doesn't have to be useful; it just has to help you get to the place where you want to be. Useful to others is just a nice extra.
<stikonas[m]>And https://github.com/fosslinux/live-bootstrap/blob/master/sysa/perl-5.6.2/mk/main.mk
<Mikaku>fossy: I think finally managed to make WG7.img work, I see this <https://i.imgur.com/JFYPyGX.png>
<Mikaku>but the keyboard doesn't works, I'll try enabling interrupts ..
<Mikaku>fossy: do you know if GRUB configures the Interrupt Descriptor Table? that would be the cause that keyboard is not working
<Mikaku>anyway, the original problem was that the Fiwix kexec implementation didn't clear the "low" memory (from 0x0 to 0xA0000) before copying the new kernel
<Mikaku>so I guess that GRUB has uninitialized variables that it counts they will have a zero value
<Christoph[m]>I'd consider that an error of GRUB!
<Mikaku>Christoph[m]: yes, seems so
<Mikaku>but well, I guess GRUB assumes that it will be always executed right after a reboot
<stikonas>though in some modes it's definitely not true, e.g. UEFI gives no guarantees about state of memory
<stikonas>though maybe in that case grub does initialization but not in bios/multiboot mode
<stikonas>I remember when I was working on stage0-uefi, there were initially some bugs due to me not zero-initializing the memory (which we don't always do in stage0-posix)
<roconnor>building tcc from mes has scary warning. :)
<stikonas[m]>There are 3 warnings I think
<stikonas[m]>Though not very user frienfly
<stikonas[m]>Hard to tell what's wrong with tcc code
<stikonas[m]>Anyway, it's justba compile warning