00:00
alp has quit [Ping timeout: 272 seconds]
00:04
h0m1 has quit [Quit: WeeChat 2.9]
00:04
h0m1 has joined #nixos-aarch64
00:15
orivej has quit [Ping timeout: 240 seconds]
00:16
mla has quit [Remote host closed the connection]
00:26
cole-h has quit [Quit: Goodbye]
00:28
tilpner_ has joined #nixos-aarch64
00:30
justanotheruser has quit [Ping timeout: 260 seconds]
00:31
tilpner has quit [Ping timeout: 260 seconds]
00:31
tilpner_ is now known as tilpner
00:36
lafa has quit [Read error: Connection reset by peer]
01:02
alp has joined #nixos-aarch64
01:21
h0m1 has quit [Ping timeout: 246 seconds]
01:23
h0m1 has joined #nixos-aarch64
01:53
alp has quit [Ping timeout: 272 seconds]
02:19
LnL- has joined #nixos-aarch64
02:19
LnL- has joined #nixos-aarch64
02:19
LnL- has quit [Changing host]
02:27
AmandaC has quit [*.net *.split]
02:27
alexarice[m] has quit [*.net *.split]
02:27
flokli has quit [*.net *.split]
02:28
flokli has joined #nixos-aarch64
02:29
alexarice[m] has joined #nixos-aarch64
02:33
AmandaC has joined #nixos-aarch64
03:11
<
lovesegfault >
could've saved us some time
03:13
<
clever >
lovesegfault: that alos has some extra pins in the list!
03:14
<
clever >
this claims that hsynv and vsync are connected
03:14
<
clever >
but the config.txt says to disable hsync/vsync
03:15
<
clever >
i can also see that they squeezed the touch stuff onto unused pins in the middle of color, 10, 11, 27
03:15
<
clever >
i would still like to know which controller is on the chip
03:16
<
lovesegfault >
touch controller?
03:16
<
clever >
display controller
03:16
<
clever >
what is that hyperpixel-init talking to?
03:16
<
lovesegfault >
right, I imagine some controller on the display
03:17
<
lovesegfault >
which needs to be told how to start
03:17
<
clever >
i did find this earlier, when researching a different display
03:17
<
clever >
thats an lcd driver chip for a 320x480 panel
03:18
<
clever >
but this is the kind of chip you would find directly on the glass, it over over 1000 pins
03:18
<
clever >
one for every single row and column
03:19
<
lovesegfault >
I think the controller chip is on the ribbon cable
03:20
<
clever >
is there some kind of model# on the ribbon?
03:22
justanotheruser has joined #nixos-aarch64
03:22
<
lovesegfault >
let me see
03:23
<
lovesegfault >
copying
03:24
<
lovesegfault >
TXW397017(S or 5)2-RGB-02
03:24
<
lovesegfault >
it's very hard to read
03:25
<
clever >
lovesegfault: it looks like they have a paste with a lot of tiny balls of metal, and then they just shove the chip onto the glass, thru the paste
03:25
<
clever >
and then the bumps on the chip complete the circuit in spots
03:27
<
lovesegfault >
that's bananas
03:28
<
clever >
the paste likely also acts as an epoxy, to glue things together
03:32
<
lovesegfault >
clever: in that code `fsel[regnum]` is the same as rawaddr.offset(0x200000).offset(regnum * sizeof(c_void))?
03:32
<
lovesegfault >
(L16)
03:32
<
clever >
lovesegfault: it looks like they are exposing the i2c bus for the touchscreen, so you can put your own i2c devices onto the pi
03:32
<
clever >
its 32bit fields
03:32
<
lovesegfault >
I don't want to have to cast to volatile ptr to a slice
03:32
<
clever >
but you must cast to volatile, or it wont work
03:33
<
lovesegfault >
right, this is volatile
03:33
<
clever >
at offset 0x200000, you have 6 (i think) 32bit registers, 4 bytes between each
03:33
<
clever >
each of those registers, is a packed array of 10 x 3bit
03:34
<
clever >
and that 3bit int, says what model the pin should be in
03:35
<
lovesegfault >
annoying thing is offset is by counts of sizeof T
03:35
<
lovesegfault >
b/c it enforces alignment
03:36
<
clever >
that should be what we want
03:36
<
clever >
make T a 32bit int, and then just offset by regnum
03:37
<
lovesegfault >
well, we offset by 4096 instead of by 0x20000
03:37
<
lovesegfault >
right?
03:37
<
lovesegfault >
b/c it's 0x20000 / 0x20
03:37
<
clever >
nope, offsets of +0 +4 +8 +12 +14 +16 bytes
03:37
<
clever >
in addition to the 0x20000
03:37
<
lovesegfault >
Right, I'm talking just about the 0x20000 right now
03:38
<
clever >
#define GP_FSEL0 HW_REGISTER_RW( 0x7e200000 )
03:38
<
lovesegfault >
I mean that it won't be `.offset(0x20000)` but rather `.offset(0x1000)` b/c sizeof(T) is 0x2
03:38
<
clever >
#define GP_FSEL1 HW_REGISTER_RW( 0x7e200004 )
03:38
<
clever >
#define GP_FSEL2 HW_REGISTER_RW( 0x7e200008 )
03:38
<
clever >
oh, you can entirely get rid of the `0x200000` by just changing the mmap
03:39
<
clever >
mmap takes an offset, just add to that
03:39
<
clever >
and then reduce the size to 4096
03:39
<
lovesegfault >
right, so my offset is arm_phys + 4096?
03:40
<
clever >
rawaddr = (void*)mmap(NULL, 16 * 1024 * 1024, PROT_READ | PROT_WRITE, MAP_SHARED, fd, arm_phys);
03:40
<
clever >
arm_phys + 0x200000
03:40
<
lovesegfault >
derp
03:40
<
lovesegfault >
right
03:40
<
clever >
and reduce the size from 16mb to just 4096 bytes
03:40
<
lovesegfault >
b/c that one is raw bytes
03:41
<
lovesegfault >
got it
03:41
<
clever >
rawaddr = (void*)mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, arm_phys + 0x200000);
03:42
<
clever >
#define GP_FSEL6 HW_REGISTER_RW( 0x7e200018 )
03:42
<
lovesegfault >
what does "fsel" stand for?
03:42
<
clever >
function select
03:42
<
clever >
at 16mb chunk of MMIO is remapped from 0x7e00_0000 to bcm_host_get_peripheral_address()
03:44
<
clever >
so if you want to access 0x7e200004 then you need to access bcm_host_get_peripheral_address() + 0x200004
03:47
<
clever >
lovesegfault: oh, also, this code could be changed to eliminate the loops
03:47
<
clever >
lovesegfault: if you want to set pins 0-9 into alt2, you dont need 10 seperate writes
03:47
<
clever >
you dont even need a read, because thats all 10 pins in the bank
03:48
<
clever >
you can just fsel[0] = kBCM2708Pinmux_ALT2 | kBCM2708Pinmux_ALT2 << 3 | kBCM2708Pinmux_ALT2 << 6 | kBCM2708Pinmux_ALT2 << 9 .... | kBCM2708Pinmux_ALT2 << 27;
03:49
<
clever >
but for FSEL1, you want to leave 10&11 as inputs, so you have to read then write
03:54
veleiro has quit [Ping timeout: 260 seconds]
03:54
<
clever >
lovesegfault: ok, first, the register variable, the 7 FSEL registers are used to configure the function for 64 gpio pins
03:54
<
clever >
0-9 in FSEL0, 10-19 in FSEL1, .... 60-63 in FSEL6
03:55
<
clever >
if you do pin/10, then you get which fsel register you want
03:55
<
clever >
lovesegfault: following so far?
03:55
<
lovesegfault >
Oh, I see
03:56
<
clever >
next, each FSEL register is a packed array of 3bit ints, 10 in total
03:56
<
clever >
so pin 17 % 10, gives you 7, the pin within the bank
03:57
<
clever >
then 7 * 3, gives you the bit that pin7 starts at
03:57
<
lovesegfault >
each pin is one byte within these fsel banks?
03:58
<
lovesegfault >
wait, no, 4 bytes?
03:58
<
clever >
nope, each pin is 3 bits, within a 4 byte register
03:58
<
clever >
a 4 byte register has 32 bits
03:58
<
lovesegfault >
Oh, most is just unused?
03:58
<
clever >
30 bits are used, to assign the function for 10 pins
03:58
<
lovesegfault >
2 bits are unused
03:59
<
lovesegfault >
at the end?
03:59
<
clever >
yeah, bits 30 and 31 are unused
04:01
<
clever >
next problem is here on line 66
04:01
<
clever >
you must read the current value of FSELn from MMIO
04:01
<
clever >
then clear the 3 bits your about to modify
04:02
<
clever >
and ! is bit invert, right?
04:02
<
lovesegfault >
Oh, yep
04:02
<
clever >
so that will take a 0x7 (3 1 bits), and shift it over to align with the given pin
04:02
<
clever >
then invert it, so those 3 bits are 0, and all others are 1
04:03
<
lovesegfault >
*got it
04:03
<
clever >
then & will clear just the 3 bits in question
04:03
<
clever >
then the | will slot the new mode into those 3 bits
04:03
<
clever >
and write the result back to mmio
04:04
<
lovesegfault >
we need to offset self.addr still right
04:04
<
clever >
also, self.addr isnt being offset by register yet
04:05
<
clever >
could also change the type of register
04:05
<
clever >
and pin could be a u8 even
04:06
<
lovesegfault >
I made everything u32 to avoid a ton of casts in :68
04:06
<
clever >
technically, pin could be a u6, lol, but i dont think rust has that
04:08
<
clever >
the reg is 32 bits
04:08
<
lovesegfault >
oops
04:10
<
clever >
i need to use binary in c more, heh
04:10
<
clever >
it makes things like this more clear
04:11
<
lovesegfault >
does C do 0bxxxx too ?
04:11
<
clever >
i think so
04:11
<
clever >
where is PinMode defined?
04:11
<
clever >
yep, that looks good
04:12
<
clever >
now we just set the mode for all the pins
04:12
<
lovesegfault >
all of them?
04:12
<
lovesegfault >
just 0..27 = alt2?
04:12
<
clever >
0-9, 12-17, and 20-25
04:12
<
lovesegfault >
*0..28
04:12
<
lovesegfault >
ah, yeah
04:13
<
clever >
10/11 are the touchscreen data/clock
04:13
<
clever >
so you dont want to set 10
04:13
<
lovesegfault >
.. is exclusive at the end
04:13
<
lovesegfault >
you need ..= to make it go brrr
04:13
<
clever >
same as c then, it just looks more confusing
04:14
<
clever >
can you do 2 at once, like 0..10 12..17 ?
04:14
<
lovesegfault >
I thought I could
04:14
<
lovesegfault >
but now I can't find how
04:14
<
lovesegfault >
well
04:14
<
lovesegfault >
I can be nasty
04:15
<
clever >
and then page 102 says what alt2 does for each pin
04:15
<
clever >
we are setting it to a lovely bank of <reserved> because broadcom wants to keep secrets :P
04:16
<
clever >
thats the more up to date docs, for vc4 and vc6
04:16
<
lovesegfault >
broadcom :(
04:17
<
clever >
18, 19, the chip select for something, and backlight control
04:17
<
clever >
can be left as input
04:17
<
lovesegfault >
let's try this out!
04:17
<
clever >
one other thing as well
04:18
<
clever >
if you ssh into the pi, does it have /dev/gpiomem ?
04:18
<
clever >
if you mmap that at offset 0, you get the GPIO registers
04:18
<
clever >
so you dont need bcm_host_get_peripheral_address() or the other offset
04:18
<
clever >
also, the permissions on it, what group is gpiomem in?
04:18
<
clever >
but youll want an if statement
04:19
<
clever >
because gpiomem may not exist in the mainline linux
04:19
<
clever >
under raspbian, /dev/gpiomem is in a special gpio group, which pi is a member of
04:19
<
clever >
so you can mess with gpio, without having root
04:20
<
clever >
so, if you can open /dev/gpiomem, mmap offset 0, your done
04:20
<
clever >
if you fail to open it for any reason, fall back to /dev/mem with the bcm_host_get_peripheral_address() + gpio offset
04:21
<
lovesegfault >
on it
04:32
<
lovesegfault >
ta-daa
04:32
* clever
gets next link
04:33
<
clever >
lovesegfault: these 5 functions can do most gpio actions you would want to do
04:34
<
lovesegfault >
what happens if you setPin on a pin that is not in hi/lo mode?
04:34
<
lovesegfault >
oh, wait
04:34
<
clever >
not sure, i think it does nothing
04:35
<
clever >
only kBCM2708PinmuxOut lets you use it as gpio
04:35
<
clever >
kBCM2708PinmuxIn basically just does nothing
04:35
<
clever >
and input always works, in any mode
04:35
<
lovesegfault >
interesting
04:35
<
clever >
so you can use the input path to spy on the DPI activity
04:36
<
lovesegfault >
I wrote this cursedness to get it to cross
04:36
<
clever >
you want to look into naersk
04:36
<
clever >
that can cross-compile rust
04:37
* lovesegfault
fiddles
04:38
rajivr has joined #nixos-aarch64
04:45
<
lovesegfault >
clever: do you know how to do it handy?
04:46
<
clever >
you want to use pkgsCross to tell naersk that your cross-compiling
04:46
<
clever >
as-in, make an overlay that puts hyperpixel into nixpkgs
04:46
<
clever >
then do pkgsCross.aarch64.hyperpixel
04:47
<
clever >
and naersk will magically just do the right thing
04:48
<
clever >
your still requesting an x86 build
04:49
<
clever >
also, that wont work at all
04:49
<
clever >
the buildInputs vs nativeBuildInputs only works if you use callPackage
04:49
<
clever >
yes, its very misleading
04:50
<
lovesegfault >
I'm using callPackage on naersk itself
04:50
<
clever >
lines 7&8 will always be the same arch, even when you cross-compile
04:50
<
clever >
you must use callPackage to load this default.nix
04:50
<
clever >
and callPackage must be the thing to give you cargo and raspberrypi-tools
04:50
<
clever >
if you `with pkgs;` the magic goes away
04:51
<
clever >
now the magic works once more
04:52
<
clever >
pkgs.pkgsCross
04:52
orivej has joined #nixos-aarch64
04:52
<
lovesegfault >
I will be blown away if this works
04:52
<
clever >
but it can be better to use an overlay to put it into nixpkgs
04:52
<
clever >
then you can just pkgsCross.aarch64-multiplatform.hyperpixel to get a 64bit one, or pkgsCrpss.arm6.hyperpixel to get an arm6 one
04:54
<
lovesegfault >
wonder how long binutils takes to build
04:54
<
lovesegfault >
and whether it's worth copying to the phat box
04:54
<
clever >
installPhase
04:55
<
lovesegfault >
noice
04:55
<
lovesegfault >
well, but now it's building gcc
04:55
<
clever >
oh, you should maybe look into `--option builders`
04:56
<
lovesegfault >
hehehe
04:56
<
clever >
it ssh's as root
04:56
<
clever >
so it needs to be in roots ~/.ssh/config
04:56
<
clever >
or use an IP
04:56
<
lovesegfault >
these boxes don't root ssh
04:57
<
clever >
from root, not to root
04:57
justanotheruser has quit [Ping timeout: 260 seconds]
04:57
<
lovesegfault >
oh, I see
04:57
<
lovesegfault >
let me show you this
04:57
<
lovesegfault >
it's doing magicfuckery
04:57
<
clever >
ah, search domains
04:57
<
lovesegfault >
b/c it's our company's machine
04:57
<
clever >
i just did that via /etc/resolv.conf
04:58
<
clever >
it may help if you shove it into /etc/ssh/config instead
04:59
<
lovesegfault >
I had tried doing something like that before but it always goes kaboo,
04:59
<
clever >
programs.ssh.extraConfig
04:59
<
lovesegfault >
it also
_requires_ an ssh agent running
04:59
<
clever >
ah, that complicates it a bit
05:00
<
lovesegfault >
b/c it adds certs to it
05:00
<
clever >
you have to `sudo nix build`, so the build isnt forked out to nix-daemon, but is a child of sudo, and inherits your agent vars
05:00
<
lovesegfault >
and that's how you ssh in
05:00
<
lovesegfault >
so I have this whole setup to get it to kind of work
05:11
<
clever >
qemu-user lets you cheat!
05:12
<
clever >
boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; on the host
05:14
<
clever >
but its been patchelf'd improperly
05:15
<
clever >
try not-nightly?
05:15
lafa has joined #nixos-aarch64
05:16
<
clever >
and this is why i dont let my code rust :P
05:25
<
clever >
export DRV=$(nix-instantiate ...) ; nix-copy-closure --to $HOST $DRV ; ssh $HOST nix build $DRV ; OUT=$(nix-store --query --binding out $DRV) ; nix-copy-closure --from $HOST $OUT
05:25
<
clever >
lovesegfault: try making a shell script like this?
05:25
<
lovesegfault >
good idea, I do this enough it's worth making a script
05:26
<
clever >
nix-copy-closure -s --include-outputs, may also help
05:27
<
clever >
1st part lets the source use caches, 2nd part will copy any pre-built stuff over too
05:27
<
clever >
s/source/dest/
05:28
<
clever >
the script could do `HOST=$1 ; shift ; ... nix-instantiate "$@"
05:28
<
clever >
then you can just do `script host default.nix -A foo`
05:28
<
lovesegfault >
I always build on the same host :P
05:28
<
clever >
ah, then just "$@" without the shift
05:30
<
clever >
the drv variable should be exported, for gc reasons
05:31
<
clever >
you can do the query locally
05:31
<
clever >
since you have the drv locally
05:32
<
clever >
when nix does a GC, it will peek at the env vars for every proc
05:32
<
lovesegfault >
that's pretty cool
05:32
<
clever >
and if it finds a storepath, it will treat it as in-use
05:32
<
clever >
name the pid of something thats unlikely to have secrets in its env
05:33
<
lovesegfault >
this calculator I just opened
05:34
<
clever >
and scroll up to see how i did it
05:34
<
clever >
xargs -0 -n1 echo < /proc/13464/environ
05:35
<
clever >
that file contains a \0 seperated list of key=value pairs
05:35
<
lovesegfault >
that is awesome
05:35
<
lovesegfault >
so it does this for /proc/* and finds store paths within?
05:35
<
clever >
and this directory, shows all open file descriptors
05:36
<
clever >
this one then shows flags, and seek position
05:36
<
lovesegfault >
Oh, I can see
_how_ it opened the file and where it's seek'd to!
05:36
<
clever >
and this is the executable behind a pid
05:37
<
clever >
and its working dir
05:37
<
clever >
that was a symlink, but your ls followed it!
05:37
<
clever >
also useful, /proc/PID/root, is what / maps to for that proc
05:38
<
clever >
you can use that to spy inside containers
05:38
<
clever >
and if /proc isnt setup right, even escape the container
05:38
<
clever >
also, all of those /proc symlinks are magic, you can open the symlink, even if the link's target doesnt exist
05:38
<
clever >
lrwx------ 64 bemeurer 22 Sep 22:35 /proc/13464/fd/11 -> /memfd:wayland-cursor (deleted)
05:38
<
clever >
for example, that filename doesnt exist
05:39
<
clever >
but if you try to just blindly open /proc/13464/fd/11, youll get a valid handle to the same object
05:39
<
clever >
in this case, its likely shared memory for the framebuffer
05:39
<
lovesegfault >
it froze
05:39
<
clever >
thats what happens when you cat binary files :P
05:39
<
clever >
xoff probably
05:40
<
clever >
and i dont know the tmux binding to kill a window
05:40
<
clever >
next handy trick
05:40
<
lovesegfault >
it's x apparently
05:40
<
clever >
gdb /proc/13464/exe 13464
05:41
<
clever >
that attaches to a given pid, without you needing to know what the binary actually is
05:42
<
clever >
`cat /proc/13464/maps` and that one is all mmap()'d things
05:43
<
lovesegfault >
is this how htop works?
05:43
<
clever >
status and stat, are what then feed into `top` and `ps`
05:43
<
clever >
status is human readable, stat is machine readable
05:43
<
clever >
not sure what syscall does
05:44
<
lovesegfault >
seems odd that I don't need sudo to go spelunking like this?
05:44
<
clever >
and that pagemap file, tells you the physical page for a given virtual page
05:44
<
clever >
you can only dig into procs in your own user
05:44
<
clever >
viins ❯ ls -l /proc/1/fd/
05:44
<
clever >
"/proc/1/fd/": Permission denied (os error 13)
05:44
<
lovesegfault >
Ah, I see
05:45
<
lovesegfault >
that makes perfect sense
05:45
<
clever >
root is special as always, and can spy on anybody
05:45
<
clever >
thats how nix-daemon can find gc roots for other users
05:45
<
lovesegfault >
Right, makes sense
05:47
<
clever >
and /proc/self is another magic symlink, it always points to the current pid
05:47
<
lovesegfault >
how tf does this stuff work behind the scenes?
05:47
<
clever >
got a clone of the linux source?
05:50
<
clever >
line 31 sets up what to call when you try to read the symlink
05:51
<
clever >
16 then gets the pid for whatever is trying to read the symlink
05:51
<
clever >
and 25 will printf it into a buffer, and return that buffer
05:51
<
clever >
`current` is a special pointer in linux, that refers to the current thread
05:52
<
lovesegfault >
what's `unlikely`?
05:53
<
clever >
a hint to the compiler
05:53
<
lovesegfault >
Oh, branch prediction
05:53
<
clever >
it basically makes it `if (fail) goto handle_failure;
05:53
<
clever >
instead of `if (!failure) goto skip_error_handler;
05:54
<
lovesegfault >
got it
05:54
<
clever >
the idea is to not branch in the more likely case, so the next opcode is just the next one in ram
05:55
cole-h has joined #nixos-aarch64
05:55
<
clever >
ah, and here is the fdinfo file
05:56
<
lovesegfault >
"return !!file"
05:57
<
clever >
it was a pointer
05:57
<
clever >
that turns any non-zero value into a plain 1
05:58
<
lovesegfault >
I see
05:58
<
lovesegfault >
why not just `return 1`?
05:58
<
clever >
the first ! turns 0->1 and nonzero->0
05:58
<
clever >
the second ! inverts again, so 0->1->0 and nonzero->0->1
05:58
<
clever >
since it has to return if file was nonzero or zero
05:59
<
lovesegfault >
Ah, I see
05:59
<
lovesegfault >
also I don't understand why it's building rustc again...
06:11
<
lovesegfault >
what
06:11
<
lovesegfault >
idk what naersk is doing
06:12
<
lovesegfault >
I have an idea
06:14
<
lovesegfault >
boom
06:14
<
lovesegfault >
just force it to build on the aarch64 remote builder
06:14
<
lovesegfault >
and call it a day :P
06:15
<
clever >
doing it on the remote system is pretty easy
06:15
<
clever >
just `import <nixpkgs> { system = "aarch64-linux; }`
06:15
<
clever >
then it knows its arm64->arm64, and finds the nearest arm64 box
06:16
<
lovesegfault >
ugh, I need to point it to libclang
06:17
<
lovesegfault >
does the usual envvar thing work?
06:17
<
clever >
dont remember
06:18
<
clever >
llvmPackages goes into the callPackage line
06:19
<
clever >
oh, and because we turned on qemu-user, it can do "native" aarch64 builds locally
06:19
<
lovesegfault >
so it's using the remote & my local machine
06:19
<
lovesegfault >
noice
06:20
<
lovesegfault >
is that a static bin?
06:20
<
lovesegfault >
I doubt it
06:20
<
clever >
dynamic, but you could use pkgsStatic.callPackage to force static
06:21
<
lovesegfault >
while that runs let's try it out like so
06:23
<
clever >
ah, the rpi tools are pre-compiled dynlibs
06:23
<
clever >
no static available
06:23
<
clever >
some of them are closed-source, some are just a lazy package
06:23
<
clever >
> > ah, so that part would still be waiting on a proper ISP driver in linux
06:23
<
{^_^} >
error: syntax error, unexpected '>', at (string):324:1
06:23
<
clever >
> Broadcom IP - there won't be a native Linux driver for it.
06:23
<
{^_^} >
error: syntax error, unexpected ')', expecting ID or OR_KW or DOLLAR_CURLY or '"', at (string):325:1
06:24
<
clever >
lovesegfault: anoyingly, some parts of the pi can be made public, and get drivers, while other parts are "Broadcom IP" and will never get proper drivers
06:24
<
clever >
its not really clear where the line gets drawn
06:24
<
lovesegfault >
That's... super annoying
06:25
<
clever >
but i can see how the ISP has all of their secret sauce
06:25
<
clever >
it deals with the de-bayering the camera images, color correction, and lense distortion correction
06:25
<
clever >
lots of complicated image stuff, that has to be done at high frame rates
06:26
<
lovesegfault >
alright, so, display is down
06:26
<
lovesegfault >
DISPLAY
06:27
<
clever >
does rust have #ifdef ?
06:27
<
lovesegfault >
yeah, kind of
06:27
<
lovesegfault >
why?
06:27
<
clever >
if you use it to comment out the support for /dev/mem, you dont have to link to the broadcom libs
06:27
<
clever >
then your static problem goes away
06:28
<
clever >
but it only works if /dev/gpiomem exists, so youll want to keep the /dev/mem code as a option you can turn back on
06:29
<
lovesegfault >
What's the scenario where gpiomem
_doesn't_ exist?
06:29
<
clever >
it may not be in the upstream linux kernel
06:29
<
clever >
so things would rely on using the rpi fork of linux
06:30
<
lovesegfault >
I see
06:33
orivej has quit [Ping timeout: 256 seconds]
06:35
<
lovesegfault >
clever: do we have the source for that
_one_ function we end up using?
06:36
<
clever >
lovesegfault: thats where it lives
06:37
<
lovesegfault >
let's see what get_dt_ranges does
06:37
<
clever >
the file contains a series of 32bit or 64bit ints
06:38
<
clever >
getting an example...
06:38
<
lovesegfault >
let's just impl this in rust, looks not-bad enough
06:38
<
lovesegfault >
no more binden, no more linking anything
06:38
alp has joined #nixos-aarch64
06:38
<
clever >
lovesegfault: this says that 0x7e00_0000 is mapped to 0x2000_0000, length 0x1000000
06:39
<
lovesegfault >
I see
06:39
<
clever >
lovesegfault: but on pi4, it gets a bit more complicated, because DT only supports 32bits, so you need 2 32bit ints to represent a 64bit int
06:39
orivej has joined #nixos-aarch64
06:39
<
clever >
#address-cells = <0x01>;
06:39
<
clever >
#size-cells = <0x01>;
06:39
<
lovesegfault >
how can dts' not end up stepping all over each other?
06:39
<
clever >
this says how many 32bit ints make up an addr and size
06:39
<
lovesegfault >
(when applied)
06:39
<
clever >
can you ssh into the pi?
06:40
<
clever >
this says that all adresses for the parent side are 2 32bit ints long
06:40
<
clever >
00000000 00 00 00 02 |....|
06:40
<
clever >
[root@aurelius:~]# hexdump -C /proc/device-tree/#address-cells
06:41
<
clever >
[root@aurelius:~]# hexdump -C /proc/device-tree/#size-cells
06:41
<
clever >
00000000 00 00 00 01 |....|
06:41
<
lovesegfault >
what's this |....| stuff
06:41
<
clever >
but lenghts are 1 32bit long
06:41
<
clever >
thats the char for each int
06:41
<
lovesegfault >
ah, I see
06:41
<
clever >
[root@aurelius:~]# hexdump -C /proc/device-tree/soc/#address-cells
06:41
<
clever >
00000000 00 00 00 01 |....|
06:41
<
clever >
then for the child bus, an addr is 1 32bit
06:42
<
clever >
[root@aurelius:~]# hexdump -C /proc/device-tree/soc/#size-cells
06:42
<
clever >
00000000 00 00 00 01 |....|
06:42
<
clever >
and a size is also 1 32bit
06:42
<
clever >
[root@aurelius:~]# hexdump -C /proc/device-tree/soc/ranges
06:42
<
clever >
00000000 7e 00 00 00 00 00 00 00 fe 00 00 00 01 80 00 00 |~...............|
06:42
<
lovesegfault >
oh, just like what we saw on the dts file
06:42
<
clever >
so first you have a child addr, 1 32bit wide, 7e 00 00 00
06:42
<
clever >
then you have a parent addr, 2 32bits, 00 00 00 00 fe 00 00 00
06:43
<
clever >
then a length, not sure which size (but both are 1), 01 80 00 00
06:43
<
clever >
so if you want to access 0x7e20_0000, you must instead access 0xfe20_0000
06:44
<
clever >
bcm_host_get_peripheral_address() just blindly assumes the 1st entry is for 0x7e00_0000, and it ignores #address-cells entirely
06:44
<
clever >
it winds up reading the upper 32bits of the parent addr, gets a 0, then tries again in 64bit mode
06:44
<
lovesegfault >
*chefs hands*
06:45
<
clever >
on pi0/pi1, it always maps to 0x2000_0000
06:45
<
clever >
pi2/pi3, 0x3f00_0000
06:45
<
clever >
pi4, its usually 0xfe00_0000
06:45
<
clever >
they keep moving it out of the way of ram, then ram gets bigger :P
06:46
* lovesegfault
looks at his 8GB Pi4
06:46
<
clever >
you might be loosing 16mb of ram, due to the placement
06:47
<
clever >
i havent investigated how the 4 changes thingsfully
06:47
<
clever >
but, there is also an MMU at play
06:48
<
lovesegfault >
Pi3 doesn't have an MMU?
06:48
<
clever >
all of them have multiple MMU layers
06:48
<
clever >
basically, there is a 64 slot page-table, that maps 16mb chunks of "arm physical" to 16mb chunks (but 2mb aligned) chunks of the vpu bus
06:49
<
clever >
that is what maps 0x20/3f/fe to 0x7e
06:49
<
clever >
and because of that, i can put MMIO at 0x20 on a pi3
06:49
<
lovesegfault >
vpu is the video proc?
06:49
<
clever >
mapBusToArm(VC4_PERIPH_BASE, ARM_PERIPH_BASE);
06:50
<
lovesegfault >
which is responsible for early boot right?
06:50
<
clever >
yeah, but all IO hw also lives in the vpu space
06:50
<
clever >
so the arm has to go thru this MMU to access anything
06:50
<
clever >
#define VC4_PERIPH_BASE 0x7E000000
06:50
<
clever >
#define ARM_PERIPH_BASE 0x3F000000
06:51
<
clever >
this code will configure the MMU to map 0x7e to 0x3f, to make it function like a pi2/pi3
06:52
<
clever >
lovesegfault: but this part is some fancy stuff i added
06:52
<
clever >
that will patch the soc/ranges at boot time, to match where the firmware put it
06:53
<
clever >
so i can freely change just ARM_PERIPH_BASE (as long as its 16mb aligned), rebuild 2 tiny blobs (under 128kb total), and linux will magically boot
06:53
<
lovesegfault >
ah, nice
06:53
<
clever >
did you delete my source from ~/src? or am i on the wrong system again? lol
06:56
<
clever >
and theres all the src
06:57
<
lovesegfault >
how are you enforcing the alignment?
06:57
<
clever >
i dont, lol
06:58
<
clever >
line 169 will divide by 16
06:58
<
clever >
so it rounds down to the next alignment
06:58
<
lovesegfault >
I see
06:58
<
clever >
but then the field in the dts will be wrong, and everything fails
06:59
cirno1000 is now known as cirno999
06:59
<
clever >
but line 83 wont match, so it will hang on boot
06:59
<
clever >
rather then doing whacky things
07:00
<
lovesegfault >
Ah, I sww
07:00
<
lovesegfault >
*see
07:00
<
lovesegfault >
so, to round up: all that fn is doing is reading of the mapping from /proc/device-trees and almost guessing at the right one?
07:00
<
lovesegfault >
that fn = the one we are linking in
07:03
<
lovesegfault >
RIIR!
07:05
<
clever >
lovesegfault: if you want to be really really correct, you need to find the node with compatible = brcm,bcm2711-gpio or brcm,bcm2835-gpio
07:05
<
lovesegfault >
so it's (child-bus-address, parent-bus-address, length)
07:06
<
clever >
lovesegfault: then find recursively translate the reg= on it, as you go up the tree
07:06
<
clever >
so that would be the soc/ranges in this case (its only one deep)
07:06
<
clever >
but now we are just making it overly complicated :P
07:06
<
clever >
i dont think they will ever move the gpio block on the vpu side
07:07
<
lovesegfault >
Right
07:08
<
lovesegfault >
how do they know to seek 4 bytes on L153 (which is used on L143)
07:08
<
lovesegfault >
i.e. how to set offset
07:08
<
lovesegfault >
are they just assuming the child-bus-address size?
07:08
<
clever >
the child-bus-address is 32bits (because #addr-size is 1)
07:08
<
clever >
the code we referenced just assumes its 1
07:09
<
lovesegfault >
right
07:09
<
clever >
and then 32bit vs 64bit, you have to refer to the #addr-length on the parent node
07:10
<
lovesegfault >
the correct way of doing this is to parse size-cells, which will tell you that it's 4 bytes
07:10
<
lovesegfault >
where's #addr-length?
07:11
<
lovesegfault >
wait
07:11
<
lovesegfault >
why are those different?
07:11
<
clever >
bottom right screen, the child is 32bits, the parent is 64bit
07:11
<
clever >
because the child addr space only uses 32bit addresses
07:11
<
clever >
2020-09-23 04:05:58 < lovesegfault> so it's (child-bus-address, parent-bus-address, length)
07:11
<
clever >
so child-bus-address is 32bit, parent-bus-address is 64bit
07:12
<
clever >
and length is 32bits, because it uses the child's #size-cells
07:12
<
lovesegfault >
I see
07:15
<
lovesegfault >
ok on step 1?
07:16
<
clever >
find and parse the #address-cells, soc/#address-cells, and soc/#size-cells
07:17
orivej has quit [Ping timeout: 265 seconds]
07:18
quinn has quit [Ping timeout: 260 seconds]
07:19
<
clever >
you can just read it as a 4 byte buffer, and then parse as a big-endian u32
07:19
<
clever >
that should be easy in rust
07:20
* lovesegfault
goes check
07:20
<
lovesegfault >
it's nice
07:28
<
clever >
that says that #address-cells will always be u32
07:29
<
clever >
If missing, a client program should assume a default value of 2 for #address-cells, and a value of 1 for #size-cells.
07:30
* lovesegfault
reads
07:31
<
lovesegfault >
goddamn it's different
07:33
alp has quit [Remote host closed the connection]
07:34
alp has joined #nixos-aarch64
07:34
cole-h has quit [Quit: Goodbye]
07:42
<
lovesegfault >
clever: part 1 is done
07:42
<
clever >
now you need to read an array of 3 ints from the ranges file
07:43
<
lovesegfault >
ints = i32?
07:43
<
clever >
a child addr (soc/#size-cells says the size)
07:43
<
clever >
a parent addr (#address-cells says the size)
07:43
<
clever >
a child addr (soc/#address-cells says the size)
07:43
<
clever >
a parent addr (#address-cells says the size)
07:44
<
clever >
then a length, (soc/#size-cells says the size)
07:44
<
clever >
page 15 of the pdf
07:44
<
clever >
because the parent is 64bits, that would be a u32, u64, and u32
07:44
<
lovesegfault >
but that changes if the parent is 32bit
07:44
quinn has joined #nixos-aarch64
07:45
<
clever >
so you need to read a child addr, auto-detect how many bytes to consume, and increment your read pointer
07:45
<
clever >
then repeat
07:47
<
lovesegfault >
> auto-detect how many bytes to consume
07:47
<
{^_^} >
undefined variable 'auto-detect' at (string):324:1
07:48
<
clever >
if size is 1, read a u32, increment by 4
07:48
<
clever >
if size is 2, read a u64, increment by 8
07:49
<
clever >
each slot uses a different size
07:49
<
lovesegfault >
if size is 3 it's an alien computer
07:49
<
lovesegfault >
can I just return (u64, u64, u64)?
07:50
<
clever >
but also, its an array
07:50
<
clever >
the hexdump i see in bottom-right, is 3 sets of that
07:50
<
lovesegfault >
right
07:51
<
clever >
once youve parsed it, you need to go over the array, and check (between child-addr and child+length) to see which one contains 0x7e20_0000
07:51
aforemny has joined #nixos-aarch64
07:55
<
lovesegfault >
os is there a scenario where this thing is
_HUGE_
07:55
<
clever >
it will likely be small
07:55
<
clever >
i wouldnt expect it to even pass 1kb
07:56
<
lovesegfault >
alright, then I'm going to read_to_end into a vec of u8
07:57
<
clever >
oh, that gives me an idea
07:57
<
clever >
for (int i=0; i<(size*4); i++) { temp = (temp << 8) | buffer[pos++]; }
07:58
<
clever >
that will consume size*4 bytes, in big-endian order, and increment pos as it consumes
07:58
<
lovesegfault >
nice
08:02
<
lovesegfault >
eh, I think I'll do it like this
08:05
<
clever >
once your done parsing, can you print it as 3 lines of 3 hex numbers?
08:05
<
clever >
like, printf("0x%x 0x%x 0x%x
08:06
<
lovesegfault >
wait
08:07
<
lovesegfault >
the size of child_addr should come from soc/#address-cells
08:07
<
clever >
same for the size of the length field, soc/#size-cells
08:09
<
lovesegfault >
I'm diggin myself into a smol hole with these matches
08:17
<
clever >
lovesegfault: the take function may also be of use
08:17
<
clever >
lovesegfault: is there any function to turn a vector of 4 u8 into a u32?
08:17
<
lovesegfault >
in the stdlib no
08:17
<
lovesegfault >
you can do `BigEndian::read_u32` here though
08:17
<
lovesegfault >
b/c I have the crate
08:19
kiren has quit [Remote host closed the connection]
08:24
<
lovesegfault >
I want drain
08:28
<
lovesegfault >
aha!
08:28
<
lovesegfault >
clever: there we go
08:28
<
lovesegfault >
I think this is correct
08:28
<
lovesegfault >
it does some alloc nonsense, but ala
08:28
<
lovesegfault >
it does some alloc nonsense, but alas
08:28
<
clever >
give it a run thru the printf above, and lets see what the results are!
08:31
<
lovesegfault >
g.d. old rust
08:31
juliosueiras has quit [Ping timeout: 260 seconds]
08:33
<
lovesegfault >
1.46 is from a month ago...
08:34
<
clever >
i think you need some cleanSource
08:34
<
lovesegfault >
oh god
08:34
<
clever >
ah, just removing target would help a lot
08:34
<
lovesegfault >
boom
08:34
<
clever >
now it doesnt have to copy 400mb of junk
08:35
<
clever >
nix copy can take attrs
08:35
<
lovesegfault >
wait
08:35
<
lovesegfault >
wait
08:38
<
clever >
nix copy is like nix build, no -A
08:39
<
clever >
but it wants an attr
08:39
<
clever >
so your file must return a set
08:39
<
clever >
also, copy can take ./result
08:39
<
clever >
let me try typing something when its built
08:40
<
clever >
or just on irc...
08:40
<
clever >
nix copy --no-check-sigs --to ssh://ip ./result && ssh ip -t sudo $(realpath ./result)/bin/something
08:40
<
clever >
lovesegfault: try like that
08:41
<
clever >
i hate it when tab-completion expands exprs
08:42
<
lovesegfault >
lol it's preferring gpiomem
08:42
<
clever >
break the path
08:42
<
clever >
gpiomem-404
08:43
<
clever >
and stick a nix-build at the start of the previous cmd
08:44
<
clever >
now its just 1 step to test
08:44
<
lovesegfault >
no way
08:44
<
lovesegfault >
it works
08:44
<
clever >
0x7e00000000000000 is wrong
08:44
<
clever >
it should be 0x7e000000
08:44
<
lovesegfault >
it's padded to u64
08:44
<
clever >
the padding is on the wrong end
08:44
<
clever >
0x000000007e000000
08:44
<
lovesegfault >
ah, right, because I did it in little endian universe
08:45
<
clever >
and the host addr is also wrong
08:47
<
clever >
i think thats right?
08:48
* lovesegfault
is confused
08:50
<
clever >
size isnt right
08:50
<
lovesegfault >
right
08:50
<
clever >
why is that hard-coded to 2? lol
08:51
<
clever >
oh, the default
08:52
<
lovesegfault >
bingo
08:52
<
clever >
size-cells, not size_cells
08:53
<
clever >
i could tell that it was the size, because the host addr had 2 fields
08:53
<
clever >
so the read was mis-aligned
08:54
<
lovesegfault >
noice :D
08:54
<
clever >
now, you need to loop thru things, and check if 0x7e20_0000 is between child and child+length
08:54
<
clever >
until you find the right range in rangeS
08:54
<
clever >
or just assume 0x7e00 is always the start
08:56
<
clever >
add all 3 sizes, then *4
09:00
noneucat has left #nixos-aarch64 ["Kicked by @appservice-irc:matrix.org : Idle for 30+ days"]
09:03
<
clever >
once you find the right range, compute (0x7e20_0000 - child) + parent
09:03
<
clever >
and that will be the offset you should mmap from /dev/mem
09:04
<
clever >
and those are the ranges for all MMIO, any peripheral
09:04
<
clever >
0x7e20_0000 is the addr for gpio
09:05
<
lovesegfault >
let's try :D
09:05
<
clever >
hyperpixel_init-unknown> warning: unused import: `ReadBytesExt`
09:14
<
clever >
lovesegfault: does rust ignore the _ in the hex number? what does the && do to it?
09:14
<
lovesegfault >
it ignores _ yeah
09:14
<
lovesegfault >
&& is making it into a ref of a ref because the iterator is being wonky
09:14
<
clever >
we are looking for an instance where child < 0x7e20_0000 and (child+length) > 0x7e20_0000
09:21
<
clever >
filterSource can exclude target automatically
09:21
<
clever >
without having to rm it
09:21
<
lovesegfault >
ayoooo
09:21
<
clever >
> (4263510016).toString(16)
09:21
<
clever >
'fe200000'
09:21
<
{^_^} >
value is an integer while a set was expected, at (string):324:1
09:21
<
clever >
yep, looks right
09:22
<
clever >
just needs some hex encoding to save you some sanity
09:22
<
lovesegfault >
let's try it out
09:22
<
lovesegfault >
screen is off
09:23
<
lovesegfault >
SCREEN
09:23
<
lovesegfault >
ONNNNNN
09:23
<
lovesegfault >
will it blend?
09:23
<
clever >
and for your next challenge, the init sequence!!
09:24
* lovesegfault
dies
09:25
<
lovesegfault >
what's /dev/gpiochip0?
09:25
<
clever >
the linux api for accessing gpio, but it can only do plain gpio, no alt functions
09:25
<
clever >
you can either use the same api, or you can keep using raw MMIO
09:26
<
lovesegfault >
How does this look with raw mmio?
09:26
<
lovesegfault >
I'm already this deep into it
09:26
<
clever >
the same as youve done for FSEL
09:26
<
clever >
just ~4 more registers
09:27
<
clever >
first, we want to implement setup_pins
09:27
<
clever >
it should set the 3 pins to output mode, using the existing set_pin function
09:28
<
clever >
27, 26, and 18, in that order
09:29
<
clever >
next, we need to write a way to set gpio level
09:30
<
clever >
GPSETn and GPCLRn
09:30
<
clever >
#define GP_SET0 HW_REGISTER_RW( 0x7e20001c )
09:30
<
lovesegfault >
I see it
09:30
<
clever >
#define GP_CLR0 HW_REGISTER_RW( 0x7e200028 )
09:31
<
clever >
each is an array of 3 u32 registers
09:31
<
clever >
which then contains 32 bits each, for 32 pins
09:32
<
clever >
so pin/32 tells you which register, and pin%32 tells you which bit
09:32
<
lovesegfault >
so I want two methods: set_pin(pin) and clear_pin(pin)
09:32
<
clever >
you can also make it one function
09:32
<
clever >
just gpio_set_level(pin, level)
09:32
<
lovesegfault >
got it
09:32
<
clever >
if (level == 0) GPCLR, else GPSET
09:33
<
clever >
level can be a bool
09:33
<
clever >
true == high
09:33
<
clever >
reg and bit offset first
09:33
<
clever >
same as how the top of the screen does it, but with 32
09:34
<
clever >
1 bit per pin this time
09:34
<
lovesegfault >
got it
09:34
alp has quit [Ping timeout: 272 seconds]
09:35
<
clever >
next, u32 *foo; if (level) foo = GPSET; else foo = GPCLR;
09:35
<
clever >
then foo[register] = 1 << pin_shift;
09:36
<
clever >
GPSET and GPCLR being offsets into the mmap'd area
09:36
<
clever >
of +0x1c and +0x28
09:36
<
lovesegfault >
I see
09:37
<
clever >
ah, and page 95 answers a question you asked earlier
09:37
<
clever >
if you poke SET or CLR, it will take effect when the pin is set to output
09:37
<
lovesegfault >
cool
09:38
<
clever >
so now we need to decide between set or clear, based on level
09:39
<
clever >
lovesegfault: ok, now we offset into level, based on register
09:39
<
clever >
level is an array of 3 u32, and we have to volatile write to the right one
09:40
<
clever >
lovesegfault: does offset work in units of u32 or byte?
09:40
<
lovesegfault >
by sizeof(T)'s
09:41
<
clever >
and what is self.0's T?
09:41
<
lovesegfault >
so by u32's
09:41
<
clever >
then the 1c and 28 have to /4
09:42
<
clever >
ok, now pin_level is the addr of the exact reg we want
09:42
<
clever >
volatile write to that, with 1 << pin_shift
09:43
<
clever >
ok, next up
09:43
<
clever >
do you see the ,0 and ,1 in setup_pins?
09:43
<
clever >
* @param default_val Initial line value.
09:44
<
clever >
so you need to set clk and mosi to 0, and cs to 1, before you set them to output
09:44
<
clever >
a constant for clk, mosi, and cs may help
09:44
<
lovesegfault >
which is which?
09:47
<
clever >
and that is just 1 line of main()!
09:47
<
clever >
ok, now copy/paste that whole commands array over
09:49
<
clever >
ok, now we need to loop over each entry in there
09:49
<
clever >
if the entry if -1, we delay for WAIT usec and go to the next one
09:49
<
clever >
if its not -1, we pass it to write_9bit, but cast it to a u32
09:53
<
clever >
can just make the array i16's
09:54
<
lovesegfault >
is set_value == set_level?
09:54
alp has joined #nixos-aarch64
09:55
<
clever >
and those are pointers created when you reserved each pin
09:58
<
clever >
so the mask starts out at (1 << 8), which would be 0x100
09:58
<
clever >
the 1st big, in big-endian order
09:59
<
clever >
ah, that code looks a bit sloppy
09:59
<
clever >
they setup mask to select the right bit
09:59
<
clever >
then instead of moving the mask, they move the data, lol
10:00
<
clever >
and you still need the clock pin
10:00
<
clever >
yep, that should also work
10:01
<
clever >
now we pulse clock low for DELAY usec, then high for DELAY
10:01
<
clever >
100usec == 10khz i think?
10:02
<
clever >
but probably 5khz, because its 200usec per cycle, 100 low 100 high
10:02
<
lovesegfault >
right
10:02
<
clever >
and set mosi back to low when your done sending data
10:03
<
clever >
and if we did it right, that entirely replaces the init program
10:03
<
clever >
oh, but cleanup
10:03
<
lovesegfault >
that's all this did?
10:03
<
clever >
clk is on gpio27
10:03
<
clever >
but touch interrupt is also 27
10:04
<
clever >
we have to set clk/mosi/cs back to input when we are done
10:04
<
lovesegfault >
got it
10:04
<
clever >
i'm also curious
10:04
<
clever >
the screen is 800x480
10:04
<
clever >
thats 0x320 x 0x1e0
10:05
<
clever >
ehhh, nothing obvious in the commands
10:06
<
lovesegfault >
DISPLAY IS ON
10:06
<
lovesegfault >
HAHAHAHAHA
10:06
<
lovesegfault >
WE DID IT
10:07
<
clever >
now shove it all in github and call it done!
10:07
<
clever >
also, test it on the pi3 too :P
10:08
* lovesegfault
makes github repo
10:09
<
lovesegfault >
alright, it's on GH
10:09
<
lovesegfault >
for tomorrow:
10:09
<
lovesegfault >
1. clean up the code a bit
10:09
<
lovesegfault >
2. rpi3 test
10:09
<
lovesegfault >
3. shove it into nixpkgs :D
10:09
<
clever >
4: closure size??
10:10
<
lovesegfault >
it's smol
10:10
<
clever >
it depends on glibc, try building it with pkgsStatic
10:10
<
lovesegfault >
it explodes
10:10
<
clever >
38mb before
10:10
<
lovesegfault >
glibc ;-;
10:10
<
clever >
it exploded because of the broadcom libs
10:10
<
clever >
which we dont use anymore
10:12
<
clever >
you put a result symlink into the github repo
10:14
<
clever >
config.toml needs some musl stuff
10:18
<
lovesegfault >
oh, it's failing to build rustc for aarch64 musl
10:20
<
clever >
also, we are taking things to go levels of extreme :P
10:20
<
clever >
dont import anything, rewrite it all
10:20
<
lovesegfault >
I WANT IT STATIC
10:22
<
lovesegfault >
noooo
10:23
<
clever >
i think you need to turn off c++ exceptions?
10:23
<
clever >
to google!
10:24
<
clever >
oh, it might be libunwind
10:24
<
lovesegfault >
try it, I need to brush my teeth real quick
10:24
<
{^_^} >
rust-lang/rustup#2213 (by thedrow, 34 weeks ago, open): Rustup should warn if libgcc is not installed on Alpine
10:31
<
clever >
i see some of the issue, but not fully
10:31
<
clever >
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /nix/store/9lg5i8inybsgwsajzjk2s2214rfnbvsq-rust-aarch64-unknown-linux-musl/lib/librustc_driver-57cbb596dfda8c41.so)
10:31
<
clever >
lovesegfault: why are these .so files, we asked for static?
10:31
<
clever >
but theres more, let me show in the shell...
10:32
<
lovesegfault >
maybe naersk doesn't obey
10:32
<
clever >
ah wait, wheres libgcc_s ...
10:32
<
clever >
we have only a libgcc here
10:33
<
lovesegfault >
I think this is the root issue
10:34
<
clever >
there is still dynamic musl
10:34
<
clever >
> pkgsMusl.hello
10:34
<
{^_^} >
"<derivation /nix/store/a0xf5c8lr7nc745cnj8l432qwj765g47-hello-2.10.drv>"
10:38
<
aforemny >
Hi, I am trying to cross-compile xorg-server for aarch64. The build fails for me on current Nixpkgs master. I then searched Hydra and found that it built successful three days ago:
https://hydra.nixos.org/build/127668628 Is this a aarch64 native build?
10:40
<
clever >
aforemny: yeah, thats a native build
10:40
<
clever >
aforemny: the inputs tab tells you which nixpkgs rev it came from
10:40
<
lovesegfault >
clever: I gotta sleep :(
10:40
<
lovesegfault >
We'll find out if it works tomorrow :P
10:40
<
clever >
lovesegfault: can continue tomorrow
10:40
alp has quit [Ping timeout: 272 seconds]
10:40
<
lovesegfault >
Thanks again for all the help :)
10:41
<
lovesegfault >
it's been an a coding adventure :D
10:41
<
lovesegfault >
gnight!
10:59
alp has joined #nixos-aarch64
11:02
betaboon has joined #nixos-aarch64
11:03
Valodim has joined #nixos-aarch64
11:17
<
aforemny >
clever: Thanks! Are there any information channels that I should know that deal with cross-compiling for aarch64? I am checking Issues on GitHub, but things do not seem to be extremely active there.
11:18
<
clever >
aforemny: this irc channel is the main one i think
11:19
<
aforemny >
I am specifically trying to get my system configuration running on Pinebook Pro, thanks to the amazing samueldr/wip-pinebook-pro. I have read people running some kind of system which I presume includes a working xorg. So I guess they compile things natively.. maybe I should go that route for now as well.
11:19
<
clever >
aforemny: i believe mobile-nixos uses a cross-compiled stage1 (kernel+initrd) but a natively build stage2 (everything in the rootfs)
11:20
<
clever >
aforemny: and can boot to a full desktop env
11:21
<
aforemny >
clever: I guess it makes sense to rent a aarch64 EC2 instance for now and compile the system natively. I think I will try that next. Thanks for the information! :)
11:21
<
clever >
aforemny: you can also use something like an rpi3 or rpi4 as a build system too
11:22
<
aforemny >
clever: Good idea! But I don't have one lying around and I want to use my Pinebook with NixOS ASAP ;-D
11:44
noonien has joined #nixos-aarch64
12:08
orivej has joined #nixos-aarch64
12:18
<
srk >
I'm wondering why nixos-rebuild --build-host localhost --target-host rpi switch tries to rebuild the whole world when nix-build -A config.system.build.sdImage was done previously. with nixpkgs.crossSystem
12:19
<
clever >
srk: run nix-diff on the 2 drv files, what differs?
12:20
<
srk >
hmm, good idea
12:25
<
srk >
• The platforms do not match
12:25
<
srk >
- x86_64-linux
12:25
<
srk >
+ armv7l-linux
12:26
<
srk >
first one is from nix-build, second from nixos-rebuild, weird
12:27
<
clever >
srk: the 2nd one is a native arm->arm build, the 1st is cross
12:27
<
clever >
cross and native cant share products
12:27
<
clever >
to make nixos-rebuild cross compile, you have to set nixpkgs.crossSystem
12:28
<
srk >
yup, that's set for both builds
12:28
<
srk >
setting localSystem fixes it
12:43
<
srk >
btw binary ghc8.10.2 works on armv7l
12:44
<
srk >
You are using an unsupported version of LLVM!
12:44
<
srk >
We will try though...
12:44
<
srk >
Currently only 9 is supported. System LLVM version: 10.0.1
12:44
<
srk >
... which is nice :D
12:44
<
srk >
also unhappy about 'libtinfo.so.6: no version information available' but I've managed to compile xmonad with it
12:49
<
srk >
now I wonder if it can be used to bootstrap itself or one of the older ghcs
12:54
alp has quit [Ping timeout: 272 seconds]
13:07
zupo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
13:38
alp has joined #nixos-aarch64
14:06
orivej has quit [Ping timeout: 272 seconds]
14:08
<
clever >
lovesegfault: this claims that its doing i2c over gpio 2/3, possibly for the touchscreen, and also the i2c header on the back
14:08
<
clever >
lovesegfault: my gut, says that the rpi firmware cant not-configure 2/3 as vsync/hsync, so they are instead disabled (causing them to just idle high i think), and then something else forces them into i2c mode later
14:12
aforemny has quit [Ping timeout: 258 seconds]
14:35
evax has quit [Ping timeout: 272 seconds]
14:35
Darkmatter66 has joined #nixos-aarch64
14:35
evax has joined #nixos-aarch64
14:38
Darkmatter66_ has quit [Ping timeout: 256 seconds]
14:44
zupo has joined #nixos-aarch64
14:54
aforemny has joined #nixos-aarch64
15:07
aforemny has quit [Read error: Connection reset by peer]
15:46
kloenk has quit [Quit: WeeChat 2.9]
16:00
juliosueiras has joined #nixos-aarch64
16:08
juliosueiras has quit [Ping timeout: 258 seconds]
16:09
kahiru has quit [Ping timeout: 272 seconds]
16:09
kahiru has joined #nixos-aarch64
16:42
justanotheruser has joined #nixos-aarch64
16:46
NinjaTrappeur has quit [Quit: WeeChat 2.8]
17:16
rajivr has quit [Quit: Connection closed for inactivity]
17:29
orivej has joined #nixos-aarch64
17:35
alp has quit [Ping timeout: 272 seconds]
17:42
cole-h has joined #nixos-aarch64
18:04
juliosueiras has joined #nixos-aarch64
18:15
<
lovesegfault >
clever: Oh, interesting!
18:19
<
clever >
lovesegfault: if you enable arm i2c (check the config.txt docs), and then setup the overlay right in uboot as well (since it undoes the enable), then edit the rust code to put gpio 2/3 into alt0 mode, you might see the touch controller with i2cdetect -y
18:21
<
lovesegfault >
Nice, I'll try that today
18:21
<
lovesegfault >
just kicked off the musl build
18:22
<
lovesegfault >
before I go get my haircut, maybe it'll be done when I'm back :D
18:27
superherointj has joined #nixos-aarch64
18:28
aforemny has joined #nixos-aarch64
18:38
superherointj has quit [Quit: Leaving]
19:09
bennofs_ has joined #nixos-aarch64
19:12
bennofs has quit [Ping timeout: 240 seconds]
19:19
aforemny has quit [Ping timeout: 272 seconds]
19:20
aforemny has joined #nixos-aarch64
19:30
alp has joined #nixos-aarch64
20:49
taktoa[c] has quit [Ping timeout: 244 seconds]
20:49
elvishjerricco has quit [Ping timeout: 244 seconds]
20:50
blackriversoftwa has quit [Ping timeout: 244 seconds]
20:50
NekomimiScience has quit [Ping timeout: 260 seconds]
20:50
cstrahan has quit [Ping timeout: 244 seconds]
20:50
chessai has quit [Ping timeout: 240 seconds]
20:51
chessai has joined #nixos-aarch64
20:51
angerman has quit [Ping timeout: 260 seconds]
20:52
cstrahan has joined #nixos-aarch64
20:52
elvishjerricco has joined #nixos-aarch64
20:53
angerman has joined #nixos-aarch64
20:53
NekomimiScience has joined #nixos-aarch64
20:53
blackriversoftwa has joined #nixos-aarch64
20:53
taktoa[c] has joined #nixos-aarch64
21:02
zupo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:55
lafa has quit [Remote host closed the connection]
21:56
jackdk has quit [Ping timeout: 260 seconds]
21:58
jackdk has joined #nixos-aarch64
22:03
blackriversoftwa has quit [Ping timeout: 258 seconds]
22:04
blackriversoftwa has joined #nixos-aarch64
22:15
<
lovesegfault >
clever: coreutils fails to build :(
22:40
Acou_Bass has quit [Ping timeout: 240 seconds]
22:45
Acou_Bass has joined #nixos-aarch64
22:49
Acou_Bass has quit [Ping timeout: 260 seconds]
22:50
feepo has quit [Ping timeout: 244 seconds]
22:50
prusnak has quit [Ping timeout: 244 seconds]
22:50
davidtwco has quit [Ping timeout: 244 seconds]
22:50
c00w has quit [Ping timeout: 240 seconds]
22:50
NekomimiScience has quit [Ping timeout: 240 seconds]
22:50
chessai has quit [Ping timeout: 240 seconds]
22:50
alunduil has quit [Ping timeout: 240 seconds]
22:51
TheNumb has quit [Ping timeout: 260 seconds]
22:51
cstrahan has quit [Ping timeout: 260 seconds]
22:51
angerman has quit [Ping timeout: 260 seconds]
22:52
jackdk has quit [Ping timeout: 272 seconds]
22:52
elvishjerricco has quit [Ping timeout: 272 seconds]
22:52
noonien has quit [Ping timeout: 272 seconds]
22:52
c00w has joined #nixos-aarch64
22:52
prusnak has joined #nixos-aarch64
22:52
angerman has joined #nixos-aarch64
22:52
blackriversoftwa has quit [Ping timeout: 272 seconds]
22:54
blackriversoftwa has joined #nixos-aarch64
22:54
TheNumb has joined #nixos-aarch64
22:54
noonien has joined #nixos-aarch64
22:54
feepo has joined #nixos-aarch64
22:54
chessai has joined #nixos-aarch64
22:55
cstrahan has joined #nixos-aarch64
22:55
elvishjerricco has joined #nixos-aarch64
22:55
alunduil has joined #nixos-aarch64
22:55
NekomimiScience has joined #nixos-aarch64
22:56
jackdk has joined #nixos-aarch64
22:57
davidtwco has joined #nixos-aarch64
23:04
Acou_Bass has joined #nixos-aarch64
23:13
zupo has joined #nixos-aarch64
23:29
orivej has quit [Ping timeout: 240 seconds]
23:53
Thra11 has quit [Quit: WeeChat 2.9]
23:55
mla has joined #nixos-aarch64