Re: Disk setup X5000

From: Al <al_at_datazap.net>
Date: Mon, 07 Mar 2022 01:41:49 UTC
Hi,


>> 1. What should be in fstab?
>> 2. Is there a gpart howto somewhere that explains what needs to be
>> done to partition the drives on an X5000?
> I think the u-boot on these systems only supports MBR partitioning, so
> you're stuck with that.  There should be many HOWTOs scattered over the
> internet about using gpart to setup FreeBSD on an MBR system

With an ELF 1 kernel it was working with:

Feb 23 23:58:07 sequoia login[1193]: ROOT LOGIN (root) ON ttyu0
Last login: Wed Feb 23 22:34:11 on ttyu0
FreeBSD 13.0-CURRENT (AMIGAX5000) #1 r351650M: Mon Jul 12 19:03:51 UTC 2021

root@sequoia:~ # uname -rimU
13.0-CURRENT powerpc QORIQ64 1300042
root@sequoia:~ # df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ada0p2     29G     17G    9.2G    65%    /
devfs          1.0K    1.0K      0B   100%    /dev
root@sequoia:~ # gpart show ada0
=>      40  62533216  ada0  GPT  (30G)
         40    204800     1  mbr  (100M)
     204840  62328416     2  freebsd-ufs  (30G)


>> 3. Should the disklabel be added with newfs and is there anything
>> else that I need to know?
> The boot partition should be a small FAT partition that just has ubldr
> and your dtb. Everything else can go on the rootfs which should
> be in the disklabel.
>
> My X5000 has the following layout from 'gpart show':
>
> =>        63  1000215153  ada0  MBR  (477G)
>            63      262144     1  fat16  (128M)
>        262207   999953009     2  freebsd  (477G)
>
> =>        0  999953009  ada0s2  BSD  (477G)
>            0   62914560       1  freebsd-ufs  (30G)
>     62914560   16777216       2  freebsd-swap  (8.0G)
>     79691776  920261233       4  freebsd-zfs  (439G)
This is how I setup the new drive:

root@sequoia:~ # gpart show ada1
=>       63 234441585  ada1  MBR  (112G)
          63 204800     1  fat16  (100M)
      204863 234236785     2  freebsd  (112G)

root@sequoia:~ # gpart show ada1s2
=>        0 234236785  ada1s2  BSD  (112G)
           0 234236785       1  freebsd-ufs  (112G)

root@sequoia:~ # df -h
Filesystem Size    Used   Avail Capacity  Mounted on
/dev/ada0p2 29G     17G    9.2G    65%    /
devfs 1.0K    1.0K      0B   100%    /dev
/dev/ada1s2a 108G     16K    100G     0%    /mnt
/dev/ada1s1     100M     16K    100M     0%    /mnt/boot/uboot

>> 7. Could there be something missing in the kernel?
> What other issues are you running into?

It just stops when it get to where the kernel needs to mount the drive. 
I guess it could be something either missing from my kernel or something 
else added in. Here is my kernel config:

root@test:/usr/src/sys/powerpc/conf # more AMIGAX5000
#
# Custom kernel for Freescale MPC85XX development boards like the CDS etc.
#
# $FreeBSD: head/sys/powerpc/conf/MPC85XX 277254 2015-01-16 17:41:21Z 
nwhitehorn $
#

ident           AMIGAX5000

include         QORIQ64

#options        BUS_DEBUG
#options        DEBUG
#options        EARLY_PRINTF
#options        MPC85XX_UART_PA=0xffe11c000ull
#options        KTR
#options        KTR_COMPILE=(KTR_PMAP)
#options        KTR_MASK=(KTR_PMAP)
#options        KTR_ENTRIES=8192
#options        KTR_VERBOSE

options         PREEMPTION              # Enable kernel thread preemption
options        GEOM_PART_EBR           # Extended Boot Records
#options        GEOM_PART_EBR_COMPAT    # Backward compatible partition 
names
options         GEOM_PART_APM           # Apple Partition Maps.
#options        ZFS

device          ukbd
device          ums

# For SAS RAID
#device         pci
#device         aacraid

