03:06
jcea has quit [Remote host closed the connection]
03:20
bonda_000 has joined ##raspberrypi-internals
03:20
<
bonda_000 >
good morning
03:48
CompanionCube has joined ##raspberrypi-internals
04:07
jn has joined ##raspberrypi-internals
04:07
jn has joined ##raspberrypi-internals
04:07
jn has quit [Changing host]
04:42
jn has quit [Ping timeout: 256 seconds]
04:42
jn_ has joined ##raspberrypi-internals
04:42
jn_ has quit [Changing host]
04:42
jn_ has joined ##raspberrypi-internals
04:47
jn has joined ##raspberrypi-internals
04:47
jn has quit [Changing host]
04:47
jn has joined ##raspberrypi-internals
04:47
jn_ has quit [Ping timeout: 255 seconds]
06:36
<
bonda_000 >
so on Rhea
06:37
<
bonda_000 >
where we pull our ISP register definitions from
06:37
<
bonda_000 >
internal SRAM size is 0xC000
07:47
jn has quit [Ping timeout: 256 seconds]
07:47
jn_ has joined ##raspberrypi-internals
07:47
jn_ has quit [Changing host]
07:47
jn_ has joined ##raspberrypi-internals
08:54
<
bonda_000 >
try this
08:57
<
bonda_000 >
@clever
08:58
<
bonda_000 >
becomes
09:25
bonda_000 has quit [Ping timeout: 268 seconds]
09:35
bonda_000 has joined ##raspberrypi-internals
09:39
<
clever >
bonda_000: oh, that could work...
09:41
<
clever >
bonda_000: kinda works, but you need to do that on every function
09:42
<
clever >
and it doesnt generate an XREF
09:42
<
bonda_000 >
idk maybe you can ctrl+A the entire code section
09:42
<
bonda_000 >
I've searched gp is only loaded once at the entry
09:43
<
bonda_000 >
but yeah Minix idea I may think of it a bit more later when the camera thing is done
09:43
<
bonda_000 >
I realized it can't Segfault without MMU/MPU so it's a very iffy OS that would be
09:43
<
clever >
it does have a MPU
09:44
<
bonda_000 >
if a program can overwrite its own code section or other program's
09:44
<
bonda_000 >
does it?
09:45
<
clever >
you can define a couple start/end ranges
09:45
<
clever >
and i think once you switch to user mode, those take effect
09:45
<
clever >
and stepping out of bounds will fault
09:46
<
bonda_000 >
so then you always run your programs from the L1&L2 cached alias?
09:46
<
clever >
if the sandbox registers say so, yes
09:47
<
clever >
it can also keep one program from messing with the code of another
09:47
<
bonda_000 >
oh then it's not that bad. I was thinking of using linked list of sorts of pages instead of a table that MMU provides
09:49
<
bonda_000 >
like a linked list of big pages, linked list of medium pages, a linked list of small pages. If a program tries to use memory than it's current page I relocate it to a bigger page or merge but mergers seem to be a puzzle
09:49
<
bonda_000 >
to use more memory*
09:50
<
bonda_000 >
I tried in vc4 assembly. this is what happens when I allocate an array of 1 million ints
09:53
<
bonda_000 >
it increments sp and there must be a way to catch if it goes past the data/memory line
09:53
<
bonda_000 >
decrements*
09:53
<
bonda_000 >
my bad let me add c source
09:53
<
clever >
that looks like its allocating on the stack
09:53
<
clever >
and its 4mb i think?
09:54
<
clever >
and you rarely have that much room in the stack, so thats a stack overflow
09:54
<
bonda_000 >
try refresh the page again
09:54
<
bonda_000 >
i added the c source and the disassembly is under it
09:54
<
clever >
yep, thats what i guessed the code was
09:55
<
bonda_000 >
is that what MPU can also prevent from happening?
09:55
<
clever >
an MMU has the same problem
09:55
<
clever >
linux has a guard page at the end of the stack
09:56
<
clever >
and if you overflow the stack by a few bytes, the exception just automatically extends the stack
09:56
<
clever >
but if you overflow by 4mb, you can skip that guard page entirely, and land in some other memory your allowed to access
09:57
<
clever >
i forget the flag, but there is a thing in gcc that makes it read 1 byte out of every 4kb (page size), for that whole 4mb allocation
09:57
<
clever >
so it will hit the guard page on the way down
09:58
<
bonda_000 >
wait isnt every program supposed to have its own stack rather than one big stack for all running programs?
09:58
<
clever >
every thread has its own stack
10:24
f_ has joined ##raspberrypi-internals
10:35
<
bonda_000 >
so the SANDBOX thing means we can have 7 protected regions?
10:36
<
clever >
i think its a whitelist, so 7 areas are allowed, and all others are blocked/protected
10:46
<
bonda_000 >
so basically with 2 cores running I should use two of these
10:47
<
bonda_000 >
in an OS.
10:48
<
bonda_000 >
every time core switches tasks should update its whitelisted start and end addresses
11:44
<
bonda_000 >
any significance to r29 that you noticed?
11:44
<
bonda_000 >
undefined4 _tx_event_flags_create(uint *param_1)
11:45
<
bonda_000 >
has unaff_r29 this time
11:45
<
bonda_000 >
and all the thread event functions refer to this unaff_r29
12:10
bonda_000 has quit [Ping timeout: 264 seconds]
12:49
bonda_000 has joined ##raspberrypi-internals
12:50
<
clever >
the compiler leaves that register alone, so the kernel is then free to store info about the current thread in there
12:50
<
clever >
so when a call comes in later, the kernel knows which thread is making the call
12:51
<
bonda_000 >
I wonder if that's a struct somewhere
12:51
<
bonda_000 >
I don't think I've seen a single struct so far
12:53
<
clever >
bonda_000: ghidra doesnt understand the debug info for structs, so you need to make every struct by hand
14:14
bonda_000 has quit [Ping timeout: 268 seconds]
14:44
bonda_000 has joined ##raspberrypi-internals
15:11
dolphinana has joined ##raspberrypi-internals
15:16
f_ has joined ##raspberrypi-internals
16:01
jn_ has quit [Ping timeout: 245 seconds]
16:01
jn has joined ##raspberrypi-internals
16:01
jn has joined ##raspberrypi-internals
16:01
jn has quit [Changing host]
16:04
<
dolphinana >
hi clever! o/
16:05
<
dolphinana >
I'd like to boot Linux kernel on my RPi 2 with lk-overlay
16:06
<
clever >
dolphinana: start with `make PROJECT=vc4-stage1`, rename lk.bin to bootcode.bin and drop it on a fat partition
16:06
jcea has joined ##raspberrypi-internals
16:06
<
clever >
dolphinana: then `make PROJECT=vc4-stage2`, take the lk.elf, and put it in /boot of an ext4 partition, it must be the 2nd partition on the card
16:06
jn has quit [Ping timeout: 240 seconds]
16:06
jn has joined ##raspberrypi-internals
16:06
jn has quit [Changing host]
16:06
jn has joined ##raspberrypi-internals
16:06
<
clever >
oh, and you may need to make some of the rpi-test projects, the errors will point them out
16:07
<
clever >
that will then try to load rpi2.dtb, zImage-v7, cmdline.txt, and initrd, all from /boot on the ext4 volume
16:08
<
clever >
and from there, its just normal linux stuff
16:09
<
bonda_000 >
you can read some logs I saved
16:09
<
bonda_000 >
we went through the process
16:09
<
dolphinana >
thanks clever, I'll try this...
16:10
<
dolphinana >
bonda_000, I'm sure I can read the archived logs
16:10
<
clever >
dolphinana: i can help if you get stuck somewhere along that process
16:10
<
dolphinana >
yeah ^^
16:10
<
clever >
dolphinana: the bootcode.bin part must be on sd for a pi2, but the lk.elf and /boot could be on usb if you want
16:12
Miyu has joined ##raspberrypi-internals
16:13
<
bonda_000 >
be back soon
16:14
hackkitten has quit [Ping timeout: 268 seconds]
16:14
Miyu is now known as hackkitten
16:37
bonda_000 has quit [Ping timeout: 245 seconds]
16:50
jn has quit [Ping timeout: 246 seconds]
16:51
jn has joined ##raspberrypi-internals
16:51
jn has joined ##raspberrypi-internals
16:51
jn has quit [Changing host]
17:19
jn has quit [Ping timeout: 256 seconds]
17:19
jn has joined ##raspberrypi-internals
17:19
jn has joined ##raspberrypi-internals
17:19
jn has quit [Changing host]
17:51
jn has quit [Ping timeout: 256 seconds]
17:51
jn has joined ##raspberrypi-internals
17:51
jn has quit [Changing host]
17:51
jn has joined ##raspberrypi-internals
18:14
<
dolphinana >
clever, how do I deal with rpi-test projects?
18:15
<
clever >
dolphinana: `make PROJECT=rpi2-test` for example
18:15
<
clever >
the name will be in the error msg
18:15
<
dolphinana >
I did that
18:15
<
clever >
and then try vc4-stage2 again
18:16
<
dolphinana >
hmm... it seems like I have commented out that MODULES += platform/bcm28xx/arm in vc4-stage2.mk
18:17
<
clever >
youll want to uncomment that
18:17
<
dolphinana >
yeah, exactly what I was thinking...
18:18
<
dolphinana >
okay, now I'm getting errors about rpi1-test not being found
18:18
<
clever >
yep, `make PROJECT=rpi1-test` as well
18:18
<
dolphinana >
rpi1-test compiled successfully
18:19
<
dolphinana >
now it wants rpi3-test
18:19
<
clever >
yep, just make that one as well
18:19
<
dolphinana >
aaand I don't have aarch64-elf-gcc...
18:19
<
dolphinana >
leme see if I can install it...
18:19
<
clever >
you can use mkdir and touch to create a 0 byte .bin file at the right path
18:19
<
clever >
that will fool things into going forward, it just wont work on a pi3
18:20
<
clever >
the 3 rpi-test builds, are each tailored to a different pi model
18:20
<
clever >
and at runtime, it will check which one you have, and copy the right one to the reset vector
18:20
<
dolphinana >
I don't have RPi 3 anyway so rpi3-test doesn't matter to me...
18:21
<
clever >
[nix-shell:~/apps/rpi/lk-overlay]$ touch build-rpi3-test/lk.bin
18:21
<
clever >
that should do the job then
18:22
<
dolphinana >
I did that...
18:22
<
dolphinana >
and then trying to compile vc4-stage2 again yields another error
18:23
<
dolphinana >
latform/bcm28xx/arm/payload.S: Assembler messages:
18:23
<
dolphinana >
platform/bcm28xx/arm/payload.S:5: Error: file not found: ../../../build-rpi1-test/lk.bin
18:23
<
dolphinana >
platform/bcm28xx/arm/payload.S:9: Error: file not found: ../../../build-rpi2-test/lk.bin
18:23
<
dolphinana >
make[1]:
*** [make/compile.mk:76: build-vc4-stage2/platform/bcm28xx/arm/payload.S.o] Error 1
18:23
<
dolphinana >
platform/bcm28xx/arm/payload.S:13: Error: file not found: ../../../build-rpi3-test/lk.bin
18:23
<
dolphinana >
make[1]: Leaving directory '/home/johannes/code/lk-overlay'
18:23
<
dolphinana >
make:
*** [makefile:34: _top] Error 2
18:23
<
dolphinana >
clever
18:23
<
clever >
what does `ls` return?
18:24
<
dolphinana >
johannes@e6430:~/code/lk-overlay$ ls
18:24
<
dolphinana >
COPYING arch build-rpi3-test default.nix external librerpi-with-text.png lk.nix 'opcode speeds' release.nix
18:24
<
dolphinana >
app build-rpi2-test build-vc4-stage2 docs lib lk makefile project target
18:24
<
dolphinana >
README.md build-rpi1-test build-vc4-stage1 dev flake.nix librerpi-without-text.png lk_inc.mk platform shell.nix
18:24
<
clever >
that should have worked...
18:25
<
clever >
try going into payload.S, and remove the ../../../ from one, and see if that changes anything?
18:27
<
dolphinana >
I did that and now I can compile vc4-stage2 with arm module successfully!
18:27
<
clever >
sounds like your .incbin search path is just being weird, its behaving differently from mine
18:27
<
clever >
now you can copy that stage2 lk.elf to an ext4 partition on an SD card, it should be in /boot/lk.elf
18:28
<
clever >
and the ext4 should be p2
18:28
<
dolphinana >
where's the .incbin ?
18:28
<
clever >
in payload.S, the lines you edited
18:30
<
dolphinana >
ah, I see
18:33
<
dolphinana >
okay...
18:33
<
dolphinana >
I got librerpi with arm init running... and....
18:33
<
dolphinana >
SP: 0x800420a0
18:33
<
dolphinana >
6.313775 [LOADER:try_to_boot:149]: trying to boot from sdhostp1
18:33
<
dolphinana >
6.307089 [LOADER:add_boot_target:82]: considering sdhostp1 as boot target
18:33
<
dolphinana >
s_log_groups_per_flex: 4
18:33
<
dolphinana >
group descriptors: 0x80042118
18:33
<
dolphinana >
starting app shell
18:33
<
dolphinana >
entering main console loop
18:33
<
dolphinana >
] SP: 0x80042048
18:33
<
dolphinana >
dtb: rpi2.dtb, kernel: zImage-v7
18:33
<
dolphinana >
6.687083 [LOADER:map_physical:236]: map_physical(0x1000000, 0x8002c40c, 33554432, zImage)
18:33
<
dolphinana >
6.695165 [LOADER:map_physical:238]: done
18:33
<
dolphinana >
failed to open /root/boot/zImage-v7: -1
18:33
<
dolphinana >
failed to read kernel file
18:34
<
dolphinana >
I guess I'll have to do some file management..
18:34
<
clever >
yep, stage1, stage2, and rpi2-test all worked fully
18:34
<
clever >
now you just need a zImage-v7 in the /boot
18:35
<
dolphinana >
hmm... I found vmlinux* files in the /boot directory...
18:35
<
dolphinana >
can I simply rename it to "zImage-v7"?
18:35
<
clever >
if it was build for the pi2, sure
18:35
<
dolphinana >
(well, i'd actually copy it)
18:42
<
dolphinana >
hmm...
18:42
<
dolphinana >
where do I need the dtb file?
18:42
<
dolphinana >
does it also need to be in the /boot in ext partition?
18:43
<
dolphinana >
ah, I see..
18:50
<
dolphinana >
okay, now I'll need initrd
18:54
bonda_000 has joined ##raspberrypi-internals
18:54
<
bonda_000 >
Yo I'm back
18:55
<
dolphinana >
welcome back bonda_000 ^^
18:57
<
dolphinana >
hmm... still unable to get Linux booting...
18:58
<
dolphinana >
clever: I get the following error:
18:58
<
dolphinana >
ERROR: fdt_open_into() == -3
19:01
<
bonda_000 >
is your host machine Linux?
19:02
<
bonda_000 >
you can boot from Ethernet cable if you have a spare one at home
19:02
<
dolphinana >
bonda_000, yes, I'm running GNU/Linux
19:02
<
bonda_000 >
which one exactly
19:02
<
bonda_000 >
What kind
19:02
<
dolphinana >
bonda_000, booting from ethernet cable would be great, I'm thinking about doing it one day...
19:03
<
bonda_000 >
it's easier you just need to set up two config files and not strain your sd card slot
19:04
<
bonda_000 >
Starting TFTP / DHCP for bootcode.bin
19:04
<
bonda_000 >
`nmtui` Activate a connection enp2s0
19:04
<
bonda_000 >
`sudo journalctl -f` to see what's going on
19:04
<
bonda_000 >
`/etc/init.d/xinetd start`
19:04
<
bonda_000 >
`sudo service isr-dhcp-server start`
19:04
<
dolphinana >
bonda_000, I'm running PureOS, which is free from proprietary software.
19:05
<
dolphinana >
bonda_000, what are you running on your host machine?
19:05
<
dolphinana >
ah, I see
19:05
<
dolphinana >
I've used Debian at some point (plus PureOS is based on Debian so I'm technically using Debian :P)
19:05
<
clever >
dolphinana: you also need rpi2.dtb
19:06
<
dolphinana >
I have rpi2.dtb in the /boot directory of the ext4 partition
19:06
<
dolphinana >
clever, oooh, I need this particular one?
19:06
<
clever >
yeah, the official dtb wont work
19:06
<
bonda_000 >
nmtui (Network manager) dhcp and xinetd may have different name for you but same usage
19:06
<
clever >
the official one tells linux to talk to the firmware over things i dont implement
19:06
<
clever >
and enables hw i dont support
19:07
<
dolphinana >
but clever, that file is called rpi2.dts not rpi2.dtb?
19:07
<
clever >
dolphinana: the dts has to be compiled, using the dtc command
19:07
<
clever >
i linked to the shell code i use for that
19:07
<
dolphinana >
ah, I see...
19:13
<
bonda_000 >
<clever> you can also use the nix package manager to automate building everything
19:13
<
bonda_000 >
<clever> if your on linux, it should be as simple as these 2 commands:
19:13
<
bonda_000 >
<clever> [clever@amd-nixos:~/apps/rpi/lk-overlay]$ nix-shell
19:13
<
bonda_000 >
<clever> [nix-shell:~/apps/rpi/lk-overlay]$ make PROJECT=rpi3-bootcode
19:13
<
bonda_000 >
<clever> [nix-shell:~/apps/rpi/lk-overlay]$ ls -lhs build-rpi3-bootcode/lk.bin
19:15
<
bonda_000 >
lk.bin is the bootcode.bin to run
19:16
<
bonda_000 >
I didn't need any dtb/dts in fact over Ethernet it only eats this one file
19:16
<
clever >
bonda_000: the dtb file is only needed when starting linux
19:17
<
bonda_000 >
yeah for Raspbian
19:17
<
dolphinana >
bonda_000, I personally prefer just doing things manually
19:17
<
dolphinana >
but thanks for advice
19:22
f_ has quit [Ping timeout: 260 seconds]
19:27
<
dolphinana >
hmm...
19:27
<
dolphinana >
I got quite close now... but...
19:27
<
dolphinana >
nothing happened after the following line:
19:27
<
dolphinana >
> core 0 passing control off to linux!!!
19:28
<
dolphinana >
also this: kernel cmdline is: console=serial0,115200 console=tty1 root=PARTUUID=a59b06ee-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
19:28
<
clever >
dolphinana: can help debug that more when i'm not distracted, will be about 20mins
19:28
<
dolphinana >
hmm... okay
19:30
<
dolphinana >
clever, good luck with whatever you're doing ^^
19:31
<
clever >
my old notes on debugging all of that
19:32
<
dolphinana >
thanks clever
19:33
<
clever >
arch/arm/Kconfig.debug: config DEBUG_BCM2836
19:34
<
clever >
dolphinana: to start with, try building linux with that flag enabled
19:35
<
clever >
dolphinana: ah found it, this is the last .config i had, that was known good
19:50
<
bonda_000 >
any ideas why this happens? I'm trying to see my bootenv via hermanhermitage/dumpbootenv
19:51
<
clever >
bonda_000: what baud rate are you set to?
19:51
<
bonda_000 >
same as for lk
19:51
<
bonda_000 >
huh maybe it's different config there let me check
19:52
<
clever >
your better off just modifying LK to save that data for you
19:52
<
bonda_000 >
what do you use? 115200 baud no parity 1 stop bit?
19:53
<
clever >
bonda_000: this is the entry-point, you just to allocate some memory from C, and then write to it from here
19:53
<
bonda_000 >
lk prints normally still
19:54
<
bonda_000 >
might do that then
20:02
<
bonda_000 >
it's the start bit I think
20:03
<
clever >
bonda_000: do you have access to a scope or logic analyzer?
20:04
<
clever >
try measuring the tx pin and see what it looks like
20:04
<
bonda_000 >
well lk still works so
20:04
<
bonda_000 >
its that miniuart not configured like yours
20:04
<
clever >
it might be some issues with the baud rate settings
20:07
<
bonda_000 >
yeah although through putty it worked fine
20:07
<
bonda_000 >
might be minicom and however COM driver here works
20:07
<
bonda_000 >
try one more time and do it through the lk
20:09
<
bonda_000 >
how do I put in a text file?
20:09
<
bonda_000 >
whatever comes in a minicom
20:09
<
clever >
[root@amd-nixos:~]# minicom -D /dev/ttyACM0 -b 115200 -o -C uart.log
20:13
<
bonda_000 >
maybe it's the -b
20:13
<
bonda_000 >
that I forgot
20:13
<
clever >
that would do it
20:13
<
clever >
it does show the baud rate at the bottom of the window
20:14
<
bonda_000 >
CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.8 | VT102 | Offline | ttyUSB0
20:14
<
clever >
yep, that says 115200
20:16
<
bonda_000 >
flow control didn't help either
20:19
<
clever >
gotta run for a bit, may not be back until tomorrow
20:20
<
bonda_000 >
I see a lot of 9's
20:20
<
bonda_000 >
in the %!xxd
20:44
<
bonda_000 >
I guess that may be the program_usb_boot_mode messed up the clock
20:56
<
bonda_000 >
yeah not the perfect result but at least readable now. I guess the system clock has changed with the USB/Ethernet boot option
21:05
<
bonda_000 >
HA DUDE
21:06
<
bonda_000 >
I had two minicoms open it totally ripped apart the outputs
21:18
<
dolphinana >
bonda_000, heh, how silly x3
21:56
<
dolphinana >
compiling the kernel...
23:09
<
bonda_000 >
good night
23:09
bonda_000 has quit [Remote host closed the connection]
23:16
<
dolphinana >
goodnight bonda ^^
23:23
<
clever >
dolphinana: any progress building linux?
23:32
<
dolphinana >
clever, yeah... it seems like I built vmlinuz, which is probably not something I want...?
23:32
<
dolphinana >
I'm quite inexperienced with building Linux...
23:32
<
clever >
dolphinana: look in arch/arm/boot
23:32
<
clever >
[clever@amd-nixos:~/apps/linux]$ ls -ltrh rv32/arch/riscv/boot/
23:32
<
clever >
total 3.5M
23:32
<
clever >
-rwxr-xr-x 1 clever users 6.5M May 2 11:58 Image
23:32
<
dolphinana >
oooh...
23:32
<
clever >
thats where linux dumps the final binary
23:32
<
dolphinana >
I found Image and zImage
23:32
<
clever >
you want the zImage, add a -v7 on the end, and toss it onto the SD
23:33
<
clever >
the vmlinux is an elf file, mainly for debug stuff
23:33
<
dolphinana >
mhm...
23:33
<
dolphinana >
I'll try it now before I go sleep...
23:38
<
dolphinana >
hmmm...
23:38
<
dolphinana >
clever, nothing happens after "core 0 passing control off to linux!!!"
23:39
<
dolphinana >
at least I don't see anything happening...
23:39
<
dolphinana >
does the kernel cmdline look correct?
23:39
<
dolphinana >
"kernel cmdline is: console=serial0,115200 console=tty1 root=PARTUUID=a59b06ee-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles"
23:39
<
clever >
dolphinana: try with console=ttyAMA0,115200
23:41
<
dolphinana >
should I modify the cmdline.txt in /boot at ext4 partition?
23:42
<
dolphinana >
okay, I just did that...
23:42
<
dolphinana >
still nothing happening
23:42
<
clever >
probably needs some more earlycon, one minute
23:43
<
dolphinana >
(btw, I made my own kernel build config, with CONFIG_DEBUG_BCM2736=y)
23:43
<
dolphinana >
clever, sure
23:44
<
clever >
try something like this? earlycon=pl011,0xf0201000 or earlycon=pl011,0x3f201000
23:44
<
clever >
not sure which one is right, only try one at a time
23:49
<
dolphinana >
seems like earlycon=pl011,0xf0201000 didn't do anything...
23:49
<
dolphinana >
let me try the latter one
23:51
<
dolphinana >
OH MY GOSH
23:51
<
clever >
dolphinana: got a pastebin of it all?
23:53
<
dolphinana >
I'm really excited, seeing some text output from linux from librerpi!
23:53
<
dolphinana >
Even if it fails to boot.
23:54
<
dolphinana >
wait a min, I'll provide a pastebin...