Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Apr 2018 22:22:35 -0400
From:      Curtis Villamizar <curtis@orleans.occnc.com>
To:        freebsd-arm@freebsd.org
Cc:        Brad Davis <brd@FreeBSD.org>, Curtis Villamizar <curtis@orleans.occnc.com>
Subject:   Re: Success building Orange Pi PC Plus (aka OPiPC+) using crochet
In-Reply-To: <1523653462.2951986.1337383960.6D5B3105@webmail.messagingengine.com>

| previous in thread | raw e-mail | index | archive | help
In message <cmu-lmtpd-55654-1523665352-0@mda32.somerville.occnc.com>
Curtis Villamizar writes:
> =

> > On Fri, Apr 13, 2018, at 11:43 AM, Curtis Villamizar wrote:
> > > FYI-
> > > =

> > > I have a build using crochet for Orange Pi PC Plus that works fine.
> > > =

> > > Instructions are at http://occnc.com/info/arm64/NOTES.html
> > > =

> > > There are some contributions to crochet but I'm not sure what the
> > > right way is to submit patches and additions to crochet is.
> >  =

> > Awesome!  Just submit a pull request on github.
> >  =

> > Regards,
> > Brad Davis
>  =

>  =

> Brad,
>  =

> You must have mistaken me for someone with a clue.
>  =

> Could you be more explicit.
>  =

> Curtis


Can't get github.com to work so here are git diffs.  Please
push/pull/whatever on my behalf.

Also please keep me on the Cc since I'm not subscribed.

Curtis


diff --git a/board/OrangePi-PC-Plus/opipc+-workaround.dts b/board/OrangePi=
-PC-Plus/opipc+-workaround.dts
new file mode 100644
index 0000000..f5c6e94
--- /dev/null
+++ b/board/OrangePi-PC-Plus/opipc+-workaround.dts
@@ -0,0 +1,6 @@
+#include "sun8i-h3-orangepi-pc-plus.dts"
+
+&codec {
+ status =3D "disabled";
+};
+ =