# For Video
device          vt
device          fbd
device          kbdmux
options         KBD_INSTALL_CDEV

# No Netboot
nooptions       BOOTP
nooptions       BOOTP_NFSROOT

# For Alex
#device         nvme
nooptions       INVARIANTS
nooptions       INVARIANT_SUPPORT
nooptions       WITNESS
nooptions       WITNESS_SKIPSPIN

I have to build the kernel without:
options        GEOM_PART_EBR           # Extended Boot Records
options        GEOM_PART_EBR_COMPAT    # Backward compatible partition names

If I don't comment those out then it will not build. My guess is this is 
the problem! What should be put in it's place?

root@g3:/usr/src # make buildkernel TARGET_ARCH=powerpc64 
KERNCONF=AMIGAX5000
[Creating objdir /usr/obj/usr/src/powerpc.powerpc...]
[Creating objdir /usr/obj/usr/src/powerpc.powerpc64...]
make[1]: "/usr/src/Makefile.inc1" line 332: SYSTEM_COMPILER: libclang 
will be built for bootstrapping a cross-compiler.
make[1]: "/usr/src/Makefile.inc1" line 337: SYSTEM_LINKER: libclang will 
be built for bootstrapping a cross-linker.


Kernel build failure with "GEOM_PART_EBR_COMPAT":
--------------------------------------------------------------
 >>> Kernel build for AMIGAX5000 started on Sun Mar  6 12:59:48 EST 2022
--------------------------------------------------------------
===> AMIGAX5000
mkdir -p /usr/obj/usr/src/powerpc.powerpc64/sys

--------------------------------------------------------------
 >>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /usr/src/sys/powerpc/conf; 
PATH=/usr/obj/usr/src/powerpc.powerpc64/tmp/bin:/usr/obj/usr/src/powerpc.powerpc64/tmp/usr/sbin:/usr/obj/usr/src/powerpc.powerpc64/tmp/usr/bin:/usr/obj/usr/src/powerpc.powerpc64/tmp/legacy/usr/sbin:/usr/obj/usr/src/powerpc.powerpc64/tmp/legacy/usr/bin:/usr/obj/usr/src/powerpc.powerpc64/tmp/legacy/bin:/usr/obj/usr/src/powerpc.powerpc64/tmp/legacy/usr/libexec::/sbin:/bin:/usr/sbin:/usr/bin 
config  -d /usr/obj/usr/src/powerpc.powerpc64/sys/AMIGAX5000  -I 
'/usr/src/sys/powerpc/conf' -I '/usr/src/sys/powerpc/conf' 
'/usr/src/sys/powerpc/conf/AMIGAX5000'
/usr/src/sys/powerpc/conf/AMIGAX5000: unknown option "GEOM_PART_EBR_COMPAT"
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src

After removing "GEOM_PART_EBR_COMPAT":

cc -target powerpc64-unknown-freebsd14.0 
--sysroot=/usr/obj/usr/src/powerpc.powerpc64/tmp 
-B/usr/obj/usr/src/powerpc.powerpc64/tmp/usr/bin  -shared -O2 -pipe 
-fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys 
-I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt 
-D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h 
-fno-common    -msoft-float -fPIC -fno-omit-frame-pointer -MD 
-MF.depend.force-dynamic-hack.pico -MTforce-dynamic-hack.pico 
-fdebug-prefix-map=./machine=/usr/src/sys/powerpc/include -mno-altivec 
-msoft-float -mabi=elfv2 -ffreestanding -fwrapv -fstack-protector -Wall 
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes 
-Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign 
-D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs 
-fdiagnostics-show-option -Wno-unknown-pragmas 
-Wno-error=tautological-compare -Wno-error=empty-body 
-Wno-error=parentheses-equality -Wno-error=unused-function 
-Wno-error=pointer-sign -Wno-error=shift-negative-value 
-Wno-address-of-packed-member -Wno-format-zero-length     
-std=iso9899:1999 -nostdlib force-dynamic-hack.c -o force-dynamic-hack.pico
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and 
include the crash backtrace.
MAKE="make" sh /usr/src/sys/conf/newvers.sh  QORIQ64
cc -target powerpc64-unknown-freebsd14.0 
--sysroot=/usr/obj/usr/src/powerpc.pow
PowerPC 64 head base.txz and kernel.txz:
X5000> setenv loader_kernaddr 0x2000000
X5000> setenv loaderdev disk1s2a
X5000> fatload sata 0:1 $loadaddr ubldr
reading ubldr
322464 bytes read in 27 ms (11.4 MiB/s)
X5000> fatload sata 0:1 $fdtaddr cyrus.dtb
reading cyrus.dtb
65536 bytes read in 31 ms (2 MiB/s)
X5000> fdt addr $fdtaddr
X5000> fdt boardsetup
X5000> bootelf $loadaddr
## Starting application at 0x00010160 ...
Consoles: U-Boot console
Compatible U-Boot API signature found @0x7fe2efd8

