# FreeBSD Discontinue Support for Pandaboard



## Lamia (Feb 18, 2022)

I have been trying to get FreeBSD running on Pandaboard without success. The last image uploaded by the team was FreeBSD12.1. And as you are aware, the version is already at EOL.

I have tried other general SD images for ARM - 12.2, 13.0,14-current but none would boot. They hang just at passing kernel args already set in the codebase i.e. U-boot->Kernel(panic); the same goes for NetBSD. I could not get any valuable info since they were running with no debug options. They were binaries. I did not have much luck with FreeBSD 10.x back then too; see https://forums.freebsd.org/threads/freebsd-on-pandaboard-does-not-boot-up-by-itself.65122/.

If I could get 12.1 going, perhaps, I could upgrade it. Here is the error I receive:

```
size: 16 bytes
iichb2: <TI I2C Controller> mem 0-0xff irq 56 on ti_sysc40
iichb2: I2C revision 4.0 FIFO size: 16 bytes
spi0: <TI McSPI controller> mem 0-0x1ff irq 61 on ti_sysc46
spi0: failed to get clock based on hwmods property
device_attach: spi0 attach returned 22
spi0: <TI McSPI controller> mem 0-0x1ff irq 62 on ti_sysc47
spi0: failed to get clock based on hwmods property
device_attach: spi0 attach returned 22
sdhci_ti0: <TI MMCHS (SDHCI 2.0)> mem 0-0x3ff irq 63 on ti_sysc48
mmc0: <MMC/SD bus> on sdhci_ti0
spi0: <TI McSPI controller> mem 0-0x1ff irq 67 on ti_sysc52
spi0: failed to get clock based on hwmods property
device_attach: spi0 attach returned 22
spi0: <TI McSPI controller> mem 0-0x1ff irq 68 on ti_sysc53
spi0: failed to get clock based on hwmods property
device_attach: spi0 attach returned 22
iichb3: <TI I2C Controller> mem 0-0xff irq 71 on ti_sysc56
iichb3: I2C revision 4.0 FIFO size: 16 bytes
ti_wdt1: <TI Watchdog Timer> mem 0-0x7f irq 72 on ti_sysc58
ti_wdt1: unable to setup the interrupt handler
device_attach: ti_wdt1 attach returned 6
mp_tmr0: <ARM MPCore Timers> mem 0x48240200-0x4824021f irq 22 on simplebus0
mp_tmr0: missing clock-frequency attribute in FDT
device_attach: mp_tmr0 attach returned 6
gpioled0: <GPIO LEDs> on ofwbus0
cryptosoft0: <software crypto>
panic: No usable event timer found!
cpuid = 0
time = 1
Uptime: 1s
Automatic reboot in 15 seconds - press a key on the console to abort
--> Press a key on the console to reboot,
--> or switch off the system now.
```

We have two or more Pandaboards with LCDs here. There need to preferably run BSD. 

Your suggestions will be appreciated.

PS: I have shopped around - *BSD & Linux - but none would work too [1]. The only option left is ArchLinux or Gentoo. Both recently updated their wiki for their OS installation on Pandaboard [2,3]. 

References:
[1] https://www.mail-archive.com/misc@openbsd.org/msg181031.html
[2] https://archlinuxarm.org/platforms/armv7/ti/pandaboard
[3] https://wiki.gentoo.org/wiki/Pandaboard


----------



## covacat (Feb 18, 2022)

what dtb are you using ?


----------



## Lamia (Feb 18, 2022)

Printenv yields the below; dtb inclusive.

```
.....
.......
bootdelay=2
bootdir=/boot
bootenvfile=uEnv.txt
bootfile=zImage
bootm_size=0x10000000
bootpart=0:2
bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
console=ttyO2,115200n8
cpu=armv7
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
ethaddr=02:03:01:f5:02:20
fdt_addr_r=0x88000000
fdtaddr=0x88000000
fdtfile=undefined
findfdt=if test $board_name = sdp4430; then setenv fdtfile omap4-sdp.dtb; fi; if test $board_name = panda; then setenv fdtfile omap4-panda.dtb; fi;if test $board_name = panda-a4; then setenv fdtfile omap4-panda-a4.dtb; fi;if test $board_name = panda-es; then setenv fdtfile omap4-panda-es.dtb; fi;if test $board_name = duovero; then setenv fdtfile omap4-duovero-parlor.dtb; fi;if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
finduuid=part uuid mmc ${bootpart} uuid
fit_bootfile=fitImage
fit_loadaddr=0x90000000
importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
kernel_addr_r=0x82000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x82000000
loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
loadfit=run args_mmc; bootm ${loadaddr}#${fdtfile};
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
loaduimage=load mmc ${mmcdev} ${loadaddr} uImage
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
mmcboot=mmc dev ${mmcdev}; setenv devnum ${mmcdev}; setenv devtype mmc; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; then if test ${boot_fit} -eq 1; then run loadfit; else run mmcloados;fi;fi;fi;
mmcdev=0
mmcloados=run args_mmc; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcrootfstype=ext4 rootwait
pxefile_addr_r=0x80100000
ramdisk_addr_r=0x88080000
rdaddr=0x88080000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x80000000
soc=omap4
uimageboot=echo Booting from mmc${mmcdev} ...; run args_mmc; bootm ${loadaddr}
update_to_fit=setenv loadaddr ${fit_loadaddr}; setenv bootfile ${fit_bootfile}
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
usbethaddr=02:03:01:f5:02:20
usbtty=cdc_acm
vendor=ti
ver=U-Boot 2019.07 (Nov 01 2019 - 01:56:26 +0000)
vram=16M

Environment size: 6431/131068 bytes
```

