#
✕ nick:tpw_rules
#asahi-dev · 2021-12-21 19:52
tpw_rulesis this something you'd patch in your tree
#asahi-dev · 2021-12-21 19:39
tpw_ruleskettenis: i cannot find it
#asahi-dev · 2021-12-21 19:22
tpw_ruleskettenis: is there a link anywhere?
#asahi-dev · 2021-12-21 19:20
tpw_ruleskettenis: so it turns out u-boot's efi layer polls usb keyboards each time grub reads a sector to check if a new key is available. this leads to a 53 second delay when one is attached after selecting a boot option, unless you press a key
#asahi-dev · 2021-12-21 06:26
tpw_rulesanyway it's my bedtime
#asahi-dev · 2021-12-21 06:25
tpw_rulesat least that's my excuse
#asahi-dev · 2021-12-21 06:25
tpw_rulesi might have discounted it if it exists because i didn't want to try to type it
#asahi-dev · 2021-12-21 06:24
tpw_rulesbut i found out diskutil does not parse non-sorted gpt tables correctly: https://pastebin.com/LSv0zYAE
#asahi-dev · 2021-12-21 06:24
tpw_rulesor do you mean the macos stub partition
#asahi-dev · 2021-12-21 06:24
tpw_rulesi couldn't figure out how to make it set a partition to an efi system one
#asahi-dev · 2021-12-21 06:22
tpw_rulesare you going to have to ship your own partitioner? even `diskutil` seems hopelessly broken
#asahi-dev · 2021-12-21 06:21
tpw_rulesmarcan: did you have a chance to glance through the guide? i'm really hoping the asahi installer can handle all the partitioning in the future
#asahi-dev · 2021-12-21 06:20
tpw_rulesfor exactly 53.6 seconds (or 2**29 100ns units)
#asahi-dev · 2021-12-21 06:20
tpw_rulesdoes anybody know how to get symbols for grub's efi binary? i'm trying to figure out why it hangs when booting a kernel
#asahi-dev · 2021-12-21 04:40
tpw_rulesactually, this is probably u-boot's fault for claiming it can reset the board when it can't. setting CONFIG_EFI_HAVE_RUNTIME_RESET=n fixes the problem. presumably once the PSCI stuff y'all mention gets worked out it will work
#asahi-dev · 2021-12-21 04:12
tpw_rulesor rather, programmed with its default 30 second timeout at boot, then turned on during shutdown, possibly by systemd
#asahi-dev · 2021-12-21 04:11
tpw_rulesfortunately the system resets anyway because the watchdog gets initialized with its default 30 second timeout before the EFI function is called
#asahi-dev · 2021-12-21 04:10
tpw_rulesthe efi spec: https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf says on page 266 (physical 316) that "The ResetSystem() function does not return" so i'm not sure what the kernel is doing trying to call stuff after that
#asahi-dev · 2021-12-21 04:09
tpw_rulesnever gets called
#asahi-dev · 2021-12-21 04:09
tpw_rulesmeaning the watchdog restart function which was registered here: https://github.com/AsahiLinux/linux/blob/b63c1083b20eefa3b23180ae57e1919c723f7d86/drivers/watchdog/watchdog_core.c#L317
#asahi-dev · 2021-12-21 04:09
tpw_ruleswhich hangs in u-boot here: https://github.com/kettenis/u-boot/blob/fd6480ff7986e61848bc96dc43a279c80ba27cc9/drivers/firmware/psci.c#L131
#asahi-dev · 2021-12-21 04:09
tpw_ruleswhich calls into EFI services here: https://github.com/torvalds/linux/blob/6e0567b7305209c2d689ce57180a63d8dc657ad8/drivers/firmware/efi/reboot.c#L46
#asahi-dev · 2021-12-21 04:09
tpw_rulesthe kernel uses EFI to reboot here: https://github.com/AsahiLinux/linux/blob/b63c1083b20eefa3b23180ae57e1919c723f7d86/arch/arm64/kernel/process.c#L137
#asahi-dev · 2021-12-21 04:07
tpw_rulesso i figured out the reboot hang problem.
#asahi-dev · 2021-12-21 02:16
tpw_rulesmarcan: https://github.com/tpwrules/nixos-m1/blob/main/docs/uefi-standalone.md
#asahi-dev · 2021-12-20 20:31
tpw_ruleskettenis: is u-boot set up for persistent EFI vars yet? efibootmgr is giving me input/output error. i don't need them but it would be good to know
#asahi-dev · 2021-12-20 17:15
tpw_rulesrtkit prints something like "NVMe shutdown start" then "saveCtx took 80ms" before hanging
#asahi-dev · 2021-12-20 17:11
tpw_rulesyeah that's never happened to me
#asahi-dev · 2021-12-20 17:08
tpw_rulesso unless my previous hax actually stopped it from flushing, i think there might be something else
#asahi-dev · 2021-12-20 17:08
tpw_rulesit definitely takes way longer with UEFI
#asahi-dev · 2021-12-20 16:58
tpw_rulesit says it's using the watchdog
#asahi-dev · 2021-12-20 16:52
tpw_ruleskettenis: does the UEFI boot path do anything funky with the watchdog? it takes 30 seconds or so to reboot when booted via UEFI
#asahi-dev · 2021-12-20 16:40
tpw_ruleshttps://pastebin.com/LSv0zYAE
#asahi-dev · 2021-12-20 16:35
tpw_rulesso it looks like you can have partitions after 1TR, but it confuses diskutil if they are not sorted
#asahi-dev · 2021-12-20 14:24
tpw_rulesalso wow diskutil does not align anything to anything
#asahi-dev · 2021-12-20 14:10
tpw_rulesdo the iSC and 1TR partitions have to be the first and last numerically, or even on disk?
#asahi-dev · 2021-12-20 05:14
tpw_rulesmarcan: alright, i'll look at that tomorrow. should be straightforward. but it's my bedtime here
#asahi-dev · 2021-12-20 05:12
tpw_rulesuefi does work though
#asahi-dev · 2021-12-20 05:12
tpw_rulesno, currently it uses /boot/extlinux/extlinux.conf
#asahi-dev · 2021-12-20 05:10
tpw_rulesalright. i'd be delighted to bang on it and update stuff i've written as soon as it's ready
#asahi-dev · 2021-12-20 05:09
tpw_rulesmy imagination for the asahi installer is it would eventually just set up an EFI system partition, with an option to download Asahi's own rootfs and grub for convenience. then once the kernel stuff gets upstreamed people can just use the official UEFI installers of the distro of their choice
#asahi-dev · 2021-12-20 05:06
tpw_rulesah ok i see what you mean. yeah that would be good
#asahi-dev · 2021-12-20 05:05
tpw_rulesnixos (and I) agree with the vision of the bootloader providing the DT too. but i'm not sure how practical that is. but as long as m1n1 becomes UEFI compatible, or that's all u-boot does, i would be happy.
#asahi-dev · 2021-12-20 05:02
tpw_rulesand again, thank you and kettenis for actually making all the hard bits go. i couldn't have gotten this done in a week without it
#asahi-dev · 2021-12-20 05:02
tpw_rules new i2c or usb nodes added, or m1n1 starts disabling another type of device
#asahi-dev · 2021-12-20 05:02
tpw_rulesbuilding a new u-boot for each device tree wouldn't really work for nixos, but the nixos on arm vision is to have the platform (i.e. u-boot or m1n1) provide a complete device tree and just use uefi. lots of other distros are certainly device tree centric though. but it's fine if that ends up not being useful, i just want credit if it does :) and it does work well for now. it will only encounter problems if there are
#asahi-dev · 2021-12-20 04:47
tpw_rulesi'm going to sleep soon, but i would be grateful if you could help me get that second one upstreamed officially somehow instead of just taking the ideas
#asahi-dev · 2021-12-20 04:46
tpw_rulestheoretically this will not work if the distro device tree has more hardware than u-boot because m1n1 won't have massaged those parts. but it prints out a warning in that case and that shouldn't really happen in practice
#asahi-dev · 2021-12-20 04:46
tpw_rulesthe second is code which massages device trees u-boot loads to incorporate the tweaks m1n1 makes: https://github.com/tpwrules/nixos-m1/blob/main/nix/u-boot/0001-m1n1-fdt-compat.patch this way distros can specify arbitrary device trees and have them work properly. this also means users don't have to involve kmutil to update device trees.
#asahi-dev · 2021-12-20 04:44
tpw_rulesthe first is some minor tweaks to make sysboot boots work properly: https://github.com/tpwrules/nixos-m1/blob/main/nix/u-boot/0001-add-extlinux-vars.patch . i don't like having u-boot search all the partitions, but i think that's something we can remove once the asahi installer matures

plus ›