bennofs__ has joined #nixos-aarch64
bennofs_ has quit [Ping timeout: 252 seconds]
dongcarl has quit [Quit: Ping timeout (120 seconds)]
SpindleyQ has quit [Quit: Ping timeout (120 seconds)]
SpindleyQ7 has joined #nixos-aarch64
dongcarl has joined #nixos-aarch64
rajivr has joined #nixos-aarch64
h0m1 has quit [Ping timeout: 250 seconds]
orivej has quit [Ping timeout: 252 seconds]
h0m1 has joined #nixos-aarch64
orivej has joined #nixos-aarch64
<clever> samueldr: do you happen to know why this image is missing from the latest master?
<samueldr> it was never meant to stay
<samueldr> (and anyway it hadn't been building for a few months)
<clever> i noticed the failures
<samueldr> the generic sd image is the only provided and supported image
<samueldr> and now works just fine on the raspberry pi 4B
<samueldr> oops, I see how it can be an issue for the 400
<clever> does the generic one already have firmware?
<samueldr> yes, same setup as usual
<samueldr> FAT32 FIRMWARE partition for raspberry pi because it's too inconvenient not to ship it with
<samueldr> because adding a partition after the fact is hella inconvenient
<clever> is the firmware already on the partition, or is it just a blank partition?
<samueldr> already configured to be bootable on the Pi 3 family (including +) and 4B
<clever> nice
<samueldr> 400 and CM4 might not work since U-Boot 2021.04 doesn't have support for the CM4 and 400 yet
<clever> the one i linked above, just boot-loops on a pi400, uboot cant find the sd card
<clever> but on a pi4, it just worked
<samueldr> given it was from january, it *may* have been 2021.01
<clever> given that its from 2021-01, that would make sense
<clever> yep
<samueldr> if you update U-Boot to master and rebuild the generic sd image, it might just work
<samueldr> and since there would only be u-boot to build, would be a quick native build on the rpi4
<samueldr> well, slow because of I/O
<clever> could i also just nix-build the new uboot, and copy it to the firmware partition?
<samueldr> but mainly assembling the image
<samueldr> oh
<samueldr> I guess that would work
<samueldr> *might* or may not need adding the dtb file to the root of the firmware partition
<clever> the rest is already good enough, and nixos can deal with any updates
<samueldr> for the 4B it was required at one point
<samueldr> well, NixOS doesn't manage the partition at all
<samueldr> the firmware partition
<clever> the rootfs though
<samueldr> (in the expected use case)
<samueldr> yes
<clever> yeah, firmware i update myself
<samueldr> use the new_kernel variant though
<samueldr> just in case there's a difference between 5.10 LTS and 5.11 (or 12)
<clever> i was thinking just let nixos upgrade the jan image
<samueldr> oh
<samueldr> sure
<clever> nixos-rebuild --upgrade for the rootfs, manual for uboot
<samueldr> yep, should work too, probably, hopefully
<clever> first thing, configuration.nix is missing
<clever> as usual
<samueldr> I guess I'll need to do a bit more testing, but I just tried using phosh on an x86_64 system and... I get a cursor in a black void!
<samueldr> not optimal
<clever> samueldr: nixos-generate-config, edit some, nixos-rebuild switch, and reboot, uboot failed to find most things, and booted the original generation!
<samueldr> success!?
<clever> not really
<clever> the new generation cant be found by uboot
<samueldr> I mean, it didn't brick!
<clever> so it undoes all changes on each reboot
<clever> its nearly as bad as the previous sd card :P
<clever> one gc cycle, and it will be a brick
<samueldr> there must be a configuration option missing or something
cptchaos83 has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<clever> all 4 entries in extlinux are refering to files in ../nixos/
<samueldr> which should be fine
<samueldr> just checking: the firmware partition should *not* be mounted
<clever> correct
<clever> i think i see the problem
<clever> FDTDIR ../nixos/vw8c6pmm21rqyi78zmrb9r00x493n6a2-linux-5.4.79-1.20201201-dtbs
<clever> [root@nixos:~]# ls -ltrh /boot/nixos/vw8c6pmm21rqyi78zmrb9r00x493n6a2-linux-5.4.79-1.20201201-dtbs/broadcom/
<clever> -r--r--r-- 1 root root 47K Jan 1 1970 bcm2838-rpi-4-b.dtb
<clever> FDTDIR ../nixos/q95k3nasvk0j3891639da25378qj2zn0-linux-5.4.88-dtbs
<clever> [root@nixos:~]# ls -ltrh /boot/nixos/q95k3nasvk0j3891639da25378qj2zn0-linux-5.4.88-dtbs/broadcom/
<clever> and pi4, is missing!
<clever> so, each generation searches for dtb files in a unique dir, but the new generations lack a pi4 dtb file
cptchaos83 has joined #nixos-aarch64
<clever> and uboot successfully does fallback, until a generation works
<clever> kernelPackages is on the default value
<samueldr> sounds about right
<clever> so nixos-generate-config generates a cfg that fails to boot
<samueldr> as it might if you had a too new laptop
<clever> testing out linuxPackages_rpi4
orivej has quit [Ping timeout: 265 seconds]
<clever> samueldr: heh, thats the exact storepath the original generation was on, guess thats the answer!
<clever> uboot seems rather slow, it sits at `scanning mmc 0:2` for a while
<clever> but it is booting the newest generation this time
<samueldr> alright, so at least the phosh issue is not that it outright doesn't work, same nixpkgs revision it works with Mobile NixOS, so I guess I have some dreaded state breaking things
<clever> i'm testing that linuxHeader thing i mentioned before
<clever> samueldr: https://termbin.com/ram4 i believe this omits the patch only on native arm32, but includes the patch on cross-arm32
<clever> the patch was originally meant to fix a cross-arm32 bug, and it also broke native arm32
<elvishjerricco> Alright. Back on the cm4.
<elvishjerricco> No idea what to look into next :P
<samueldr> hmmmmmmmmmmmm... the "lockscreen" for phosh is dismissed whatever input I give it
<clever> samueldr: found the cause of why dwc fails, the defconfig in tow-boot is only loading a dwc2 gadget mode driver
<clever> its not capable of driving it in host mode
<samueldr> I saw it was named gadget in the option, but I didn't check further, I assumed it was named that way because of legacy reasons
<samueldr> interesting though
<samueldr> since all CM4 boards are different, I assume CM4 users would want to customize the build for their CM4 use case
<samueldr> not sure how to make this happen really...
<samueldr> ... and in that case why not U-Boot specialized for their use case?
<clever> samueldr: the uboot has an xhci driver, which is the "better" interface
<clever> elvishjerricco: https://pastebin.com/rEJsSjeT
<clever> lines 1-39 are the bootcode.bin in the spi flash
<clever> lines 42 onward are tow-boot
<clever> samueldr: i'm noticing some desync between the framebuffer menu and the serial menu, and the serial menu is corrupted by something
<elvishjerricco> clever: Yea the pi400 also has a usb 3 controller on the pci connection right?
<clever> was a bit tricky to open the console
<clever> elvishjerricco: yeah, same as later pi4's, with the eeprom missing
<elvishjerricco> clever: Did you add `cp -v bcm2711-rpi-400.dtb "$target/"` to the `populateCommands`?
<clever> not yet
<elvishjerricco> clever: Any idea why it doesn't work?
<clever> not yet, but i can iterate on this
<elvishjerricco> Note that the data sheet (https://raspberrypi.dk/wp-content/uploads/2020/10/cm4-datasheet.pdf) specifically says to use the dwc2 thing
<clever> i think those docs where written before they figured out how to make xhci even work
<clever> aha
<clever> xhci-brcm wasnt build
<elvishjerricco> Oh. That sounds useful :P
<clever> config USB_XHCI_BRCM
<clever> bool "Broadcom USB3 Host XHCI controller"
<clever> that might not actually be what we want
<elvishjerricco> Worth a shot?
<clever> it also wont pass the linker
<clever> trying CONFIG_USB_DWC2=y instead
<clever> [nix-shell:~/apps/rpi/Tow-Boot/build/u-boot-2021.04]$ scp u-boot.bin root@system76:/mnt/tow-boot-rpi4.bin
<clever> samueldr: uart doesnt work anymore
<clever> ah wait
<clever> its this bloody usb converter
<clever> still fails
<elvishjerricco> That's surprising
<elvishjerricco> Did you ad the dtoverlay stuff?
<clever> yeah
<clever> ah, wait
<elvishjerricco> ?
<clever> [nix-shell:~/apps/rpi/Tow-Boot/build/u-boot-2021.04]$ scp ~/apps/rpi/firmware/boot/overlays/dwc2.dtbo root@system76:/mnt/overlays/
<clever> i forgot the overlay file itself
<elvishjerricco> Oh. Yea I just copy the whole overlays directory
dustinm has quit [Quit: Leaving]
<clever> U-Boot> usb start
<clever> Bus xhci_pci: probe failed, error -110
<clever> starting USB...
<clever> No working controllers found
<clever> and it hangs there
<elvishjerricco> I wonder if you just boot a linux kernel directly, does otg_mode=1 work...
<clever> it should, it did back when i was raspi-os
<clever> but that card is now toast
<elvishjerricco> Yea it does. Neat
<clever> dwc2_usb_probe is not being ran
<clever> elvishjerricco: if the firmware partition was on the usb-c port, the firmware will force otg_mode=1, and you have no way to turn it off
<clever> so supporting that is ideal
<clever> or whatever port those d+/d- pins are routed to
<clever> this gcc is STILL building!
dustinm has joined #nixos-aarch64
orivej has joined #nixos-aarch64
<clever> include/dm/device.h:#define U_BOOT_DRIVER(__name)
<clever> it just calls ll_entry_declare
<clever> ll_entry_declare(struct driver, __name, driver)
<clever> aha, and that then goes into the .u_boot_lists_2_driver_2_usb_dwc2 section
<clever> and llsym is used to read the list back out
<clever> or ll_entry_start
<clever> drivers/core/device.c: ll_entry_start(struct driver_info, driver_info);
<clever> drivers/core/lists.c: struct driver *driver = ll_entry_start(struct driver, driver);
<clever> drivers/core/dump.c: struct driver *d = ll_entry_start(struct driver, driver);
<clever> aha, driver_check_compatible will compare each of_match in a given struct driver
<clever> samueldr: do you know how you turn on a log category in uboot?
cole-h has quit [Ping timeout: 240 seconds]
<clever> samueldr: everything i'm seeing, says that uboot is ignoring the dtb it got from "somewhere", and not even checking the compatible or enable keys
<clever> ok, so its built with CONFIG_OF_BOARD, which means board_fdt_blob_setup will supply a dtb from the firmware, and thats what lands in ${fdtcontroladdr}
<clever> and that dtb should be activating hw
<clever> everything says it should be working
<clever> yet its not printing any logs
<clever> [root@nixos:~]# vcgencmd measure_temp
<clever> temp=81.3'C
<clever> [root@nixos:~]# vcgencmd get_throttled
<clever> throttled=0x60000
<clever> oh, thats why gcc took so long!
ajs124 has quit [Quit: Bridge terminating on SIGTERM]
ajs124 has joined #nixos-aarch64
zupo has joined #nixos-aarch64
zupo_ has joined #nixos-aarch64
zupo has quit [Ping timeout: 265 seconds]
HenrikK has joined #nixos-aarch64
HenrikK has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jdnixx-M1 has quit [Quit: Bridge terminating on SIGTERM]
ky0ko has quit [Quit: Bridge terminating on SIGTERM]
ky0ko has joined #nixos-aarch64
jdnixx-M has joined #nixos-aarch64
HenrikK has joined #nixos-aarch64
dev_mohe has joined #nixos-aarch64
dev_mohe has quit [Client Quit]
HenrikK has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewcroughan> clever: do you think not-os would work with Docker?
zupo_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewcroughan> To clarify. I mean, do you think it could run Docker containers?
<matthewcroughan> Maybe will have more luck with Podman. I'm anticipating issues with Dockerd not working.
monk has left #nixos-aarch64 ["Error from remote client"]
monk has joined #nixos-aarch64
orivej has quit [Ping timeout: 240 seconds]
ryantrinkle has joined #nixos-aarch64
monk has left #nixos-aarch64 ["Error from remote client"]
monk has joined #nixos-aarch64
cole-h has joined #nixos-aarch64
<clever> -r-xr-xr-x 1 root root 127K Dec 31 1969 /nix/store/69yk3j89af7fqf5lkn9njlay7nqrj5mr-python3-3.8.9/lib/python3.8/lib-dynload/_ctypes.cpython-38-arm-linux-gnueabihf_failed.so
<clever> what does the "failed" in here refer to?
<clever> *** WARNING: renaming "_ctypes" since importing it failed: /nix/store/gydwsw4ffkfln89isj8zb6w319b4sa3a-libffi-3.3/lib/libffi.so.7: undefined symbol: ffi_prep_closure_loc
<clever> aha
monk has left #nixos-aarch64 ["Error from remote client"]
<clever> Following modules built successfully but were removed because they could not be imported:
<clever> _ctypes
zupo has joined #nixos-aarch64
zupo_ has joined #nixos-aarch64
zupo has quit [Ping timeout: 260 seconds]
monk has joined #nixos-aarch64
<samueldr> clever: so you're saying it does use the firmware provided DT, but for some reason the logs you activated (?) are not shown
<samueldr> I assume logs you activated are in the non-OTG variant of the driver?
monk has left #nixos-aarch64 ["Error from remote client"]
monk has joined #nixos-aarch64
<clever> samueldr: i added my own print statements to the probe code for dwc, and it doesnt run
<clever> which implies that either its not loading the driver, or the uart isnt online yet
<clever> i found mode pre-existing debug in the DT parser, where it finds drivers and activates them
<clever> but i have no idea how to see that log
<clever> samueldr: lists_bind_fdt() will iterate over every node in DT, report the name/compatible, if its disabled, and then try to load a matching driver
<clever> but i'm not able to see those logs
<clever> according to the source and readme, it should take the firmware provided DT (which i can read with the cmds you gave lastnight), and enable its own internal drivers
<samueldr> yep, fdt addr ${fdtcontroladdr} is the right way to check the built-in/previous-stage firmware
<samueldr> to me it really sounds more like the probe isn't being run than otherwise
ryantrinkle has quit [Ping timeout: 240 seconds]
<samueldr> the driver is being built, right?
<clever> yeah, i do see the driver being rebuilt, if i run buildPhase after editing it
<clever> i need to switch over to netboot, so i dont have to swap cards constantly
dev_mohe has joined #nixos-aarch64
monk has left #nixos-aarch64 ["Error from remote client"]
<matthewcroughan> clever: are there any examples of not-os being built for a raspberry pi?
bennofs__ has quit [Read error: Connection reset by peer]
<matthewcroughan> sorry, I just saw this :)
bennofs_ has joined #nixos-aarch64
<clever> nix-env -p /nix/var/nix/profiles/per-user/root/rpi3-netboot -f not-os/release.nix -A rpi_image -I nixpkgs=./nixpkgs/ --set
<clever> matthewcroughan: i found this in my notes on the router
<matthewcroughan> I wanna boot not-os on my orange pi zero.
<clever> [root@router:/tftproot/try2/nixpkgs]# git rev-parse HEAD
<clever> d2fc461f6badbfd6cc2b32c42b8e6661c9675afc
<clever> most of the complications are round the rpi firmware, so the orange pi will have different solutions
<matthewcroughan> well, they're all in the kernel afaik
<matthewcroughan> I'm going to make a minimal repo that shows how I've done it, one sec.
<matthewcroughan> The image size is massive though, so I've done something wrong, I bet.
<clever> [root@router:/tftproot/try2]# ls -lh /nix/var/nix/profiles/per-user/root/rpi3-netboot/initrd -L
<clever> -r--r--r-- 4 root root 2.1M Dec 31 1969 /nix/var/nix/profiles/per-user/root/rpi3-netboot/initrd
<clever> -r--r--r-- 4 root root 41M Dec 31 1969 /nix/var/nix/profiles/per-user/root/rpi3-netboot/root.squashfs
<matthewcroughan> What is the difference between nixos-small and nixos-unstable-small?
<clever> i dont think ive seen nixos-small before
<matthewcroughan> how would it reduce my image size?
<matthewcroughan> I meant nixos-unstable-small
<matthewcroughan> er, nixos-unstable*
<clever> -small just has fewer things tested on hydra
<matthewcroughan> oh, so it's not in reference to the packages
<matthewcroughan> Have you seen this?
<matthewcroughan> There are image templates which turns off stuff to make the image size less.
<clever> hadnt seen it before
monk has joined #nixos-aarch64
<clever> i have similar in rpi-tools
<clever> but the cross-compile stuff has been giving trouble, so i'm trying native
<samueldr> I'm not sure it's being maintained anymore, given the age of last commit and last release
<matthewcroughan> Yeah it's not. But it's unbelieveably impressive and documented enough to learn from.
<matthewcroughan> Like look at the odroid c2, it shows buidling u-boot, signing it, etc.
<matthewcroughan> I'm convinced I have to learn Bitbake/OE a lot more in order to destroy it.
<matthewcroughan> The problem is that as an individual it's hard to care about signing bootloaders hah.
heywoodlh_ has joined #nixos-aarch64
<clever> matthewcroughan: the pi4 has partially signed boot code, and they have mentioned plans to get a fully signed boot chain on the CM4
<matthewcroughan> Pretty cool. But I want RiscV.
<elvishjerricco> clever: how hard is it to set up netbooting the rpi? That does sound like a quicker way to mess with this stuff.
<clever> elvishjerricco: for the pi4, trivial
<clever> [root@nixos:~]# vcgencmd bootloader_config
<clever> TFTP_IP=192.168.2.15
<clever> BOOT_ORDER=0x5241
<clever> non-important lines hidden
<clever> elvishjerricco: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md explains the whole config file, and ...
<elvishjerricco> Then how do you configure the server?
<clever> elvishjerricco: https://gist.github.com/cleverca22/cf965f58caa80fdd65a5119d96cbdec3 this will embed a copy of bootconf.txt into a pieeprom.bin
<clever> [clever@amd-nixos:~]$ ls -ltrh tftp/d328cdce/
<clever> total 327K
<clever> lrwxrwxrwx 1 clever users 49 Jun 23 2020 start4.elf -> /home/clever/apps/rpi/lk/build-rpi4-start4/lk.elf
heywoodlh has quit [Remote host closed the connection]
<clever> networking.firewall.allowedUDPPorts = [ 69 ]; services.tftpd = { enable = true; path = "/home/clever/tftp"; };
<clever> elvishjerricco: then just have a directory named after the serial# that has the full /boot contents
<clever> if you are using the rpi firmware as a bootloader, your kernel/initrd will be in that dir
<clever> if you are using uboot, then uboot itself is in that dir, and everything else follows uboot rules
rajivr has quit [Quit: Connection closed for inactivity]
<elvishjerricco> ,locate bin vcgencmd
<clever> elvishjerricco: nix-env -iA nixos.libraspberrypi
<{^_^}> Couldn't find in any packages
dev_mohe has quit [Quit: dev_mohe]
<elvishjerricco> BOOT_UART=0
<elvishjerricco> [all]
<elvishjerricco> WAKE_ON_GPIO=0
<elvishjerricco> POWER_OFF_ON_HALT=1
<elvishjerricco> DISABLE_HDMI=0
<elvishjerricco> BOOT_ORDER=0xf41
<elvishjerricco> clever: So you're saying I need to change this to have `TFTP_IP=192.168.2.15` `BOOT_ORDER=0x5241`?
<samueldr> hey, just saying, I probably won't spend much time on Tow-Boot, U-Boot and NixOS on ARM things for the last half of this month since... well... Mobile NixOS needs to be worked on :)
<elvishjerricco> and then flash the eeprom?
<clever> your BOOT_ORDER must include a 2 somewhere
<clever> where, depends on the priority you want
<clever> your 0xf41 says to try sd, usb, then loop, until something works
<clever> my 0x5241 says to try sd, usb, network, the 2nd usb, and then give up
<clever> elvishjerricco: having TFTP_IP makes it simpler, you dont have to mess with the dhcp server then
<elvishjerricco> Hm well I don't have the ability to connect this pi to my home network with ethernet, so I'd have to wire it straight to my desktop
<clever> then you also need something else
<clever> TFTP_IP and CLIENT_IP
<clever> that lets you configure a static ip on the pi
<clever> then throw a static on the nixos machine too
<clever> or run a dhcp server on the desktop
<elvishjerricco> and exclude the interface from networkmanager I'm sure
<clever> another handy thing, if you put pieeprom.{udp,sig} on that tftp directory, the pi will reflash itself over the network
<elvishjerricco> Oh, that is handy
<clever> obviously, interrupting it will result in a soft-brick
<clever> and you need recovery.bin on a uSD to unbrick it
* colemickens might find a new home for his pbp now that he has a real laptop again
<elvishjerricco> I'll take it :P
monk has left #nixos-aarch64 ["Error from remote client"]
monk has joined #nixos-aarch64
monk has left #nixos-aarch64 ["Error from remote client"]
monk has joined #nixos-aarch64
HenrikK has joined #nixos-aarch64
<elvishjerricco> clever: What kind of permissions are needed on the services.tftpd.path directory?
<elvishjerricco> I'm getting "File Not Found" from `curl tftp://127.0.0.1/config.txt`
zupo has joined #nixos-aarch64
<clever> elvishjerricco: the tftp daemon needs to be able to read the files, and have +x on the parent dirs
<clever> and it runs as nobody
<clever> so o+x on dirs, and o+r on the files
monk has left #nixos-aarch64 ["Error from remote client"]
zupo_ has quit [Ping timeout: 265 seconds]
<samueldr> use namei to list information about a tree
<elvishjerricco> Ok, got it. `curl tftp://192.168.3.1/config.txt` now shows config.txt
<elvishjerricco> But the cm4 does not appear to be netbooting from it...
<samueldr> note that `. ` won't work, it will list only the information of the components found in the path given
<clever> samueldr: oh, nice
<samueldr> elvishjerricco: updated the eeprom as clever supposed might be needed?
<clever> my typical solution is to just `sudo -u nobody ls -l /full/path`
<samueldr> clever: what's annoying is that most of the time I don't remember the tool's name when *I* need it!
<clever> and then delete bits off the tail end, until it works
<clever> then look at why that bit failed
<clever> e2fsprogs> 364 tests succeeded 1 tests failed
<clever> e2fsprogs> Tests failed: j_recover_fast_commit
<clever> e2fsprogs> make[1]: *** [Makefile:399: test_post] Error 1
<clever> failing to build on armv6l
pbb has quit [Read error: Connection reset by peer]
<elvishjerricco> wtf
<elvishjerricco> `vcgencmd bootloader_config` should show me the current status of the boot config right?
pbb has joined #nixos-aarch64
<clever> elvishjerricco: yeah, that dumps the config it had when it booted
<elvishjerricco> Well I thought I flashed the eeprom on this thing, but my changes did not take effect
<clever> how did you flash it?
<elvishjerricco> In fact, I saw on the serial output `BOOT-EEPROM: UPDATED`
<elvishjerricco> I disabled emmc/sd boot with the J2 jumper, plugged in the micro usb cable, and ran `rpiboot -d recovery`
<elvishjerricco> from the usbboot repo
<clever> ah, that should do it
<clever> did you update the pieeprom.bin file to have the new config?
<elvishjerricco> I *thought* I did :P
<clever> the gist i linked earlier can do that step
<clever> you can run strings on the .bin to extract the cfg
quinn has quit [Quit: ZNC 1.8.1 - https://znc.in]
<elvishjerricco> Huh. I didn't manage to update it apparently...
<elvishjerricco> d'oh
<elvishjerricco> I used nix-build instead of nix build for the first time in forever and forgot that I have alias nix-build="nix-build --no-out-link"
<clever> *doh*
<elvishjerricco> There we go
monk has joined #nixos-aarch64
<samueldr> now that's working against yourself efficiently
<elvishjerricco> Ok, I can see that it's *trying* somewhat to netboot. I decided to try using a dhcp server instead of a static ip, but it's not working. The server keeps giving DHCPOFFER, but doesn't get anything back.
quinn has joined #nixos-aarch64
<clever> elvishjerricco: does the dhcp server have a range and a static ip?
<clever> elvishjerricco: line 77 says what interface to listen on, line 113 gives it an ip, dhcpd will lookup what ip is on that interface, to decide what config block (line 81) to follow
<clever> line 87 then gives out ip's to clients
<elvishjerricco> clever: Yea my config is actually just a stripped down version of that. And I've verified it works by booting the pi off a working sd card
<clever> anything in the dhcp server logs? what is the full exchange in wireshark?
<elvishjerricco> May 17 15:45:23 pyromancer dhcpd4[20093]: DHCPDISCOVER from dc:a6:32:fe:7a:33 via enp4s0
<elvishjerricco> May 17 15:45:24 pyromancer dhcpd4[20093]: DHCPOFFER on 192.168.3.120 to dc:a6:32:fe:7a:33 via enp4s0
<elvishjerricco> I just see this in the dhcp log
<elvishjerricco> repeating, with the ip increasing by one each time
<elvishjerricco> no idea how to wireshark :P
<clever> double-check that the ethernet cable has all 8 wires, and no pins are damaged on any connectors
<elvishjerricco> clever: I mean I was able to ssh over this connection when I was testing the dhcp with the working sd card
<elvishjerricco> Do I just `wireshark -i enp4s0` or something?
<clever> wireshark has a gui to select an interface
<elvishjerricco> Guessing I need to run it as root?
<clever> only the dumpcap binary needs to be root
<clever> either sudo the whole thing, or make dumpcap setuid root
<clever> looks normal on that end
<clever> add BOOT_UART=1 to the bootconf.txt, re-flash it, and the uart should say more
<elvishjerricco> Oh geez. TIL irccloud's automatic pastebin serves ads to you guys. Sorry about that, I'll look for an alternative soon
<elvishjerricco> well, an ad for their own service, anyway
<clever> i never noticed
* clever points at u-block
zupo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<elvishjerricco> Ok it's working now...
<elvishjerricco> But the way I generated the /boot dir was wrong so I need to fix that
monk has left #nixos-aarch64 ["Error from remote client"]
<elvishjerricco> Oh wait not it wasn't
<elvishjerricco> They're identical
monk has joined #nixos-aarch64
<elvishjerricco> It tried to get a bunch of different files and then just stopped
<clever> which files did it fetch last?
<elvishjerricco> a bunch of recover*.img and kernel*.img files, followed by armstub8-32-gic.bin
<clever> that sounds like its booting normally, it should now be running whatever was in the kernel.img
<elvishjerricco> But config.txt says `kernel=tow-boot-rpi4.bin` and `armstub=armstub8-gic.bin`
<clever> ah!
<clever> what path is config.txt at? did it fetch it? how big is config.txt?
<elvishjerricco> It did fetch config.txt; it's just at $path/config.txt; it's 211 bytes according to wc -c
<elvishjerricco> It actually fetched config.txt multiple times...
<clever> thats normal
<clever> the SPI firmware will fetch it once, to know which start.elf to load
<clever> then start4.elf will fetch it again, to know what kernel to load
<elvishjerricco> It got fetched thrice, not twice
<clever> do you have BOOT_UART enabled?
<elvishjerricco> And it wasn't even the first thing fetched. First it got start4.elf, then start.elf
<elvishjerricco> I do
monk has left #nixos-aarch64 ["Error from remote client"]
<clever> try adding uart_2ndstage=1 to config.txt?
<elvishjerricco> I can see in the serial output that it got "File not found" for start.elf and start4.elf, but it successfully got config.txt. Huh
<clever> double-check them with curl? permissions?
<elvishjerricco> Curl works fine
<elvishjerricco> No new output with `uart_2ndstage=1`
<clever> that bug again, ack!
<elvishjerricco> clever: Yea, so I do see `Starting start4.elf @ 0xfec00200 partition -1`
<elvishjerricco> Then some stuff, and then nothing
<clever> there should be logs starting with MESS
<elvishjerricco> Nothing with "MESS"
<clever> yeah, thats uart_2ndstage being broken
<elvishjerricco> But it does successfully get start4.elf, then fixup4.dat, then it starts start4.elf, and then silence
<clever> and this is why we need open-source firmware
<clever> the debugging sucks, and the engineers often dont have time to fix every little bug
<elvishjerricco> I do see that most of the tftpd logs come *after* starting start4.elf
<clever> yeah, so the elf is running
<elvishjerricco> First it reads config.txt, then a bunch of files that aren't tow-boot-rpi4.bin
<elvishjerricco> Is there anyway to fix this 2nd stage uart bug?
<elvishjerricco> s/fix/workaround/
<clever> i think it works when your not network booting
<elvishjerricco> well
<clever> yes, that defeats the whole point :P
<elvishjerricco> yea ;P
<elvishjerricco> So why might it not be trying to get tow-boot-rpi4.bin?
<clever> what are the full contents of config.txt?
<clever> do the other kernel.img files exist?
<elvishjerricco> No they do not
<clever> oh
<clever> the firmware now has a [cm4] conditional
<clever> that might be your problem
<clever> duplicate the [pi4] section under [cm4]
<elvishjerricco> that can't be right. This works when it's on an sd card
<elvishjerricco> like it boots tow-boot
<clever> try it anyways, just to confirm
zupo has joined #nixos-aarch64
<elvishjerricco> clever: no dice
<clever> try copying tow-boot-rpi4.bin to kernel8.img ?
<elvishjerricco> Well something is happening now...
<clever> try deleting the entire [pi3] block, and remove the [pi4] and [all] headers
<clever> its only going to run on a cm4, you dont need conditions to support others
orivej has joined #nixos-aarch64
HenrikK has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
steveeJ has quit [Ping timeout: 258 seconds]
steveeJ has joined #nixos-aarch64
<elvishjerricco> clever: So I do notice that uart stops after `Stop display` and `Display stopped` are output. Is that relevant?
<clever> elvishjerricco: which part of the software stack are those coming from?
<elvishjerricco> clever: That's being output over serial just before it goes silent
<clever> can you paste all of that boot session?
<clever> ah, that must be a recent SPI firmware
<clever> the + on line 147 is the last thing the bootcode.bin prints before it flushes the uart and passes control to start4.elf
<clever> based on HDMI_DELAY, the bootcode.bin may bring the hdmi online to show the boot status
<elvishjerricco> Yea I pulled usbboot today
<clever> and then it turns back off again
<clever> i prefer picking an eeprom version myself
<elvishjerricco> I wouldn't know which version to pick :P
<clever> i usually just pick the latest in here
<clever> reading the git history can tell you when things changed
<elvishjerricco> clever: would a different version not have this stage 2 uart bug?
<clever> possibly, you could try older versions and see what works
superherointj has joined #nixos-aarch64
<elvishjerricco> Don't know if this matters, but apparently `vcgencmd otp_dump | grep 17:` is supposed to yield `17:3020000a`
<elvishjerricco> But I get `17:000048b0`
<clever> *looks*
<elvishjerricco> Apparently it should be `17:3020000a` after you boot with `program_usb_boot_mode=1` in config.txt. I've done that, but it's still `17:000048b0`.
<clever> program_usb_boot_mode is pi3 only
<elvishjerricco> Just wondering if this has anything to do with why u-boot wouldn't find the usb controller
<clever> it has zero effect outside of the pi3
<elvishjerricco> ah whoops
<elvishjerricco> alright anyway, back to netboot
<clever> i also managed to piss off one of the engineers on that subject :P
<elvishjerricco> or... maybe I stop wasting time with that...
<clever> there was a history of pi4's being mysteriously bricked
<clever> and one day, somebody reported using program_usb_boot_mode=1 on a pi4, and then it was bricked
<clever> a quick check of the boot rom disassembly, said that the bit that once did usb-boot, is now something else
<clever> and if it doesnt match something, it dont boot!
<clever> elvishjerricco: upon discovering such a fault, what would you do?
<samueldr> whew
<elvishjerricco> clever: so the device was perma-bricked?
<clever> that was my theory
<elvishjerricco> ouch
<clever> and i quickly opened a ticket to report it as such
<clever> >> It's a shame you didn't check that before spreading the fear, uncertainty and doubt.
<{^_^}> raspberrypi/firmware#1475 (by cleverca22, 33 weeks ago, closed): program_usb_boot_mode=1 might brick any pi4
<clever> because i reported an issue, and didnt disassemble every piece of involved code on the spot
<clever> i was accused of "spreading the fear, uncertainty and doubt"
<clever> the engineer was giving very short and non-descript answers, like "Thank you for your concern, but program_usb_boot_mode does nothing on a Pi 4."
cptchaos83 has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
cptchaos83 has joined #nixos-aarch64
zupo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<elvishjerricco> clever: I'm moving back to this channel. #raspberrypi people seem to have an irrational disdain for u-boot
<clever> ive noticed the same on the rpi forums, for any bootloader other then stock
<clever> that includes uefi
<clever> and ive also helped people de-uboot their installs before, just to make dtoverlay work
<clever> which reminds me, i found a new trick to make de-ubooting simpler
<samueldr> that's quite ridiculous
<samueldr> sure, U-Boot "makes things more complex"
<samueldr> but only because the vendor does their own weird things
<clever> the official firmware, also ignores the kernel= statement, when you netboot
<clever> so it just silently doesnt load uboot anymore
<samueldr> one thing I want to work on with Tow-Boot is allowing better support for vendor things like those at run-time, e.g. a "bios" menu for vendor shenanigans
<clever> i had given them the idea to add a bios menu to the existing spi flash, they turned it down
<clever> i considered adding one to the desktop app (rpi-imager), but upon reading its source, i can see why it doesnt
<clever> the imager is as dumb as a sack of bricks
<samueldr> clever: that's the reason I implemented the Tow-Boot menu with PDCurses
<samueldr> so building rich TUIs is easy
<elvishjerricco> clever: Are you certain that the firmware just ignores kernel=, or is that just an assumption based on my experimentation?
<clever> the choice between allowing usb or not, isnt a client side choice
<clever> there is a json file, that lists available .img files
<clever> and the image with the config, was pre-generated, and put in a list
<clever> adding a bios style boot-order menu to rpi-imager, would be a major overhaul
<samueldr> one big issue is HID support,
<samueldr> they kind of shot themselves in the foot with a small eeprom
<clever> elvishjerricco: it appears to be ignoring the entire config.txt, the dwc overlay isnt loaded, uart_2ndstage doesnt work, kernel= doesnt work
<clever> samueldr: a secondary problem, is that the initial binary you load, is limited to 128kb
<clever> to get over that limit, you either need plugins and some kind of dynamic linker, or load a second executable and chainload
<samueldr> meh, lots of platforms have similar issues
<samueldr> not like it's insurmountable
<clever> there are 2 pi specific things you could potentially add to tow-boot
<clever> 1: you can sniff the spi->start protocols, and know where the firmware booted from
<clever> so uboot always boots from the right place
<clever> 2: you could have a gui to edit the bootconf.txt and boot-order in the SPI flash
<samueldr> Tow-Boot will never "sniff" to know where to boot from
<samueldr> and I'll explain
<samueldr> it makes the boot process more inscrutable when you treat it as "just a bios"
<samueldr> because now it matters where it is installed
<samueldr> I want it to not matter at all
<clever> ah
<clever> elvishjerricco: reading the kernel.pcap file first...
<samueldr> the boot order is already part of the environment, so I "just" (hah) need to properly get things like `saveenv` working on all platforms in a sensible manner
<clever> i can see its fetching start4.elf and config.txt from the serial# subdir
<samueldr> then make a UI that "just" edits the boot_targets variable
<clever> then it loads pieeprom.sig (not found)
<clever> then it begins downloading the actual start4.elf
<clever> then it grabs fixup4.dat
<superherointj> samueldr, bought today a Raspberry Pi 4 to install NixOS. Can test Tow-Boot :)
<clever> elvishjerricco: try deleting the [pi3] section entirely, and the [pi4] header, what happens then?
orivej has quit [Ping timeout: 252 seconds]
<elvishjerricco> clever: those things had been commented out in the boots that I sent you
<elvishjerricco> Though I guess I was assuming comments work...
<clever> ah they are
<clever> its harder to read in wireshark
<clever> yep, comments look fine
<{^_^}> raspberrypi/firmware#1012 (by mkreisl, 2 years ago, open): RPi3, Rpi3B+ network boot: config.txt ignored
<clever> elvishjerricco: of note, near the bottom of kernel.pcap, i can see dhcp is being re-queried, and it has a vendor class of u-boot.armv8
<clever> so uboot is definitely running, and sending its own dhcp query
<elvishjerricco> Huh...
<elvishjerricco> I don't get any serial output from it
<clever> and i think it was uboot that then asked for c0a8038b.img
<elvishjerricco> Does the u-boot binary need to be reconfigured for net booting?
<clever> and thats just 192.168.3.139 encoded as hex
<clever> its already trying to netboot, and successfully reached your tftp server
<clever> it then tried pxelinux.cfg/01-dc-a6-32-fe-7a-33
<clever> and several others
<clever> elvishjerricco: oh, if config.txt is ignored, then enable_uart=1 is missing
<clever> and if uboot respects the firmware dt, it will stop using the uart
<elvishjerricco> That makes sense
<elvishjerricco> clever: I think samueldr has tow-boot configured to always use uart
<elvishjerricco> oh
<samueldr> enable_uart=1 is **required** for u-boot
<elvishjerricco> or maybe it was doing that because he set enable_uart=1
<elvishjerricco> ok
<elvishjerricco> So u-boot IS booting
<elvishjerricco> So we just need to figure out how to get config.txt respected...
<clever> yep
<samueldr> sounds unfun!
<clever> "So u-boot IS booting", but only if you rename uboot to kernel8.img
<clever> because config.txt cant say to load tow-boot.bin
<elvishjerricco> So which part of the boot chain actually reads config.txt?
<clever> both bootcode.bin and stert4.elf
<clever> but this kernel= part is only handled in start4.elf
<clever> elvishjerricco: clone this repo, and try doing a bisect, use symlinks to wire in start4.elf and fixup4.dat, the other files dont matter
<clever> boot each version, and see what it does
<elvishjerricco> Oh wow this repo is going to take forever to clone
<elvishjerricco> They ship kernel binaries in that thing
<clever> yes
<clever> they wiped the history at one point too
<elvishjerricco> Yay...
<clever> i dont know how they did it, but a clone stops at some point
<clever> but the parent commit is still visible as a hash
<clever> `git fetch origin <hash>` can pull it, and get more
<clever> ive looked at the firmware in the original commit, and it doesnt even look like pi firmware
<clever> it looks like it belongs in a cable box
<elvishjerricco> I'm guessing I want to remove the kernel8.img copy while I'm bisecting this? So I know whether it's respecting kernel= i.e. the config.txt?
<clever> yeah
<samueldr> clever: highly likely they just started from an existing broadcom cable box devkit
<clever> samueldr: yep
<clever> samueldr: it still had support for loading games and such
<elvishjerricco> Geez. 12% is 2.34GiB
<samueldr> ooh
<clever> [clever@amd-nixos:~/apps/rpi/firmware]$ du -h .git
<clever> 16G .git
<elvishjerricco> clever: I bet we could get a better response on the rpi forums or something if we came up with a config.txt thing that has nothing to do with u-boot
<clever> and its sad that we have to hide what we are trying to do
<elvishjerricco> btw did you make any progress on tow-boot -> usb on your pi400?
<clever> not since lastnight
<clever> i'm stumbled, since all attempts to get logs out of it fail
<elvishjerricco> yuck
<clever> stumped*
<samueldr> I'll try looking at it some during the week-end, if I remember