IRC channel logs
2024-03-20.log
back to list of logs
<gnu_srs2>Hi, which program/script detects if filesystem partitions are corrupt? <ahenv>gnu_srs2: may be, "compgen -c" in bash can list all available commands <gnu_srs2>with a working bootlogd i would have known. Unfortunately it does not work on Hurd :( <biblio>solid_black: signal handling for aarch64-gnu ? <solid_black>azert: next up: posting the glibc and Hurd patchsets <azert>Im sure you also fixed some bugs <solid_black>the main still-missing thing is being more serious about hardware in gnumach <solid_black>we should at least get device_read() / device_write() hooked up to UART <solid_black>and add support for more models of interrupt controllers and UARTs <azert>That would be great. I don’t think you can support the whole ecosystem by yourself. If you have something minimal but working it will be very useful. <azert>The way I could see myself working on this is to install it on a dev board and filling in the missing bits to make its uart working <solid_black>for now I'm running this in qemu-system-aarch64 on a x86_64 host <solid_black>which, AIUI, means that I don't get any of the weak memory ordering effects <solid_black>Mach is going to need some upgrades to start using atomics properly <azert>We will never know until we try! <solid_black>I could try to guide you through setting it up, if you want to <solid_black>ok, so you need to start by building a cross-toolchain <solid_black>pick a prefix dir (in my case, PREFIX=~/dev/crosshurd-aarch64), mkdir $PREFIX/{src,include,aarch64-gnu}, ln -s ../include $PREFIX/aarch64-gnu/sys-include, ln -s ../lib $PREFIX/aarch64-gnu/lib <solid_black>then unpack (git clone) fresh binutils into $PREFIX/src/binutils, and do mkdir build && cd build && ../configure --target=aarch64-gnu --prefix=$PREFIX --with-lib-path=$PREFIX/lib && make && make install <solid_black>so, uh, tell me when you're done with that, and I'll tell you for to do next <gnu_srs2>(09:50:22) gnu_srs2: Hi, which program/script detects if filesystem partitions are corrupt? <gnu_srs2>(11:36:49) gnu_srs2: with a working bootlogd i would have known. Unfortunately it does not work on Hurd :( <gnu_srs2>boot sequence: gnumach->grub->/etc/hurd/runsystem.sysv:fsysopts / --update --readonly;exec ${init} ${single} -a; then what?? <solid_black>gnu_srs2: then it's just whatever ${init} is; sysv init on Debian GNU/Hurd <gnu_srs2>Where does the partition checks come into play? <azert>solid_black: done that, it worked <solid_black>add $PREFIX/bin to path, and check that e.g. aarch64-gnu-nm --version works <azert>Yes, it says 2.24.50.20240320 <azert>GNU spartan assembler is installef <solid_black>then configure/make incantation is: ../configure --prefix=$PREFIX --target=aarch64-gnu --with-lib-path=$PREFIX/lib --disable-multilib --enable-languages=c && make all-gcc && make install-gcc <azert>The patches don’t apply, can you send them using a paste site? <azert>Im afraid copying the web page corrupt them <solid_black>you should be able to fetch them using the "raw" links without copyin text from the browser <azert>The third patch doesn’t apply on gut anymore but I fixed it <azert>On git, they changed the Linux trampoline <solid_black>ok, thanks, I'll rebase it on my end too then, and re-send instead of just pinging them <solid_black>autoreconf -i && mkdir build && cd build && CC=gcc ../configure --prefix=$PREFIX --host=aarch64-gnu && make install-data <solid_black>note the CC=gcc to tell it to not use aarch64-gnu-gcc ust yet <solid_black>yay, so you should have various headers now, in particular something about aarch64_thread_state in $PREFIX/include/mach/aarch64/thread_status.h, right? <ahenv>I don't get (understand) this: <azert> "You can perhaps start by generating an embedding" <solid_black>cd $PREFIX/src && git clone git://git.savannah.gnu.org/hurd/mig.git && cd mig && autoreconf -i && mkdir build && cd build && ../configure --target=aarch64-gnu --prefix=$PREFIX && make && make install <azert>Should I add $PREFIX/bin to my $PATH? <solid_black>well actually I guess this is somewhat wrong, because this puts libraries/binaries for the target system with the libraries/binaries of the cross toolchain <solid_black>but you could have separate bin/ and cross-bin/ and so on <solid_black>cool, so now you can go back to Mach and actually build it <solid_black>rm -r build && mkdir build && cd build && ../configure --prefix=$PREFIX --host=aarch64-gnu && make <solid_black>after that you should have build/gnumach and build/gnumach.elf <azert>struct per_cpu had no curr_ip’ <solid_black>there is some issue with the buildsystem, it doesn't see what that file depends on, and doesn't rebuild it when things change <solid_black>no, you don't have libgcc because we haven't built it <solid_black>uhh, but you're going to need my glibc patches, and I haven't pushed those <azert>solid_black: I’m tracking your branch <solid_black>you actually need to install hurd headers first, so I set up a repo for that too <solid_black>autoreconf -i && mkdir build && cd build && CC=gcc ../configure --host=aarch64-gnu --without-parted --without-libcrypt --without-libbz2 --without-libz --without-rump && make no_deps=t prefix=$PREFIX install-headers <solid_black>mkdir build && cd build && ../configure --host=aarch64-gnu --prefix= && make install-headers DESTDIR=$PREFIX <solid_black>that's not a typo, --prefix= (empty string) in configure line <solid_black>touch $PREFIX/include/gnu/stubs.h $PREFIX/lib/libc.so && make csu/subdir_lib && install csu/crt1.o csu/crti.o csu/crtn.o $PREFIX/lib <solid_black>I don't know what that does or why that is required, don't ask <solid_black>after that, go back to gcc/build and make configure-target-libgcc && make all-target-libgcc && make install-target-libgcc <solid_black>after that, go back to gnumach, and hopefully it should link <azert>file gnumach: Linux kernel arm64 <solid_black>you might want to build mach's self-tests to get some simple userland executables <solid_black>there's probably some proper way to do it (Luca would know), but I've been just doing make tests/module-{hello,gsync,mach_host,machmsg,mach_port,syscalls,task,threads,vm,thread-state} <solid_black>you might need to run it twice if it doesn't succeed the first time <solid_black>after that, for test in gsync hello mach_host machmsg mach_port syscalls task threads vm; do qemu-system-aarch64 -m 1G -machine virt -cpu max -kernel build/gnumach -nographic -append "foo=bar" -device guest-loader,kernel=build/tests/module-$test,bootargs="module-$test "'${host-port} ${device-port} $(task-create) $(task-resume)',addr=0x4000; done is a command that runs all those test one by one <azert>How do I know if they are working? <azert>I run your command and it seems stuck in qemu <solid_black>if they print "gnumach-test-success-and-reboot: test module-something exit code 0", it worked <azert>Yes it doesn’t print anythibg <solid_black>test-threads sleeps for a few seconds, the others should be instant <solid_black>or, I wonder, could this be dependent on qemu version? I have 8.1.3 <solid_black>could it be that they've changed something about the "virt" machine that I've hardcoded <solid_black>do you know how to use qemu's gdbstub? i.e. -s and target remote <solid_black>run qemu-system-aarch64 -m 1G -machine virt -cpu max -kernel gnumach -nographic -append "foo=bar" -device guest-loader,kernel=tests/module-$test,bootargs="module-$test "'${host-port} ${device-port} $(task-create) $(task-resume)',addr=0x4000 -s -S, it should output nothing and hang <solid_black>in another terminal (tab), run gdb, enter "tar ext :1234", then "p $pc", what does that print? <solid_black>qemu-system-aarch64 -m 1G -machine virt -cpu max -kernel gnumach -nographic -append "foo=bar" -device guest-loader,kernel=tests/module-hello,bootargs="module-hello "'${host-port} ${device-port} $(task-create) $(task-resume)',addr=0x4000 <solid_black>now in gdb, enter "si" 6 times, $pc should jump to 0x0000000040200000 or so <solid_black>and you should discover that you're at the very first byte of gnumach <solid_black>cool, then you can try stepping, c_boot_entry() is the C-language main <solid_black>pmap_bootstrap() is what enables MMU and relocates to high memory, see if you make it to there <solid_black>ah, maybe you don't even need remove-symbol-file if you loaded it with symbol-file and not add-symbol-file <azert>It hangs randomly, give me some time to investigate <solid_black>if it hangs, Ctrl-C in GDB and bt to see the backtrace where <azert>I think it hangs during my setup <solid_black>in any case, it's a good idea to put breakpoints on Assert, Panic, trap_sync_exc_el1 <solid_black>put a breakpoint on line 405 or so and see if you ever get there <azert>I think I should compile gnumach with -O0? <azert>It seems to have reordered everything <solid_black>not necesserily, I'm building with the default of -O2 (I think) <azert>Maybe it’s jus a limit of mine <azert>When it memset phys_ttbr1_l0_base it segfaulys <azert>phys_ttbr1_l0_base is 0x48100000 <azert>I cannot disas for some reasons <azert>Cannot access memory at address 0x402244b0 <solid_black>phys_ttbr1_l0_base is 0x48100000 for me too, and that's a valid physical RAM address, there's no reason for it to segfault <azert>Why I cannot disas the function? <azert>I think I’ll figure out, got to leave! Thanks for the directions I hope others follow too <azert>That prints 0x2000001004008019 <solid_black>I've got to leave too, but that last bit being set means that MMU is already on <solid_black>0x200001004008019 is indeed what the code is setting SCTLR to <azert>Didn’t work, let’s continue the discussion another time ! <azert>After setting ttbr1_el1 it faults at 0x200 <azert>Actually the line after that <azert>solid_black: it crash just the instruction after enabling the mmu.. any ideas on how to fix it? <azert>Is there a way to print sctlr_el1 from gdb?