Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Dec 2017 16:10:51 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        danfe@nsu.ru, Freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: How to use our stock armv7-RPI2 images with QEMU?
Message-ID:  <DEDBFB30-9688-4072-856E-0541F37DEB2D@dsl-only.net>

next in thread | raw e-mail | index | archive | help
Alexey Dokuchaev danfe at nsu.ru wrote on
Sun Dec 24 10:27:24 UTC 2017 :

> Hmm, where does one get u-boot.bin file?  I don't see it in the FreeBSD
> RPi2 image anywhere (expected to find under /boot).

In order to see how official RPI2 is put together
for a release:

# more /usr/src/release/arm/RPI2.conf
#!/bin/sh
#
# $FreeBSD: head/release/arm/RPI2.conf 325950 2017-11-17 17:36:45Z gjb $
#

EMBEDDED_TARGET_ARCH="armv7"
EMBEDDED_TARGET="arm"
EMBEDDEDBUILD=1
EMBEDDEDPORTS="sysutils/u-boot-rpi2 sysutils/rpi-firmware"
FAT_SIZE="50m"
FAT_TYPE="16"
IMAGE_SIZE="3072M"
KERNEL="GENERIC"
MD_ARGS="-x 63 -y 255"
NODOC=1
PART_SCHEME="MBR"
export BOARDNAME="RPI2"

arm_install_uboot() {
        UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi2"
        RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware"
        UBOOT_FILES="u-boot.bin"
        RPI_FIRMWARE_FILES="bootcode.bin config.txt \
                fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \
                start.elf start_cd.elf start_db.elf start_x.elf"
        FATMOUNT="${DESTDIR%${KERNEL}}/fat"
        UFSMOUNT="${DESTDIR%${KERNEL}}/ufs"
        chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}"
        chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT}
        chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT}
        for _UF in ${UBOOT_FILES}; do
                chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \
                        ${FATMOUNT}/${_UF}
        done
        for _UF in ${RPI_FIRMWARE_FILES}; do
                chroot ${CHROOTDIR} cp -p ${RPI_FIRMWARE_DIR}/${_UF} \
                        ${FATMOUNT}/${_UF}
        done
        chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \
                ${FATMOUNT}/ubldr.bin
        chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi2.dtb \
                ${FATMOUNT}/rpi2.dtb
        chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot
        sync
        umount_loop ${CHROOTDIR}/${FATMOUNT}
        umount_loop ${CHROOTDIR}/${UFSMOUNT}
        chroot ${CHROOTDIR} rmdir ${FATMOUNT}
        chroot ${CHROOTDIR} rmdir ${UFSMOUNT}
        
        return 0
}

So installing the port sysutils/u-boot-rpi2
provides:

/usr/local/share/u-boot/u-boot-rpi2/u-boot.bin

that is then copied to the msdosfs file system.

There are also files from the port
sysutils/rpi-firmware in :

/usr/local/share/rpi-firmware/

that are copied over.


I will warn that when I look at the console
record on the rpi2 that I use it shows:

Booting [/boot/kernel/kernel]...               
/boot/dtb/bcm2836-rpi-2-b.dtb size=0x346b
Loaded DTB from file 'bcm2836-rpi-2-b.dtb'.

This is different than the rpi2.dtb put on the
msdosfs in the script. The

/boot/dtb/bcm2836-rpi-2-b.dtb

is what the FreeBSD kernel uses in my context.
The

/boot/dtb/rpi2.dtb

copied to the msdosfs as rpi2.dtb may be for u-boot.

/boot/ubldr.bin is copied to the msdosfs as
well.

===
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DEDBFB30-9688-4072-856E-0541F37DEB2D>