diff --git a/board/OrangePi-PC-Plus/overlay/etc/fstab b/board/OrangePi-PC-=
Plus/overlay/etc/fstab
new file mode 100644
index 0000000..09ccd82
--- /dev/null
+++ b/board/OrangePi-PC-Plus/overlay/etc/fstab
@@ -0,0 +1,6 @@
+/dev/mmcsd0s1	/boot/msdos	msdosfs rw,noatime	0 0
+/dev/mmcsd0s2a	/		ufs rw,noatime		1 1
+md		/tmp		mfs rw,noatime,-s30m	0 0
+md		/var/log	mfs rw,noatime,-s15m	0 0
+md		/var/tmp	mfs rw,noatime,-s12m	0 0
+
diff --git a/board/OrangePi-PC-Plus/overlay/etc/rc.conf b/board/OrangePi-P=
C-Plus/overlay/etc/rc.conf
new file mode 100644
index 0000000..602326d
--- /dev/null
+++ b/board/OrangePi-PC-Plus/overlay/etc/rc.conf
@@ -0,0 +1,15 @@
+hostname=3D"orangepi-pc-plus"
+ifconfig_awg0=3D"DHCP"
+sshd_enable=3D"YES"
+
+# Nice if you have a network, else annoying.
+#ntpd_enable=3D"YES"
+ntpd_sync_on_start=3D"YES"
+
+# Uncomment to disable common services (more memory)
+#cron_enable=3D"NO"
+#syslogd_enable=3D"NO"
+
+sendmail_submit_enable=3D"NO"
+sendmail_outbound_enable=3D"NO"
+sendmail_msp_queue_enable=3D"NO"
diff --git a/board/OrangePi-PC-Plus/setup.sh b/board/OrangePi-PC-Plus/setu=
p.sh
new file mode 100644
index 0000000..0e26528
--- /dev/null
+++ b/board/OrangePi-PC-Plus/setup.sh
@@ -0,0 +1,110 @@
+KERNCONF=3DGENERIC
+UBLDR_LOADADDR=3D0x42000000
+SUNXI_UBOOT=3D"u-boot-orangepi-pc-plus"
+SUNXI_UBOOT_BIN=3D"u-boot.img"
+# image size fits a 2+ GB root image in first UFS partition
+IMAGE_SIZE=3D$((3 * 1000 * 1000 * 1000))
+TARGET_ARCH=3Darmv6
+
+FREEBSD_SRC=3D/usr/src
+# BOARD_BOOT_MOUNTPOINT
+# BOARD_FREEBSD_MOUNTPOINT
+# BOARD_CURRENT_MOUNTPOINT
+
+UBOOT_PATH=3D"/usr/local/share/u-boot/${SUNXI_UBOOT}"
+
+allwinner_partition_image ( ) {
+    echo "Installing U-Boot files"
+    dd if=3D${UBOOT_PATH}/u-boot-sunxi-with-spl.bin conv=3Dnotrunc,sync \
+       of=3D/dev/${DISK_MD} bs=3D1024 seek=3D8
+    dd if=3D${UBOOT_PATH}/u-boot.img conv=3Dnotrunc,sync \
+       of=3D/dev/${DISK_MD} bs=3D1024 seek=3D40
+    disk_partition_mbr
+    disk_fat_create 32m 16 1m
+    # note: /usr/{local,ports} elsewhere - 2.5g for base
+    disk_ufs_create `expr 5 \* 512`m
+    # rest of disk - either use growfs on prior or add partitions if need=
ed
+    #disk_ufs_create ...
+}
+strategy_add $PHASE_PARTITION_LWW allwinner_partition_image
+
+allwinner_check_uboot ( ) {
+    uboot_port_test ${SUNXI_UBOOT} ${SUNXI_UBOOT_BIN}
+}
+strategy_add $PHASE_CHECK allwinner_check_uboot
+
+strategy_add $PHASE_BUILD_OTHER freebsd_ubldr_build \
+	     UBLDR_LOADADDR=3D${UBLDR_LOADADDR}
+strategy_add $PHASE_BOOT_INSTALL freebsd_ubldr_copy_ubldr .
+
+make_workaround_fdt ( ) {
+    mkdir -p ${WORKDIR}/opipc+
+    # note: the echo expands the directory variables
+    cmd=3D`echo MACHINE=3Darm /usr/src/sys/tools/fdt/make_dtb.sh \
+    	      ${FREEBSD_SRC}/sys ${BOARDDIR}/opipc+-workaround.dts \
+	      ${WORKDIR}/opipc+`
+    echo =3D=3D=3D Running: $cmd =3D=3D=3D
+    sh -c "$cmd"
+    if [ $? !=3D 0 ] ; then
+	echo make_workaround_fdt: command failed
+	echo "  " $cmd
+	exit 1
+    fi
+}
+
+copy_workaround_fdt ( ) {
+    destdir=3D$1
+    if [ x =3D "x$destdir" ] ; then
+	echo make_workaround_fdt: needs a destination directory argument
+	exit 1
+    else
+	if [ "x$destdir" =3D xboot ] ; then
+	    destdir=3D${BOARD_BOOT_MOUNTPOINT}  # not set at define time
+	elif [ "x$destdir" =3D xbsd ] ; then
+	    destdir=3D${BOARD_FREEBSD_MOUNTPOINT}/boot/dtb
+	fi
+	if [ ! -d $destdir ] ; then
+	    echo make_workaround_fdt: $destdir is not a directory
+	    exit 1
+	fi
+    fi
+    echo =3D=3D=3D Copy dtb file to ${destdir}/sun8i-h3-orangepi-pc-plus.=
dtb =3D=3D=3D
+    cp ${WORKDIR}/opipc+/opipc+-workaround.dtb \
+       ${destdir}/sun8i-h3-orangepi-pc-plus.dtb
+}
+
+#strategy_add $PHASE_BOOT_INSTALL freebsd_install_fdt \
+#	     ../gnu/dts/arm/sun8i-h3-orangepi-pc-plus.dts \
+#	     ${BOARD_BOOT_MOUNTPOINT}/sun8i-h3-orangepi-pc-plus.dtb
+#strategy_add $PHASE_FREEBSD_BOARD_INSTALL freebsd_install_fdt \
+#	     ../gnu/dts/arm/sun8i-h3-orangepi-pc-plus.dts \
+#	     ${BOARD_FREEBSD_MOUNTPOINT}/boot/dtb/orangepi-pc-plus.dtb
+
+#  compiles dts twice but no big deal
+strategy_add $PHASE_BOOT_INSTALL make_workaround_fdt
+strategy_add $PHASE_BOOT_INSTALL copy_workaround_fdt boot
+strategy_add $PHASE_FREEBSD_BOARD_INSTALL copy_workaround_fdt bsd
+
+make_boot_install_boot_scr_file ( ) {
+    echo "echo \"Loading U-boot loader: ubldr.bin\"" \
+	 > ${BOARD_BOOT_MOUNTPOINT}/boot.cmd
+#  not sure if we need to pre-load the dtb file
+#    echo "" \
+#	 >> ${BOARD_BOOT_MOUNTPOINT}/boot.cmd
+    echo "load \${devtype} \${devnum}:${distro_bootpart}"\
+	 "${UBLDR_LOADADDR}" ubldr.bin \
+	 >> ${BOARD_BOOT_MOUNTPOINT}/boot.cmd
+    echo "go ${UBLDR_LOADADDR}" \
+	 >> ${BOARD_BOOT_MOUNTPOINT}/boot.cmd
+    mkimage -A arm -T script -C none -n "Boot Commands" \
+	    -d ${BOARD_BOOT_MOUNTPOINT}/boot.cmd \
+	    ${BOARD_BOOT_MOUNTPOINT}/boot.scr
+}
+strategy_add $PHASE_FREEBSD_BOARD_INSTALL make_boot_install_boot_scr_file
+
+# BeagleBone puts the kernel on the FreeBSD UFS partition.
+strategy_add $PHASE_FREEBSD_BOARD_INSTALL board_default_installkernel .
+# overlay/etc/fstab mounts the FAT partition at /boot/msdos
+strategy_add $PHASE_FREEBSD_BOARD_INSTALL mkdir -p boot/msdos
+# ubldr help and config files go on the UFS partition (after boot dir exi=
sts)
+strategy_add $PHASE_FREEBSD_BOARD_INSTALL freebsd_ubldr_copy boot



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?>