![]() |
![]() |
#1 |
Registered User
![]() Join Date: Mar 2023
Location: London / UK
Posts: 5
|
AmigaOS 3.2 kickstart ROM crashing with NetBSD boot blocks
When 3.2 kickstart ROM sees a disk with a NetBSD boot block it crashes as in the attached image. 3.1 seems fine.
Apparently its related to a rom component which scans all drives for updated modules, and then crashes on a NetBSD partition. Does anyone have any more insight into what is happening, and/or any thoughts on if something could be tweaked on the NetBSD side to avoid triggering this issue? (if someone has ideas I can push them back in on the NetBSD side ![]() Thanks David ![]() |
![]() |
![]() |
#2 |
Registered User
![]() Join Date: Mar 2023
Location: London / UK
Posts: 5
|
Alternatively - does anyone have permission to open a thread in https://forum.hyperion-entertainment...forum.php?f=62 to feed back there?
![]() |
![]() |
![]() |
#3 |
WinUAE 4000/40, V4SA
![]() Join Date: Apr 2020
Location: East of Oshawa
Posts: 538
|
I think enough of the 3.2 dev team hangs out here that a thread on the Hyperion boards isn't needed.
|
![]() |
![]() |
#4 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 2,525
|
This alert is not generated by any of the kickstart components. It does not look as if it is even allocated or formatted correctly. For interpreting alert codes, please see exec/alerts.h.
Thus, I would instead assume that this alert is generated by the NetBSD boot code (probably by someone not aware of proper alert code allocation), and would check there why exactly it is thrown. |
![]() |
![]() |
#5 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
According to this site:
https://wiki.amigaos.net/wiki/Unders...bers#BootStrap 0x30000001 Recoverable Boot code returned an error It's generated by "bootstrap" and caused by the boot code returning an error. So while it's indeed the boot code causes this, the alert is surely generated outside the boot code itself, as the NetBSD boot code never calls exec.library/Alert(). Now, looking at the early startup of the NetBSD boot code, it makes some assumptions about register and stack layout at the point the boot code is called. Then goes ahead, and uses these to call various OS calls, among others a memory allocation and some IO stuff. If either of these fails, the boot block returns with an error code. I guess if KS3.2.x no longer fulfills the stack/register layout expectations of the boot code, on entry, this might cause the issue. But of course this is entirely a speculation. |
![]() |
![]() |
#6 | |
Registered User
![]() Join Date: Mar 2023
Location: London / UK
Posts: 5
|
Adjusting NetBSD boot blocks
Quote:
Excellent - so its most likely fixable by "just" updating the NetBSD boot code (which is built as a "normal" NetBSD binary using a set of stubs: https://nxr.netbsd.org/xref/src/sys/...oot/libstubs.s then adjusted to be suitable for loading by AmigaOS (full code at https://nxr.netbsd.org/xref/src/sys/...and/bootblock/ ) rather than needing any changes at the Kickstart end. Now just need to find an Amiga/m68k coder who likes a little assembly challenge ![]() Thanks |
|
![]() |
![]() |
#7 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 2,525
|
One of the things that did change (but already with 3.1.4) was that an entire 32K of low memory stays reserved, instead of just 4K or 1K as in previous kickstarts. If that should be an issue, you can run this tool:
https://aminet.net/package/util/boot/MoveLow to make exec start at the same location as under 3.1 and before. It is at least worth a try. |
![]() |
![]() |
#8 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
Actually, my initial hypothesis was wrong, on Kickstart 3.2.x the bootblock gets to the point where it wants to open console.device (it uses that to show its own messages, then optionally also read in kernel arguments from the user), but that OpenDevice seems to fail with -1.
Video: https://twitter.com/chainq/status/1639581705332748291 Original source location: https://nxr.netbsd.org/xref/src/sys/.../console.c#141 Patch to show the debug requester: https://gist.github.com/chainq/0b1a6...3d9749de2d087c Again, I'm not very good at debugging at this level, but with my basic tools I got this far showing where the issue comes from. I let the people actually good at this come up with a solution. ![]() |
![]() |
![]() |
#9 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 2,525
|
Does it work if you boot with ROM-Updates disabled (see the boot menu?) Do you have something in L: that is named con-handler or something in DEVS: that is named console.device? If so, which version and where did it come from? Edit: There is at least one defect in this code. The io->Length field is not filled in. See: https://amigadev.elowar.com/read/ADC.../node0084.html I suggest to fix that first.
Last edited by Thomas Richter; 25 March 2023 at 13:02. |
![]() |
![]() |
#10 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
There's nothing on the disk, there is no AmigaOS partition/filesystem at all. There's a single HDF, that has a single RDB partition, with the NetBSD miniroot.fs written into it. Booting the miniroot bootblock is the first and only choice. If I only swap out the Kickstart ROM image to v40.68, it works.
Edit: I'm ahead of you still. If you look at my patch, it actually fills out the length field by the size of the window structure (that is 136 bytes, AFAICT). The name is different, because the code doesn't use the AmigaOS SDK to compile, but whatever, supplying the size did not make any difference. But yes, I'll propose this change anyway, going forward. Last edited by Chain-Q; 25 March 2023 at 13:21. |
![]() |
![]() |
#11 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
If anyone feels like debugging this from the Kickstart side, I uploaded the same hardfile I made that Twitter-video with, see the URL below. It contains my debug-bootblock with the error-requester. I can also make custom builds with more debug, if that helps, just someone tell me what to modify.
http://charlie.amigaspirit.hu/temp/p...sd-hack.hdf.xz |
![]() |
![]() |
#12 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 25,953
|
It looks like console.device was moved to priority -120 in KS 3.2+. Previously it had priority +5 (=initialized before strap). This can be easily seen in UAE TR debugger command that lists all residents.
I traced it in emulation and OpenDevice() internally calls FindName() which returns zero because console.device is not yet initialized. |
![]() |
![]() |
#13 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 2,525
|
Ah, Toni, right, thank you. Indeed, console moved post-strap, the reason being that System-Startup can update it. It is actually not used before. What you can do is a FindResident() on the console.device, and an InitResident() on it, then you should be ready to go. Of course, booting off the boot block and thus bypassing System-Startup will disable the automatic ROM-Updates, but that probably does not matter for NetBSD.
|
![]() |
![]() |
#14 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
Thanks Toni for the analysis and Thomas for the workaround idea/proposal. I quickly patched together some code that does this, and it indeed seems to work. I will clean it up, then share the patch here and on the NetBSD ML.
Edit: Patch here: https://gist.github.com/chainq/c2ae1...2f6ea1f6fa88cc Last edited by Chain-Q; 25 March 2023 at 18:37. |
![]() |
![]() |
#15 |
Natteravn
![]() Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,352
|
Good job! Thanks.
![]() I was trying to set up a hardfile myself today for debugging, but ran into some problems (E-UAE needs a valid RDB in the image to recognize it). Either abs or myself can commit your patch, as soon as you are happy with it. |
![]() |
![]() |
#16 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
@phx
Yes, I also ran into this problem, so I used rdbtool from amitools[1] to generate me an RDB disk image quickly. From then on it was recognized as a HDD, not a partition image. I'm good with the patch as-is, and don't intend to modify it any further, unless someone points out problems with it. If there are any other problems with the bootblock to be fixed, they should be a different patch. Review and criticism is welcomed as usual, I'm just a Pascal programmer, I have no idea what I'm doing with them curly braces. ![]() [1]: https://github.com/cnvogelg/amitools |
![]() |
![]() |
#17 | |
Registered User
Join Date: Oct 2008
Location: EU
Posts: 162
|
Quote:
Thanks for all input, interesting read and solution, tried to install NetBSD yesterday to investigate a bit myself but time and skill were not sufficient. |
|
![]() |
![]() |
#18 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
@a4k-oerx:
Yes. As I wrote at the start of post #5, the Alert was generated by bootstrap in the ROM after the bootblock's initialization code failed, and returned with a non-zero exit code. After the debugging we now know that it was unable to open console.device, and it was unable to open console.device because on "modern" Kickstarts it is not initialized at the time bootblock is invoked. The patch adds a workaround for this, by trying to initialize console.device on its own, if opening it is unsuccessful, so this entire chain of events doesn't happen. |
![]() |
![]() |
#19 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 25,953
|
Is there any reason to fail booting if console.device open fails? Just keep booting normally (NetBSD takes over the system anyway) without showing any messages?
|
![]() |
![]() |
#20 |
Registered User
Join Date: Jan 2018
Location: Berlin
Posts: 11
|
It also provides a way to enter/modify kernel arguments and parameters. I mean, probably it can be made to just boot anyway, but there are other ways to boot NetBSD, if the bootblock fails - there's a loadbsd command that can load the kernel from an Amiga FS, and even a runbootblock[1], where one can run the bootblock from a shell, this also worked on v47 Kickstarts too, of course.
[1] https://cdn.netbsd.org/pub/NetBSD/Ne...allation/misc/ |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
A600: Which Kickstart ROM Should I Get to Boot CF-IDE? | amigatime | support.Hardware | 5 | 15 June 2020 02:51 |
[Pre-Orders] Kipper2K Dual-Rom / Quad-Rom - hold reset to switch Kickstart rom boards | solidcore | MarketPlace | 25 | 30 November 2019 20:59 |
[Pre-Orders] Kipper2K Dual-Rom / Quad-Rom - hold reset to switch Kickstart rom boards | solidcore | support.Hardware | 0 | 08 February 2019 20:14 |
Boot different AmigaOS by kickstart version? | hyperlogos | support.Other | 18 | 02 October 2017 17:35 |
Dual boot kickstart ROM file | craggus2000 | support.Hardware | 25 | 06 February 2011 20:02 |
|
|