Opened 4 years ago

Closed 2 years ago

Last modified 2 years ago

#15648 closed bug (no change required)

haiku_loader.ub non-functional on ARM

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Boot Loader/uboot Version: R1/Development
Keywords: arm u-boot Cc:
Blocked By: Blocking:
Platform: All

Description

There's been a pretty big regression in haiku_loader under the u-boot platform.

Haiku's loader has everything it needs to boot and discover the serial uart under QEMU / u-boot / arm, however it just isn't working.

I recently added support for FDT /chosen nodes to try and get the loader going under QEMU.. however we're not getting into the loader it seems to even use this code.

Change History (5)

comment:1 by kallisti5, 4 years ago

The recent additions to support /chosen fdt aren't the cause and don't seem to be making it worse.

Test Code which find the uart from the qemu dtb based on the /chosen path.

#include <stdio.h>
#include <stdlib.h>

static void
debug_uart_from_fdt(const void *fdt)
{
    int chosen_node;
    int node;
    int len;
    const char *name;
    const void *prop;
    void* uart;
    //DebugUART *uart = NULL;

    if (fdt == NULL) {
        printf("%s: No FDT found!\n", __func__);
        return;
    }

    chosen_node = fdt_path_offset(fdt, "/chosen");
    if (chosen_node >= 0) {
        printf("Found Chosen Node!\n");
        prop = fdt_getprop(fdt, chosen_node, "stdout-path", &len);
        if (prop && len > 0) {
            node = fdt_path_offset(fdt, (const char*)prop);
            prop = fdt_getprop(fdt, node, "compatible", &len);
            printf("Debug uart from stdout-path! compat: %s\n", prop);
        }
        if (uart == NULL) {
            prop = fdt_getprop(fdt, chosen_node, "linux,stdout-path", &len);
            if (prop && len > 0) {
                node = fdt_path_offset(fdt, (const char*)prop);
                printf("Debug uart from linux,stdout-path!\n");
            }
        }

        if (uart == NULL) {
            // From what i've seen, stdout is generally an alias.
            // we could check for "/..." in the prop, but not sure
            // it's needed. If we *did* check for a prop starting
            // with / we could make all three of these "the same"
            prop = fdt_getprop(fdt, chosen_node, "stdout", &len);
            if (prop && len > 0) {
                name = fdt_get_alias(fdt, (const char*)prop);
                if (name != NULL) {
                    node = fdt_path_offset(fdt, name);
                    printf("Debug uart from stdout\n");
                    //uart = debug_uart_from_node(fdt, node);
                }
            }
        }

        // Whoo-hoo! Bail.
        if (uart != NULL)
            return uart;
    }
}

int
main()
{
    FILE* fp;
    void* buffer;
    long file_size;

    fp = fopen("test.dtb", "r+");
    fseek(fp, 0 , SEEK_END);
    file_size = ftell(fp);
    buffer = malloc(file_size);
    fseek(fp, 0, SEEK_SET);

    fread(buffer, file_size, 1, fp);

    debug_uart_from_fdt(buffer);
    return 0;
}
$ gcc -o fdttest test.c haikufdt.a

$ ./fdttest 
Found Chosen Node!
Debug uart from stdout-path! compat: arm,pl011

comment:2 by pulkomandy, 4 years ago

Component: System/Boot LoaderSystem/Boot Loader/uboot

comment:3 by davidkaroly, 2 years ago

Recently the raw u-boot loader won't even compile for ARM due to different reasons

  • hard-float/soft-float flags are not tuned correctly
  • FDT
  • address space conversion functions are missing

I think the question is: do we have any ARM based platform that has an u-boot based firmware without EFI support. (maybe one of the boards on the port status like Gumstix or Efika?)

comment:4 by pulkomandy, 2 years ago

Resolution: no change required
Status: newclosed

There is no need to support ancient platforms with an unmaintained uboot. Let's just remove them from the port status page and require a reasonable setup to run the OS from.

comment:5 by davidkaroly, 2 years ago

as a follow-up I created a PR for haiku port status page: https://github.com/haiku/website/pull/578

Note: See TracTickets for help on using tickets.