ping. Thanks!

Brian Conway

On Mon, Nov 15, 2021 at 4:20 PM Brian Conway <bcon...@rcesoftware.com> wrote:
>
> I noticed that unlike amd64 and i386, arm64's bootaa64 supports
> loading a kernel from a non-'a' partition (i.e. boot> sd0d:/bsd),
> however the kernel does not respect that partition when mounting the
> root filesystem. It looks like this is caused by hard-coding 'part =
> 0' in arm64's autoconf.c.
>
> Digging further, it appears that at one point this behavior was present:
>
> https://marc.info/?l=openbsd-cvs&m=154703994927978
> (git cfd4bff0313b7a29ea82f9484862326f1c6b2643)
>
> It was later removed as part of (I believe) a general clean up:
>
> https://marc.info/?l=openbsd-cvs&m=160466957311120
> (git 35fd387b3e5263176046603ff3e402ceeef58cf3)
>
> My attempt at a minimally-invasive patch to restore this functionality
> follows. Tested on RPi 3B+ and 3B, as those are the only arm64 devices
> I have. May not be idiomatic/good code. Thanks.
>
> Brian Conway
>
> diff --git sys/arch/arm64/arm64/autoconf.c sys/arch/arm64/arm64/autoconf.c
> index bda3cb3f6b0..5f68d2665e1 100644
> --- sys/arch/arm64/arm64/autoconf.c
> +++ sys/arch/arm64/arm64/autoconf.c
> @@ -75,11 +75,23 @@ diskconf(void)
>  {
>  #if defined(NFSCLIENT)
>      extern uint8_t *bootmac;
> -    dev_t tmpdev = NODEV;
>  #endif
> +    dev_t tmpdev = NODEV;
> +    extern char bootargs[256];
> +    char *p;
> +    size_t len;
>      struct device *bootdv = NULL;
>      int part = 0;
>
> +    /* Extract part from <device>:/bsd */
> +    if ((p = strchr(bootargs, ':')) != NULL)
> +        len = p - bootargs;
> +    else
> +        len = strlen(bootargs);
> +    bootdv = parsedisk(bootargs, len, 0, &tmpdev);
> +    if (tmpdev != NODEV)
> +        part = DISKPART(tmpdev);
> +
>  #if defined(NFSCLIENT)
>      if (bootmac) {
>          struct ifnet *ifp;
> diff --git sys/arch/arm64/arm64/machdep.c sys/arch/arm64/arm64/machdep.c
> index c84cf6d9b13..2eb5da44409 100644
> --- sys/arch/arm64/arm64/machdep.c
> +++ sys/arch/arm64/arm64/machdep.c
> @@ -1130,7 +1130,7 @@ process_kernel_args(void)
>
>      boot_args = cp;
>
> -    printf("bootargs: %s\n", boot_args);
> +    printf("boot_args: %s\n", boot_args);
>
>      /* Setup pointer to boot flags */
>      while (*cp != '-')
>
> dmesg (7.0-stable):
>
> OpenBSD 7.0-stable (GENERIC.MP) #6: Mon Nov 15 21:50:51 UTC 2021
>     
> bcon...@b70-arm64.int.rcesoftware.com:/usr/src/sys/arch/arm64/compile/GENERIC.MP
> real mem  = 970907648 (925MB)
> avail mem = 908574720 (866MB)
> random: good seed from bootblocks
> mainbus0 at root: Raspberry Pi 3 Model B Plus Rev 1.3
> cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
> cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
> cpu0: 512KB 64b/line 16-way L2 cache
> cpu0: CRC32,ASID16
> cpu1 at mainbus0 mpidr 1: ARM Cortex-A53 r0p4
> cpu1: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
> cpu1: 512KB 64b/line 16-way L2 cache
> cpu1: CRC32,ASID16
> cpu2 at mainbus0 mpidr 2: ARM Cortex-A53 r0p4
> cpu2: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
> cpu2: 512KB 64b/line 16-way L2 cache
> cpu2: CRC32,ASID16
> cpu3 at mainbus0 mpidr 3: ARM Cortex-A53 r0p4
> cpu3: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
> cpu3: 512KB 64b/line 16-way L2 cache
> cpu3: CRC32,ASID16
> efi0 at mainbus0: UEFI 2.8
> efi0: Das U-Boot rev 0x20210700
> apm0 at mainbus0
> simplefb0 at mainbus0: 656x416, 32bpp
> wsdisplay0 at simplefb0 mux 1
> wsdisplay0: screen 0-5 added (std, vt100 emulation)
> "system" at mainbus0 not configured
> "axi" at mainbus0 not configured
> simplebus0 at mainbus0: "soc"
> bcmclock0 at simplebus0
> bcmmbox0 at simplebus0
> bcmgpio0 at simplebus0
> bcmaux0 at simplebus0
> bcmdmac0 at simplebus0: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
> bcmintc0 at simplebus0
> pluart0 at simplebus0: console
> bcmsdhost0 at simplebus0: 250 MHz base clock
> sdmmc0 at bcmsdhost0: 4-bit, sd high-speed, mmc high-speed, dma
> dwctwo0 at simplebus0
> bcmdog0 at simplebus0
> bcmrng0 at simplebus0
> bcmtemp0 at simplebus0
> "local_intc" at simplebus0 not configured
> sdhc0 at simplebus0
> sdhc0: SDHC 3.0, 200 MHz base clock
> sdmmc1 at sdhc0: 4-bit, sd high-speed, mmc high-speed
> "firmware" at simplebus0 not configured
> "power" at simplebus0 not configured
> "mailbox" at simplebus0 not configured
> "gpiomem" at simplebus0 not configured
> "fb" at simplebus0 not configured
> "vcsm" at simplebus0 not configured
> "clocks" at mainbus0 not configured
> "phy" at mainbus0 not configured
> "arm-pmu" at mainbus0 not configured
> agtimer0 at mainbus0: 19200 kHz
> "leds" at mainbus0 not configured
> "fixedregulator_3v3" at mainbus0 not configured
> "fixedregulator_5v0" at mainbus0 not configured
> "bootloader" at mainbus0 not configured
> dt: 445 probes
> usb0 at dwctwo0: USB revision 2.0
> sdmmc0: can't enable card
> uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev
> 2.00/1.00 addr 1
> uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard
> Microsystems product 0x2514" rev 2.00/b.b3 addr 2
> bwfm0 at sdmmc1 function 1
> manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 2 not configured
> manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 3 not configured
> uhub2 at uhub1 port 1 configuration 1 interface 0 "Standard
> Microsystems product 0x2514" rev 2.00/b.b3 addr 3
> umass0 at uhub2 port 3 configuration 1 interface 0 "SanDisk Extreme"
> rev 2.10/0.10 addr 4
> umass0: using SCSI over Bulk-Only
> scsibus0 at umass0: 2 targets, initiator 0
> sd0 at scsibus0 targ 1 lun 0: <SanDisk, Extreme, 0001> removable
> serial.07815580151429010265
> sd0: 29923MB, 512 bytes/sector, 61282631 sectors
> vscsi0 at root
> scsibus1 at vscsi0: 256 targets
> softraid0 at root
> scsibus2 at softraid0: 256 targets
> root on sd0a (7a70bc50720f4af9.a) swap on sd0b dump on sd0b
> WARNING: CHECK AND RESET THE DATE!
> gpio0 at bcmgpio0: 54 pins
> bwfm0: failed loadfirmware of file
> brcmfmac43455-sdio.raspberrypi,3-model-b-plus.bin
> mue0 at uhub2 port 1 configuration 1 interface 0 "Standard
> Microsystems LAN7800" rev 2.10/3.00 addr 5
> mue0: LAN7800, address b8:27:eb:ab:12:75
> ukphy0 at mue0 phy 1: Generic IEEE 802.3u media interface, rev. 2: OUI
> 0x0001f0, model 0x0013

Reply via email to