FreeBSD/powerpc64 U-Boot loader, Revision 1.5
(Thu Feb  3 05:37:08 UTC 2022 root@releng1.nyi.freebsd.org 
<mailto:root@releng1.nyi.freebsd.org>)

Number of U-Boot devices: 4
U-Boot env: loaderdev='disk1s2a'
Found U-Boot device: disk
   Checking unit=1 slice=2 partition=0... good.
Bad trap at PC: 0, SR: 1200, vector=800
NIP: 00000000 XER: 00000000 LR: 000127A0 REGS: 7fe2d930 TRAP: 0800 DAR: 
00000000
MSR: 00001200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

GPR00: 00049604 7FE2DA20 7FE2DF00 7FE2DA2C 00061640 7FE2DA50 00000000 
00000010
GPR08: 000616F8 00000000 00000000 00061680 00000100 B2008B10 FFFFFFFF 
7FE8C210
GPR16: 7FF97796 7FF96C4C 7FE8C210 7FE8C200 7FE8C240 00000000 00000000 
00000000
GPR24: 0005C020 0005C024 00060000 00000000 00061640 000616C0 00065E6C 
00000001
Call backtrace:
000412E0 00049604 0004EA74 00048D44 000141C4 00022A7C 0003E534
00021CA4 7FF45B64 00000000 7FE8C2B0
Exception in kernel pc 0 signal 0
### ERROR ### Please RESET the board ###

PowerPC 64spe base.txz and kernel.txz:
X5000> setenv loader_kernaddr 0x2000000
X5000> setenv loaderdev disk1s2a
X5000> fatload sata 0:1 $loadaddr ubldr
reading ubldr
330656 bytes read in 28 ms (11.3 MiB/s)
X5000> fatload sata 0:1 $fdtaddr cyrus.dtb
reading cyrus.dtb
65536 bytes read in 30 ms (2.1 MiB/s)
X5000> fdt addr $fdtaddr
X5000> fdt boardsetup
X5000> bootelf $loadaddr
## Starting application at 0x00010160 ...
Consoles: U-Boot console
Compatible U-Boot API signature found @0x7fe2efd8

FreeBSD/powerpcspe U-Boot loader, Revision 1.5
(Thu Feb  3 05:25:53 UTC 2022 root@releng1.nyi.freebsd.org 
<mailto:root@releng1.nyi.freebsd.org>)

Number of U-Boot devices: 4
U-Boot env: loaderdev='disk1s2a'
Found U-Boot device: disk
   Checking unit=1 slice=2 partition=0... good.
Bad trap at PC: 0, SR: 1200, vector=800
NIP: 00000000 XER: 00000000 LR: 000128C0 REGS: 7fe2d930 TRAP: 0800 DAR: 
00000000
MSR: 00001200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

