2024-02-13
00:20nicolas17okay so, what if I want to run *Linux* under the m1n1 hypervisor and trace its hardware access?
00:24wrender has quit [Ping timeout: 480 seconds]
00:44fossdd_ has joined #asahi-dev
00:45fossdd__ has joined #asahi-dev
00:46fossdd___ has joined #asahi-dev
00:47nicolas17I'm trying linux.py, with the kernel, dtb and initramfs copied from the Fedora installation
00:47nicolas17after "TTY> Preparing to boot kernel at" the serial connection dies and the machine reboots
00:48fossdd has quit [Ping timeout: 480 seconds]
00:52fossdd_ has quit [Ping timeout: 480 seconds]
00:53fossdd__ has quit [Ping timeout: 480 seconds]
00:54fossdd___ has quit [Ping timeout: 480 seconds]
00:58nicolas17(the reboot is so quick that the serial interface dies before it can send all that, I had to record a video of the screen)
01:11fossdd has joined #asahi-dev
01:23fossdd_ has joined #asahi-dev
01:25fossdd has quit [Ping timeout: 480 seconds]
01:36nicolas17mmmmaybe the problem is this kernel is an EFI binary and I need a "raw" kernel image? :<
01:57al3xtjames has quit [Quit: al3xtjames]
02:00KxCORP has quit [Quit: Bye!]
02:00KxCORP has joined #asahi-dev
02:05Bertrand___ has quit [Ping timeout: 480 seconds]
02:05Bertrand___ has joined #asahi-dev
02:07nicolas17oh well run guest wants a Linux build directory so I have to build a kernel from source *anyway*
02:09nicolas17"Use this utility script to properly boot a Linux kernel under the m1n1 hypervisor: tools/run_guest_kernel.sh"
02:09nicolas17"Note that the script expects the path to the Linux build tree (i.e. the directory where .config and Makefile are). It will pick out the kernel and corresponding device trees from within."
02:13nicolas17then I need to build my own because the stuff I found in fedora's /boot is an EFI image ^^'
02:14tpw_ruleskind of rude if so i would say, but maybe that makes sense for a *stares judgementally* binary distro
02:35john-cabaj has quit [Ping timeout: 480 seconds]
02:44nicolas17tpw_rules: while waiting for the build to finish I started it on the M2 too, it finished in 18 minutes and the x86 cross-build is still going; see, that's why it was a mistake :P
03:00nickchan has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
03:00nickchan has joined #asahi-dev
03:09nicolas17hm, in a normal boot, m1n1 starts u-boot which starts grub which starts linux... here m1n1 directly starts linux, how does that work? I thought uboot and grub did extra initialization that was necessary for linux?
03:11nicolas17it drops me into "press enter for maintenance shell" but the keyboard doesn't work either
03:14wrender has joined #asahi-dev
03:16nicolas17my cheap crappy USB keyboard has a damaged cable (I get "unable to enumerate USB device" on this x86 laptop and this time I couldn't get it to work by wiggling the cable)
03:17nicolas17maybe *fedora's kernel configuration* doesn't work in this scenario and I should use https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/config instead
03:22nicolas17my original kernel build on the i5 is still going btw, at this point I'm just curious how long it will take :D
03:23nicolas17I tried "rootwait root=UUID=15636f9a-6784-410d-8635-e6c9f9d7adf5 rootflags=subvol=root" (which is almost what the normal boot has) and it says it can't find /dev/disk/by-uuid/156...
03:23tpw_rulesi don't think u-boot has anything to do with that, but maybe it inits the nvme or something and there's a timeout?
03:24nicolas17wonder if this kernel has nvme as a module... but wouldn't it get the module from the initramfs then?
03:26nicolas17so I built my own kernel from the asahi-linux repo... and tried booting it with fedora's initramfs
03:29tpw_rulesbut copr i think is what builds the .rpms and the latest ver there matches the latest tag in that repo
03:31tpw_rulesso i'm 95% sure it's the source and what users are actually installing. would be nice to figure out how to query dnf and check
03:52jeisom has quit [Ping timeout: 480 seconds]
04:02Bertrand___ has quit [Read error: Connection reset by peer]
04:02Bertrand___ has joined #asahi-dev
04:54tristan2 has joined #asahi-dev
04:56tristan2_ has quit [Ping timeout: 480 seconds]
04:59wrender has quit [Ping timeout: 480 seconds]
05:00gladiac is now known as Guest2584
05:00gladiac has joined #asahi-dev
05:06Guest2584 has quit [Ping timeout: 480 seconds]
05:09nicolas17I think I got it, Fedora's EXTRAVERSION and my own didn't match so it couldn't load any modules from the initrd
05:58nicolas17okay this is too fragile... I need to figure out how to build my own initramfs from my own built modules
07:22Bertrand___ has quit [Ping timeout: 480 seconds]
08:08Bertrand___ has joined #asahi-dev
13:18mf54 has quit [Remote host closed the connection]
13:18mf54 has joined #asahi-dev
13:28jeisom has joined #asahi-dev
13:40WindowPain has joined #asahi-dev
13:40WindowPa| has quit [Read error: Connection reset by peer]
14:20jeisom has quit [Ping timeout: 480 seconds]
14:25john-cabaj has joined #asahi-dev
16:09zzywysmnicolas17: everyone looks at me weird when i try to slim down kernel configurations for Apple Silicon, but i suppose a 165 minute build must be thrilling for some
16:12zzywysmin the future, consider trying this instead: https://github.com/AsahiLinux/docs/wiki/Reference-Asahi-kernel-config
16:14j`eyzzywysm: no sorry just did it locally, I can maybe look at sending you some bits (I dont think it's worth actually doing, was just for fun)
16:15j`eyzzywysm: stuff like enabling the LSE instructions at compile time, removing a bunch of the perf tables that werent for M1
16:19mazI really don't want to have to ever split the two. specially when people use nVHE on 9.x HW.
16:19zzywysmi'm of the philosophy that every kernel configuration option you can turn off is a return-oriented-programming gadget that no longer exists
16:21zzywysmmaz: the maintenance cost is basically "every time a new kernel release gets cut, you do a make oldconfig and answer a couple questions"
16:21mazno: the maintenance cost is that an every *patch* you apply, you test *all* the possible combinations.
16:22kraem has quit [Remote host closed the connection]
16:22zzywysmmaz: but by drastically reducing the size of the kernel configuration, you also drastically reduce the size of the exponential tree of testing you need to be doing
16:23mazzzywysm: size doesn't matter in that case. I can compile a kernel in a couple of minutes. testing takes hours, multiplied by the number of architectural variants this needs to run on.
16:25j`eymaz: yes I was just trying to split it for fun, but it was a case of never-ending errors, so I gave up
16:27j`eyzzywysm: I agree if you have some fixed hw for whatever reason, but of course general purpose distros cant do that
16:27mazj`ey: a better option is to keep building it, but to reclaim the section at boot time. I had patches for that, but it was something like a couple of pages, which wasn't worth the complexity.
16:27kraem has joined #asahi-dev
16:29kraem has quit [Remote host closed the connection]
16:30zzywysmthe next step for my personal Apple Silicon machines is getting the Asahi firmware into CONFIG_EXTRA_FIRMWARE so i can go module-less
16:30chadmed has quit [Quit: Konversation terminated!]
16:31chadmed has joined #asahi-dev
16:31chadmed has quit []
16:31chadmed has joined #asahi-dev
16:32john-cabaj has quit [Remote host closed the connection]
16:32john-cabaj has joined #asahi-dev
16:33chadmed has quit []
16:33chadmed has joined #asahi-dev
16:33chadmed has quit []
16:34chadmed has joined #asahi-dev
16:34chadmed has quit []
16:34kraem has joined #asahi-dev
16:35chadmed has joined #asahi-dev
16:36chadmed has quit []
16:36chadmed has joined #asahi-dev
16:37zzywysmchadmed is likely asleep and doesn't realize a gremlin is repeatedly plugging and unplugging his Ethernet cable
16:37chadmed has quit []
16:38chadmed has joined #asahi-dev
16:39chadmed has quit []
16:40chadmed has joined #asahi-dev
16:54dylanchapell has quit [Read error: Connection reset by peer]
17:05buroaI want to compile it using musl, so I can build it into Talos Linux's toolchain, which uses alpine.
17:06dylanchapell has joined #asahi-dev
17:10buroaI don't have libc in my build as I use musl. By default that is using libc, so it's building.
17:20jannegburoa: m1n1 itself uses -ffreestanding see https://github.com/AsahiLinux/m1n1/blob/3b9a71422e45209ef57c563e418f877bf54358be/Makefile#L49C3-L49C16
17:21buroaSo building it with musl gets all kinds of errors... error: implicit declaration of function 'atol' [-Werror=implicit-function-declaration]
17:25buroaFWIW: I'm building it using https://github.com/siderolabs/tools / https://github.com/siderolabs/pkgs
17:25buroaOnce I get this all figured out, I'll be able to publish Talos Linux versions for the community.
17:26jannegcan you paste the full failing compile command? i.e. the last compile cmd line from `make V=1`
17:32jannegthat file shouldn't be in the compiler include path "/toolchain/lib/gcc/aarch64-linux-musl/13.2.0/include"
17:33buroaThis is what files are in that folder: https://privatebin.net/?a79775de1854c522#DLCLS4H8UCBhNqoGqy4cLA9X8MQ6uYcQZv3ojbHB5mYD
17:36jannegburoa: please paste build/display.S after running https://privatebin.net/?0d1d6390d12767fc=#6iGTh2LLnGYGDBkZ2yXtVvQ52RHeKPP11LnSE9PNmJJD
17:42zzywysmjanneg: he says "So building it with musl gets all kinds of errors..." not realizing that neither musl nor glibc are necessary to build m1n1
17:43zzywysmhe's building with -ffreestanding and -Werror=implicit-function-declaration simultaneously, are those mutually compatible?
17:48jannegwhy would -ffreestanding be incompatible with -Werror=implicit-function-declaration? the latter just errors out if an used function misses an declaration
17:57jeisom has joined #asahi-dev
18:00buroajanneg https://privatebin.net/?039097736f8c5022#GZyMbXFG8rbFWTRgLomYT5ej7d771CBFWTXULEh6evhC
18:01Bertrand___ has quit [Read error: Connection reset by peer]
18:02Bertrand___ has joined #asahi-dev
18:12jannegtry adding "-nostdinc++", that was added in gcc-13 but it would be strange if that borked gcc -nostdinc
18:13jannegplease add "-v" to the command to generate display.S and paste the output from the command line
18:14buroaCommand output (-v): https://privatebin.net/?2560c8efeb6d5034#BWRKSse6BGuTcYKtVMUF7AKZ4a2LkqdFDLRvgzYvkTbf
18:15buroadisplay.S: https://privatebin.net/?ed705414bffbb57f#8uVVfwpPRzr9JYF5VbZauBKy2pujEj18wtrnraQPM2Zb
18:17buroa$(shell $(CC) -print-file-name=include) I think: https://github.com/AsahiLinux/m1n1/blob/main/Makefile#L50C21-L50C60
18:19buroajanneg That was in this output: https://privatebin.net/?2560c8efeb6d5034#BWRKSse6BGuTcYKtVMUF7AKZ4a2LkqdFDLRvgzYvkTbf
18:25svenand if this toolchain was never used to build with -nostdinc no one would've noticed that bug
18:27svenactually, https://github.com/siderolabs/toolchain-musl/blob/8f1a7ebb886f3219b45f522051c588cd3e1f1c7e/toolchain/adjust.sh#L13
18:29j`eyhttps://github.com/siderolabs/toolchain-musl/blob/8f1a7ebb886f3219b45f522051c588cd3e1f1c7e/toolchain/adjust.sh#L29
18:32jannegwith that adjustment the "--with-native-system-header-dir=/toolchain/include" from the gcc configure line looks suspicious as well
18:43wrender has joined #asahi-dev
18:46svenat this point it's either something else inside that spec file or a gcc that was somehow patched i think
18:49janneghttps://github.com/siderolabs/toolchain/blob/591759848fbd0a6b82aa1dbc3bcc9b1aa1b9fdfb/gcc/pkg.yaml#L47 might inadvertently break -nostdinc
18:51wrender has quit [Ping timeout: 480 seconds]
18:54buroaI see that we have some Apple stuff inside u-boot upstream: https://docs.u-boot.org/en/latest/board/apple/m1.html#image-installation
18:55buroaYou can probably follow along here: https://github.com/siderolabs/pkgs/blob/main/u-boot/pkg.yaml
18:56buroaAnyways, I'm at the last step, and I have m1n1.bin from previously built stage... I want to include all of the .dtb's somehow (is that possible) for all the systems we support
18:56buroaSomething like this: cat /m1n1/m1n1.bin ${APPLE_M1_U_BOOT}/u-boot-nodtb.bin?? > /rootfs/apple_m1/u-boot.bin
18:57zzywysmNixOS does it like this: https://github.com/tpwrules/nixos-apple-silicon/blob/main/apple-silicon-support/modules/boot-m1n1/default.nix#L15
19:02jannegremember to compress u-boot with gzip. that is mandatory since m1n1 can't determine size of the u-boot binary
19:02anders_2 has joined #asahi-dev
19:04jeisom has quit [Ping timeout: 480 seconds]
19:07john-cabaj has quit [Quit: john-cabaj]
19:09anders__2 has quit [Ping timeout: 480 seconds]
19:10john-cabaj has joined #asahi-dev
19:19zzywysm has quit [Quit: Textual IRC Client: www.textualapp.com]
19:20zzywysm has joined #asahi-dev
20:04___nick___ has joined #asahi-dev
20:07___nick___ has quit []
20:09___nick___ has joined #asahi-dev
20:33jeisom has joined #asahi-dev
20:51__gilles has joined #asahi-dev
20:56WindowPa- has joined #asahi-dev
21:01WindowPain has quit [Ping timeout: 480 seconds]
21:05jeisom has quit [Quit: Leaving]
21:06jeisom has joined #asahi-dev
21:08___nick___ has quit [Ping timeout: 480 seconds]
21:10jeisom_ has joined #asahi-dev
21:10jeisom has quit [Read error: Connection reset by peer]
21:31wrender has joined #asahi-dev
21:50jeisom_ has quit [Ping timeout: 480 seconds]
22:03jeisom has joined #asahi-dev
22:39wrender has quit [Ping timeout: 480 seconds]
22:47wrender has joined #asahi-dev
22:55wrender has quit [Ping timeout: 480 seconds]
22:56wrender has joined #asahi-dev
23:06wrender has quit [Ping timeout: 480 seconds]
23:08commandoline has joined #asahi-dev
23:09commandoline_ has quit [Read error: Connection reset by peer]
23:14wrender has joined #asahi-dev
23:23wrender has quit [Ping timeout: 480 seconds]
23:30wrender has joined #asahi-dev
23:35nicolas17j`ey: I tried copying /boot/vmlinuz-6.6.3-413.asahi.fc39.aarch64+16k from Fedora Asahi to my other computer and booting that with run_guest_kernel.sh, it throws "ERROR: Devicetree found but no kernel."
23:38nicolas17I built my own kernel with this https://github.com/AsahiLinux/PKGBUILDs/blob/main/linux-asahi/config