IRC channel logs
2024-02-07.log
back to list of logs
<stikonas>Googulator: I'm looking at fiwix file list PR, looks good I guess but it's really builder-hex0 specific... <stikonas>we'll need something different for UEFI then <Googulator>which uses the same technique to locate the initrd <stikonas>I guess we'll have to clone/fork the whole file... <stikonas>well, kexec-fiwix will be completely different anyway <stikonas>as we need to shut down UEFI services, etc... <stikonas>but this initrd stuff kind of does 2 things: 1. reads files and 2. creates initrd <stikonas>but perhaps it's infeasible to split 1 and 2... <stikonas>hmm, "cp" command doesn't work in UEFI. Both posix-runner.efi cp and cp.efi hang... <oriansj>Googulator: well the good news is & 0xFF does not change the test result for GCC built unxz.c; bad news is it didn't result in a successful test after M2-Mesoplanet build. and you included a mistake fgetc returns an int not a char. <oriansj>oh and LzmaDec_InitStateReal where the global->reps[0] =global->reps[1] =global->reps[2] =global->reps[3] =1; is undefined behavior in M2-Planet; splitting it up into global->reps[0] = 1; global->reps[1] = 1; global->reps[2] =1; global->reps[3] = 1; should be the correct equal <Googulator>Seems like it still has some issues: small xz files extract fine, but linux-4.9.10.tar.xz is truncated <Googulator>this issue also happens with the gcc-compiled version <oriansj>well lets get small file unxz.c commited and then later we can work out the exact bugs <Googulator>linux-4.9.10 extracts successully after another small modification :) <Googulator>I corrected what I presumed to be a typo in the copyright header <Googulator>the "p" pointer was used as a workaround for that <Googulator>it's a uint8_t *, so it behaves the same in m2 and gcc <Googulator>also, "wrap" currently doesn't build with m2-planet <ekaitz>also stikonas some day you gotta send me an audio pronouncing your name <ekaitz>i was kind of afraid to butcher the surname <fossy>ekaitz: nice talk, good work!! <Guest25>it seems we succesfully built 32 bit musl rootfs with live-bootstrap <Guest25>but it only works with python script called "rootfs.py" <Guest25>it reaches until tcc-mes /usr/lib/mes/crt1.o lib/linux/x86_64-mes-gcc/crt1.c and does nothing? Will it continue? <Guest25>ok, is there any method to build with glibc or we have to build with musl? <Guest25>also is it possible to build without using python? <mid-kid>You can build glibc from the finished live-bootstrap system but it's not covered by the scripts <mid-kid>Similarly, you can bootstrap an amd64 system by building a cross-compiler in a finished live-bootstrap system and then building the compiler for amd64 <mid-kid>But none of this is directly supported by the project - linux from scratch's chapter 5,6 and 7 might help. <Guest25>ok, thank you. We have a hackaton on February 9 where we try to bootstrap a c compiler, how can we help to implement bootstrapping of 64 bit compiler? Is the problems known? <mid-kid>I don't remember exactly, it's been some 4ish years since I tried <mid-kid>and the live-bootstrap has changed a lot <Guest25>is there any other option than live-bootstrap, because it seems too messy? <mid-kid>what I do know is that I started with linux from scratch's instructions and that got me going <mid-kid>Guest25: live-bootstrap is currently the only project that achieves a full bootstrap from a single 512 byte binary. <mid-kid>Anything else relies on more bootstrap binaries. <mid-kid>It depends on what you're trying to do really. <mid-kid>If you just want to build a new linux system/toolchain from source, linux from scratch is that. <mid-kid>but you need a working, modern C compiler to follow its instructions <Guest25>i want to have really trusted environment where I can build a linux from scratch <Guest25>also can someone explain why 64 bit is not supported yet? <janneke>Guest25: 64bit is not a priority, in fact it's completely optional; like mid-kid says in the cross-compile bootstrap phase we compile from 32bit to 64bit gcc <Googulator>tested on bare metal with binutils-2.30 and linux-4.9.10 included as tar.xz <Googulator>binutils worked fine, but Linux went OOM when trying to extract in Fiwix <oriansj>Googulator: so it is using too much ram? <Googulator>and it seems to allocate more and more for larger files <Googulator>both use the same compression mode (dictionary size), so the allocation should be amortized constant, not growing linearly with size <Googulator>gcc-built version uses about half the memory, but still scaling linearly with file size <Googulator>oriansj: m2libc's memmove isn't supposed to allocate memory, right? <oriansj>Googulator: it doesn't allocate anything <oriansj>perhaps a defect in unxz.c doing calloc repeatedly somehow? <Googulator>is there a good tool for graphically viewing core dump files? <Googulator>GCC version now shows identical memory consumption between binutils and linux, M2 one shows _some_ growth in Linux, but well within what one could call "amortized constant" behavior <Googulator>oriansj: keeping ".lzma" support was the right call <Googulator>Locally updated all pre-network sources to xz / lzma wherever available (plus a few missed gz -> bz2 options), bare metal image dropped from 283MiB to 210MiB <Googulator>unfortunately I still got OOM when decompressing the Linux kernel sources - now trying an alternative "pipeless" way where unxz outputs to a file, then it quits, and finally tar reads that file <stikonas>well, Guest25 is already logged out but in case they read the logs, we are working on 64-bit bootstrap, at least I am trying to get it working <stikonas>and we aren't that far... tcc-mes already builds, but is a big buggy... Once that is sorted and tcc-mes runs, it should be not too bad to finish the bootstrap <stikonas>unlike riscv, x86_64 was fairly well supported by those versions of "old" software that we are building <Googulator>as in, reading 32 bits from address 0x1000 accesses a different physical memory cell than reading 8 bits from 0x1000 <stikonas>no idea... it does have instructions ot read 8 bits or 32-bits... <stikonas>but why would it be a different physical memory cell? <stikonas>according to wikipedia Almost all modern computer architectures use byte addressing, and word addressing is largely only of historical interest <Googulator>0x1000 is the 4096th byte of memory when used for 8-bit addresses, but the 4096th word when used for 32 bit <stikonas>i.e. on x86 constants are just little endian <Googulator>Itanium's instruction encoding was infamously brain-dead <stikonas>on riscv constants are using one of the 4 messy encodings with bits shuffled all around the plcae <stikonas>first you have bit 12 of the number , then bits 10 to 5 <Googulator>oh, so it's just intermediates that are all weird <stikonas>yeah, but it makes hard to write hex0 code <Googulator>at least instructions themselves are not weirdly intertwined with each other, like on Itanium <Googulator>AFAIK the goal there was to have the CPU execute an entire "block" of 3 intertwined-encoded instructions all at once <stikonas>wasn't it too hard for compilers to optimiza? <stikonas>which is why Itanium more or less died... <Googulator>your normal, "development" compiler would just encode each instruction into its own block with 2 NOPs, so each block would really be a single instruction <Googulator>then, when you were done & ready to build a fully optimized version, you would send it to a mainframe-sized Itanium that would spend a helluva lot of computation on generating optimized code <Googulator>in reality, the "fully optimizing" compilers never really got written <Googulator>& in retrospect, that compiler would basically have to have been an AI <oriansj>Googulator: I am assuming that you are using TCC to compile as M2-Mesoplanet isn't building unxz.c yet. <Googulator>No, I added unxz.c to the mescc-tools-extra build scripts <oriansj>yes, it builds but the resulting binary when built is not passing my test files which I created when preparing it. <fossy>would have liked to know what Guest25 considers messy about live-bootstrap. have been focusing on making it less "messy" in the past few months, and i thought that the process was fairly comprehensible by now... <oriansj>I made a couple files via tar cavf and unxz unpacks them perfectly when I build via gcc/clang/tcc but the builds have not been successful thus far <Googulator>oops, there's actually a regression in that last PR <oriansj>well it appears we are on the same commits <Googulator>oriansj: are you getting a sha256 of 933731db23ec9adebade815554252dcd68281f5de4f71c0617ccace1ec09a0c7 for unxz? <Googulator>that's the version I'm testing in live-bootstrap rn <oriansj>when I do a x86 build I get 29c3eface498ee9a5078dc17101dbfd7ab3f5a96d5c938c76187507fc72e68e5 which works and ecbf9115cac3451afb42756f89b57253a11887819ff5ce8d5c84e0facd8716c0 for my AMD64 build which segfaults on the same file <Googulator>I didn't test on AMD64 so it could still be broken there <Googulator>in fact, I'm pretty sure I know what's breaking there <Googulator>> dicl[diclPos] = (0xFF & symbol) | (0xFFFFFF00 & dicl[diclPos]); <Googulator>on 64-bit archs, it needs to be dicl[diclPos] = (0xFF & symbol) | (0xFFFFFFFFFFFFFF00 & dicl[diclPos]); <oriansj>yeah, it loades the immediate 0xFF and then does NOT R0 R0; so yeah, it'll flip all bits to 1 execpt the bottom 8 which will be zero <oriansj>do (~0xFF) if you are concerned about ordering <Googulator>./M2libc/amd64/linux/unistd.c:186:ERROR in create_struct <oriansj>(unless you did (0xFFFFFFFFFFFFFF00 which super doesn't work)) <oriansj>are you seeing reading file: <sys/utsname.h> prior to unistd.c? <oriansj>as the stage0-posix-amd64 should be updated to use the new M2libc file <oriansj>yeah, any struct name not recognized is considered a struct definition in M2-Planet <oriansj>which is why struct foo {..} is the supported pattern not struct {...} foo; <oriansj>well the checksum is expected to change with code changes <oriansj>or do you mean unxz now is not producing correct output? <Googulator>in fact, it seems to be outputting an empty file <oriansj>and the assembly should be very close