GPR00: 0004AF70 7FE2DA20 7FE2DF00 7FE2DA2C 00063640 7FE2DA50 00000000 
00000010
GPR08: 00000010 00000000 00000008 00063680 00000100 B2008A10 FFFFFFFF 
7FE8C210
GPR16: 7FF97796 7FF96C4C 7FE8C210 7FE8C200 7FE8C240 00000000 00000000 
00000000
GPR24: 0005E020 0005E024 00060000 00000000 00063640 000636C0 00067E6C 
00000001
Call backtrace:
000429B4 0004AF70 000504F4 0004A644 00014430 00023120 0003FAF0
00022334 7FF45B64 7FF3109C 7FF46004 7FF3DEBC 7FF3F948 7FF3FFC4
7FF3F258 7FF3F8EC 7FF3FFC4 7FF401B8 7FF3D4A4 7FF3ADFC 7FF31650
Exception in kernel pc 0 signal 0
### ERROR ### Please RESET the board ###erpc64/tmp 
-B/usr/obj/usr/src/powerpc.powerpc64/tmp/usr/bin -c -O2 -pipe 
-fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys 
-I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt 
-D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h 
-fno-common    -msoft-float -fPIC -fno-omit-frame-pointer 
-fdebug-prefix-map=./machine=/usr/src/sys/powerpc/include -mno-altivec 
-msoft-float -mabi=elfv2 -ffreestanding -fwrapv -fstack-protector -Wall 
-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes 
-Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign 
-D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs 
-fdiagnostics-show-option -Wno-unknown-pragmas 
-Wno-error=tautological-compare -Wno-error=empty-body 
-Wno-error=parentheses-equality -Wno-error=unused-function 
-Wno-error=pointer-sign -Wno-error=shift-negative-value 
-Wno-address-of-packed-member -Wno-format-zero-length     
-std=iso9899:1999 -Werror vers.c
ctfconvert -L VERSION -g vers.o
linking kernel.full
ld: error: undefined symbol: zfs_zstd_cache_reap_now
 >>> referenced by arc.c:5007 
(/usr/src/sys/contrib/openzfs/module/zfs/arc.c:5007)
 >>>               arc.o:(arc_reap_cb_check)

ld: error: undefined symbol: zfs_zstd_compress
 >>> referenced by zio_compress.c
 >>>               zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress
 >>> referenced by zio_compress.c
 >>>               zio_compress.o:(zio_compress_table)

ld: error: undefined symbol: zfs_zstd_decompress_level
 >>> referenced by zio_compress.c
 >>>               zio_compress.o:(zio_compress_table)
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and 
include the crash backtrace.
*** Signal 4

Stop.
make[2]: stopped in /usr/obj/usr/src/powerpc.powerpc64/sys/AMIGAX5000
      7191.50 real      6371.56 user       735.91 sys
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src


> For reference, relevant U-Boot environment variables (transcribed):
>
> bootargs_sata=vfs.root.mountfrom=ufs:/dev/ada0s2a
> bootcmd=run bootcmd_sata
> bootcmd_sata=sata start; fatload sata 0:1 ${loadaddr} ${bootfile};
> fatload sata 0:1 ${fdtaddr} ${fdtfile}; fdt addr ${fdtaddr}; fdt
> boardsetup; bootelf ${loadaddr}
> bootfile=ubldr
> fdtfile=cyrus_p5020.dtb
This is pretty much what I am using.
> The easiest way to install would be to gpart from another powerpc
> machine, mount the rootfs, mount the bootfs to ${rootfs}/boot/uboot,
> then extract the base.txz and kernel.txz, that you can find on the
> download server, in the mounted rootfs.  You can then use bsdconfig to
> configure it.

I am not sure what download sever you mean. I downloaded base.txz and 
kernel.txz from 
https://download.freebsd.org/snapshots/powerpc/powerpcspe/14.0-CURRENT/


PowerPC 64 head base.txz and kernel.txz:
X5000> setenv loader_kernaddr 0x2000000
X5000> setenv loaderdev disk1s2a
X5000> fatload sata 0:1 $loadaddr ubldr
reading ubldr
322464 bytes read in 27 ms (11.4 MiB/s)
X5000> fatload sata 0:1 $fdtaddr cyrus.dtb
reading cyrus.dtb
65536 bytes read in 31 ms (2 MiB/s)
X5000> fdt addr $fdtaddr
X5000> fdt boardsetup
X5000> bootelf $loadaddr
## Starting application at 0x00010160 ...
Consoles: U-Boot console
Compatible U-Boot API signature found @0x7fe2efd8