U-boot info on power is:

```
=> 
U-Boot SPL 2019.07 (Nov 01 2019 - 01:56:26 +0000)
OMAP4430-GP ES2.1
Trying to boot from MMC1
SPL: Please implement spl_start_uboot() for your board
SPL: Direct Linux boot not active!


U-Boot 2019.07 (Nov 01 2019 - 01:56:26 +0000)

CPU  : OMAP4430-GP ES2.1
Board: OMAP4 Panda
I2C:   ready
DRAM:  1 GiB
MMC:   OMAP SD/MMC: 0
Loading Environment from FAT... *** Warning - bad CRC, using default environment
```


----------



## Lamia (Feb 18, 2022)

All of these are from FreeBSD-12.1-RELEASE-arm-armv7-PANDABOARD.img; for past and other efforts, I had needed to drop u-boot.img and MLO (built from ports) into partition 1 of the sdcard. And given that I had no other BSDs than FreeBSD ATM, I had dropped same files in the partition 1 of the card after dd writing in order for all to boot. Only OpenBSD miniroot-panda-70.img would boot up but not detect network interfaces; hence, installation fails for no sets added. In addition, installer breaks on entering time zone (drops to listing dirs in root "/" and won't continue).


----------



## covacat (Feb 18, 2022)

does the loader say something like
Using DTB provided by U-Boot at address  ....?


----------



## Lamia (Feb 18, 2022)

```
Loading kernel...
/boot/kernel/kernel text=0x85cffc data=0xb1968+0x1f4698 syms=[0x4+0xa2ab0+0x4+0x10413c]
Loading configured modules...
can't find '/boot/entropy'
/boot/kernel/umodem.ko text=0x1540 text=0xf00 data=0x1088+0xf7c syms=[0x4+0xe70+0x4+0xa74]
loading required module 'ucom'
/boot/kernel/ucom.ko text=0x1734 text=0x29b0 data=0x1088+0x17b0 syms=[0x4+0x13e0+0x4+0xbac]

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...               
Using DTB provided by EFI at 0x87ee0000.
Kernel entry at 0xb5000180...
Kernel args: (null)
modulep: 0xc0cd9000
relocation_offset 0
---<<BOOT>>---
Copyright (c) 1992-2019 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.1-RELEASE r354233 GENERIC arm
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
VT: init without driver.
module_register: cannot register ofwbus/pcib from kernel; already loaded from kernel
Module ofwbus/pcib failed to register: 17
module_register: cannot register simplebus/pcib from kernel; already loaded from kernel
Module simplebus/pcib failed to register: 17
CPU: ARM Cortex-A9 r1p2 (ECO: 0x00000000)
CPU Features: 
  Multiprocessing, Thumb2, Security, VMSAv7, Coherent Walk
Optional instructions: 
  UMULL, SMULL, SIMD(ext)
LoUU:2 LoC:2 LoUIS:2 
Cache level 1:
 32KB/32B 4-way data cache WB Read-Alloc Write-Alloc
 32KB/32B 4-way instruction cache Read-Alloc
real memory  = 1073090560 (1023 MB)
avail memory = 1035157504 (987 MB)
No PSCI/SMCCC call function found
Texas Instruments OMAP4430 Processor, Revision ES2.1
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
arc4random: no preloaded entropy cache
random: entropy device external interface
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> mem 0x44000000-0x44000fff,0x44800000-0x44801fff,0x45000000-0x45000fff irq 1,2 on ofwbus0
simplebus1: <Flattened device tree simple bus> mem 0x4a300000-0x4a3007ff,0x4a300800-0x4a300fff,0x4a301000-0x4a301fff on simplebus0
simplebus2: <Flattened device tree simple bus> on simplebus1
ti_sysc0: <TI SYSC Interconnect> mem 0x4000-0x4003,0x4004-0x4007 on simplebus2
ti_sysc1: <TI SYSC Interconnect> mem 0x6000-0x6003 on simplebus2
omap4_prcm0: <TI OMAP Power, Reset and Clock Management (PRM)> mem 0-0x1fff irq 24 on ti_sysc1
ti_sysc2: <TI SYSC Interconnect> mem 0xa000-0xa003 on simplebus2
ti_sysc3: <TI SYSC Interconnect> mem 0xc000-0xc003,0xc010-0xc013 on simplebus2
simplebus3: <Flattened device tree simple bus> on simplebus1
ti_sysc4: <TI SYSC Interconnect> mem 0-0x3,0x10-0x13,0x114-0x117 on simplebus3
ti_sysc5: <TI SYSC Interconnect> mem 0x4000-0x4003,0x4010-0x4013,0x4014-0x4017 on simplebus3
ti_sysc6: <TI SYSC Interconnect> mem 0x8000-0x8003,0x8010-0x8013,0x8014-0x8017 on simplebus3
ti_sysc7: <TI SYSC Interconnect> mem 0xc000-0xc003,0xc010-0xc013,0xc014-0xc017 on simplebus3
ti_sysc8: <TI SYSC Interconnect> mem 0xe000-0xe003,0xe010-0xe013 on simplebus3
simplebus4: <Flattened device tree simple bus> on simplebus1
simplebus5: <Flattened device tree simple bus> mem 0x4a000000-0x4a0007ff,0x4a000800-0x4a000fff,0x4a001000-0x4a001fff on simplebus0
simplebus6: <Flattened device tree simple bus> on simplebus5
ti_sysc9: <TI SYSC Interc....
......
```

All other FreeBSD versions hung at just after the line "Kernel args: (null)" while this FreeBSD12.1 sailed through. 

You  can see "Using DTB provided by EFI at 0x87ee0000". Would that be it?


----------



## covacat (Feb 18, 2022)

yeah, it's compiled in the u-boot binary
i'll build it from ports/u-boot-something and have a look
maybe you can build a newer u-boot version ports are at 2021-03 now iirc and see if anything changes


----------



## Lamia (Feb 18, 2022)

The newer one (at https://cgit.freebsd.org/ports/log/sysutils/u-boot-pandaboard) was built and used many occasions as mentioned above. Given that FBSD12.1_Pandaboard exists and would boot, there was no need uploading MLO & u-boot.img. I have now added them but no difference. Was that what you meant?


----------



## covacat (Feb 18, 2022)

stop boot process at the loader prompt
try to use fdt command to add clock-frequency attribute to the fdt
see https://www.bidouilliste.com/blog/2015/11/28/Porting-FreeBSD-to-a-new-ARM-Board-Part-2/ and


			FlattenedDeviceTree - FreeBSD Wiki
		

the freq shoud be 500000000 or 300000000 or something (1/2 of cpu freq)


----------



## Lamia (Feb 19, 2022)

covacat said:


> stop boot process at the loader prompt
> try to use fdt command to add clock-frequency attribute to the fdt
> see https://www.bidouilliste.com/blog/2015/11/28/Porting-FreeBSD-to-a-new-ARM-Board-Part-2/ and
> 
> ...


Thanks for being there.
 Here is the outcome:

```
OK fdt ls /cpus/cpu0
could not find node: '/cpus/cpu0'
OK fdt prop /cpus/cpu@0
compatible = "arm,cortex-a9"
device_type = "cpu"
next-level-cache = <0x00000003>
reg = <0x00000000>
clocks = <0x0000007a>
clock-names = "cpu"
clock-latency = <0x000493e0>
operating-points = <0x000493e0 0x000fa3e8 0x000927c0 0x00124f80 0x000c3500 0x001408e8 0x000f6180 0x0014fb18>
#cooling-cells = <0x00000002>
phandle = <0x00000001>
OK fdt prop /cpus/cpu@1
compatible = "arm,cortex-a9"
device_type = "cpu"
next-level-cache = <0x00000003>
reg = <0x00000001>
OK fdt prop /cpus/cpu@0/clock-frequency <500000000>
unknown command
OK
```
Of course, seeing that clock-frequency property does not exist; I wasn't sure that the instruction would work.


----------



## covacat (Feb 19, 2022)

post all of 
fdt ls
the timer has to be compatible with
compatible = "arm,cortex-a9-twd-timer"


----------



## Lamia (Feb 19, 2022)

Please check https://termbin.com/o8za1.


----------



## covacat (Feb 19, 2022)

this should be it
local-timer@48240600
try fdt prop /local-timer@48240600
and 
fdt mkprop /local-timer@48240600/clock-frequency <504000000>


----------



## Lamia (Feb 19, 2022)

covacat said:


> this should be it
> local-timer@48240600
> try fdt prop /local-timer@48240600
> and
> fdt mkprop /local-timer@48240600/clock-frequency <504000000>


No luck. Throws same error.


----------



## covacat (Feb 19, 2022)

can't really tell why it does not find it


----------



## Lamia (Feb 19, 2022)

Thanks a million


----------



## covacat (Feb 19, 2022)

i would hack the kernel and just hardwire it in the first step


----------