FreeBSD/powerpc64 U-Boot loader, Revision 1.5
(Thu Feb  3 05:37:08 UTC 2022 root@releng1.nyi.freebsd.org 
<mailto:root@releng1.nyi.freebsd.org>)

Number of U-Boot devices: 4
U-Boot env: loaderdev='disk1s2a'
Found U-Boot device: disk
   Checking unit=1 slice=2 partition=0... good.
Bad trap at PC: 0, SR: 1200, vector=800
NIP: 00000000 XER: 00000000 LR: 000127A0 REGS: 7fe2d930 TRAP: 0800 DAR: 
00000000
MSR: 00001200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

GPR00: 00049604 7FE2DA20 7FE2DF00 7FE2DA2C 00061640 7FE2DA50 00000000 
00000010
GPR08: 000616F8 00000000 00000000 00061680 00000100 B2008B10 FFFFFFFF 
7FE8C210
GPR16: 7FF97796 7FF96C4C 7FE8C210 7FE8C200 7FE8C240 00000000 00000000 
00000000
GPR24: 0005C020 0005C024 00060000 00000000 00061640 000616C0 00065E6C 
00000001
Call backtrace:
000412E0 00049604 0004EA74 00048D44 000141C4 00022A7C 0003E534
00021CA4 7FF45B64 00000000 7FE8C2B0
Exception in kernel pc 0 signal 0
### ERROR ### Please RESET the board ###




PowerPC 64spe base.txz and kernel.txz:
X5000> setenv loader_kernaddr 0x2000000
X5000> setenv loaderdev disk1s2a
X5000> fatload sata 0:1 $loadaddr ubldr
reading ubldr
330656 bytes read in 28 ms (11.3 MiB/s)
X5000> fatload sata 0:1 $fdtaddr cyrus.dtb
reading cyrus.dtb
65536 bytes read in 30 ms (2.1 MiB/s)
X5000> fdt addr $fdtaddr
X5000> fdt boardsetup
X5000> bootelf $loadaddr
## Starting application at 0x00010160 ...
Consoles: U-Boot console
Compatible U-Boot API signature found @0x7fe2efd8

FreeBSD/powerpcspe U-Boot loader, Revision 1.5
(Thu Feb  3 05:25:53 UTC 2022 root@releng1.nyi.freebsd.org 
<mailto:root@releng1.nyi.freebsd.org>)

Number of U-Boot devices: 4
U-Boot env: loaderdev='disk1s2a'
Found U-Boot device: disk
   Checking unit=1 slice=2 partition=0... good.
Bad trap at PC: 0, SR: 1200, vector=800
NIP: 00000000 XER: 00000000 LR: 000128C0 REGS: 7fe2d930 TRAP: 0800 DAR: 
00000000
MSR: 00001200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

GPR00: 0004AF70 7FE2DA20 7FE2DF00 7FE2DA2C 00063640 7FE2DA50 00000000 
00000010
GPR08: 00000010 00000000 00000008 00063680 00000100 B2008A10 FFFFFFFF 
7FE8C210
GPR16: 7FF97796 7FF96C4C 7FE8C210 7FE8C200 7FE8C240 00000000 00000000 
00000000
GPR24: 0005E020 0005E024 00060000 00000000 00063640 000636C0 00067E6C 
00000001
Call backtrace:
000429B4 0004AF70 000504F4 0004A644 00014430 00023120 0003FAF0
00022334 7FF45B64 7FF3109C 7FF46004 7FF3DEBC 7FF3F948 7FF3FFC4
7FF3F258 7FF3F8EC 7FF3FFC4 7FF401B8 7FF3D4A4 7FF3ADFC 7FF31650
Exception in kernel pc 0 signal 0
### ERROR ### Please RESET the board ###

I really need to find out what source you are using and the kernel 
config. Or I need to find out where to where to download the correct 
binaries.

Please help! Please let me know what I have wrong.

Kind Regards,
Al