Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add beagleplay support take 4 build branch #686

Merged
merged 13 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions beagleplay.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
deviceTypesCommon = require '@resin.io/device-types/common'
{ networkOptions, commonImg, instructions } = deviceTypesCommon

BBB_FLASH = 'Power up the <%= TYPE_NAME %> after inserting the flasher image into the SDCard Slot.
The device will power down automatically after the flashing is complete. Remove the SDCard and restart the device.'

postProvisioningInstructions = [
instructions.BOARD_SHUTDOWN
instructions.REMOVE_INSTALL_MEDIA
instructions.BOARD_REPOWER
]

module.exports =
version: 1
slug: 'beagleplay'
aliases: [ 'beagleplay' ]
name: 'BeaglePlay'
arch: 'aarch64'
state: 'released'

stateInstructions:
postProvisioning: postProvisioningInstructions

instructions: [
instructions.ETCHER_SD
instructions.EJECT_SD
instructions.FLASHER_WARNING
BBB_FLASH
].concat(postProvisioningInstructions)

gettingStartedLink:
windows: 'https://docs.resin.io/beaglebone/nodejs/getting-started/#adding-your-first-device'
osx: 'https://docs.resin.io/beaglebone/nodejs/getting-started/#adding-your-first-device'
linux: 'https://docs.resin.io/beaglebone/nodejs/getting-started/#adding-your-first-device'

yocto:
machine: 'beagleplay'
image: 'balena-image-flasher'
fstype: 'balenaos-img'
version: 'yocto-kirkstone'
deployArtifact: 'balena-image-flasher-beagleplay.balenaos-img'
compressed: true

options: [ networkOptions.group ]

configuration:
config:
partition:
primary: 1
path: '/config.json'

initialization: commonImg.initialization
14 changes: 14 additions & 0 deletions layers/meta-balena-beaglebone/conf/layer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ UBOOT_CONFIG_FRAGMENTS:beaglebone-ai64-k3r5 = ""
KERNEL_IMAGETYPES:beaglebone-ai64 = "Image"
KERNEL_CLASSES:beaglebone-ai64 = "kernel-uimage"

MACHINE_FEATURES:remove:beagleplay = "efi"

PREFERRED_PROVIDER_virtual/bootloader:beagleplay = "u-boot-bb.org"
PREFERRED_PROVIDER_virtual/bootloader:beagleplay-k3r5 = "u-boot-bb.org"
PREFERRED_PROVIDER_u-boot:beagleplay = "u-boot-bb.org"
PREFERRED_PROVIDER_u-boot:beagleplay-k3r5 = "u-boot-bb.org"
PREFERRED_VERSION_u-boot-tools:beagleplay ?= "2022.01"
PREFERRED_VERSION_u-boot-tools:beagleplay-k3r5 ?= "2022.01"
PREFERRED_VERSION_u-boot-tools-native:beagleplay ?= "2022.01"
PREFERRED_VERSION_u-boot-tools-native:beagleplay-k3r5 ?= "2022.01"

PREFERRED_PROVIDER_virtual/kernel:beagleplay = "linux-bb.org"
PREFERRED_PROVIDER_virtual/kernel:beagleplay-k3r5 = "linux-bb.org"

LAYERSERIES_COMPAT_balena-beaglebone = " kirkstone "
MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove = "kernel-image-zimage"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove = "kernel-image-image"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#MACHINE ?= "beaglebone-green-gateway"
#MACHINE ?= "beaglebone-green-wifi"
#MACHINE ?= "beaglebone-pocket"
#MACHINE ?= "beagleplay"

# More info meta-resin/README.md
#TARGET_REPOSITORY ?= ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 955cb9fb2302c5b2caff328b7516382f60295682 Mon Sep 17 00:00:00 2001
From: delhiryder <[email protected]>
Date: Mon, 20 Nov 2023 22:39:22 +0000
Subject: [PATCH] Added device tree fix (as suggested by Nishanth Menon) for
the wlcore/wl1271_sdio_mmc2 error messages

---
arch/arm/dts/k3-am625-beagleplay.dts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-am625-beagleplay.dts b/arch/arm/dts/k3-am625-beagleplay.dts
index 0bc609fd00..f89188356a 100644
--- a/arch/arm/dts/k3-am625-beagleplay.dts
+++ b/arch/arm/dts/k3-am625-beagleplay.dts
@@ -108,7 +108,8 @@
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
enable-active-high;
- regulator-always-on;
+ /* regulator-always-on; */
+ regulator-off-in-suspend;
vin-supply = <&vdd_3v3>;
gpio = <&main_gpio0 38 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_BOOTCOMMAND="run set_led_state_start_load; if run finduuid; then run envboot; bootflow scan -lb; else setenv resin_kernel_load_addr ${kernel_addr_r}; run resin_set_kernel_root; env set mmcdev 0; env set bootpart 0:2; run envboot; run get_kern_${boot}; setenv bootargs console=${console} ${optargs} ${resin_kernel_root} rw rootfstype=${mmcrootfstype}; setenv name_fdt k3-am625-beagleplay.dtb; run get_fdt_${boot}; run run_kern; fi;"

Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,61 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}"

inherit resin-u-boot

SRC_URI += " \
SRC_URI:append:beaglebone-ai64 = " \
acostach marked this conversation as resolved.
Show resolved Hide resolved
file://integrate_with_balena_u-boot-environment.patch \
file://balenaos_bootcommand.cfg \
file://0005-env_default.h-Add-support-for-OS_KERNEL_CMDLINE.patch \
file://set_right_dtb_path.patch \
"

UBOOT_MACHINE:beagleplay = "am62x_beagleplay_a53_defconfig"
UBOOT_MACHINE:beagleplay-k3r5 = "am62x_beagleplay_r5_defconfig"

# No need to use the UBOOT_CONFIG_FRAGMENTS from the meta-ti layer for the beagplay,
# since the 2024.04-BeaglePlay branch already has the necessary changes.
UBOOT_CONFIG_FRAGMENTS:beagleplay = ""
UBOOT_CONFIG_FRAGMENTS:beagleplay-k3r5 = ""

SRC_URI:append:beagleplay = " \
file://balenaos_bootcommand_beagleplay_emmc.cfg \
file://0001-Added-device-tree-fix-as-suggested-by-Nishanth-Menon.patch \
"

DEPENDS:append:beaglebone-ai64-k3r5 = " python3-yamllint-native python3-pathspec-native"

DEPENDS:append:beagleplay-k3r5 = " python3-yamllint-native python3-pathspec-native"


PV:beaglebone-ai64 = "2023.04"
PV:beaglebone-ai64-k3r5 = "2023.04"
BRANCH:beaglebone-ai64 = "v2023.04-ti-09.00.00.007"
SRCREV:beaglebone-ai64 = "354f64f67e5b36df0027dbfbf071503b0071f4ed"
BRANCH:beaglebone-ai64-k3r5 = "v2023.04-ti-09.00.00.007"
SRCREV:beaglebone-ai64-k3r5 = "354f64f67e5b36df0027dbfbf071503b0071f4ed"

PV:beagleplay = "2024.04"
PV:beagleplay-k3r5 = "2024.04"
BRANCH:beagleplay= "v2024.04-BeaglePlay"
BRANCH:beagleplay-k3r5= "v2024.04-BeaglePlay"
SRCREV:beagleplay = "881379e9e286d0b40d9f054a1d176cbbcfed835e"
SRCREV:beagleplay-k3r5 = "881379e9e286d0b40d9f054a1d176cbbcfed835e"
SPL_BINARY:beagleplay = "tispl.bin_unsigned"
SPL_BINARYNAME:beagleplay = "tispl.bin_unsigned"

# Generate an extlinux.conf file
UBOOT_EXTLINUX = "1"
UBOOT_EXTLINUX_ROOT = "root=/dev/mmcblk1p2"

UBOOT_EXTLINUX_KERNEL_ARGS = "rootwait rw rootfstype=ext4"
UBOOT_EXTLINUX_KERNEL_IMAGE = "../${KERNEL_IMAGETYPE}"
UBOOT_EXTLINUX_FDTDIR = "../"

# The BB-AI64 creates this file for both archs, remove one.
do_deploy:append:beaglebone-ai64-k3r5 () {
rm -vf ${DEPLOYDIR}/extra_uEnv.txt
}

# The Beagleplay *also* creates this file for both archs, remove one.
do_deploy:append:beagleplay-k3r5 () {
rm -vf ${DEPLOYDIR}/extra_uEnv.txt
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 018921ee79d3f30893614b3b2b63b588d8544f73 Mon Sep 17 00:00:00 2001
From: Peter Robinson <[email protected]>
Date: Thu, 30 Jan 2020 09:37:15 +0000
Subject: [PATCH] Remove redundant YYLOC global declaration

Same as the upstream fix for building dtc with gcc 10.

Signed-off-by: Peter Robinson <[email protected]>
---
scripts/dtc/dtc-lexer.l | 1 -
1 file changed, 1 deletion(-)

diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index fd825ebba6..24af549977 100644
--- a/scripts/dtc/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n
#include "srcpos.h"
#include "dtc-parser.tab.h"

-YYLTYPE yylloc;
extern bool treesource_error;

/* CAUTION: this will stop working if we ever use yyless() or yyunput() */
--
2.26.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
inherit resin-u-boot

FILESEXTRAPATHS:append := ":${THISDIR}/${PN}"

SRC_URI += " \
file://remove-redundant-yyloc-global.patch \
"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SRC_URI:aarch64 = "git://git.beagleboard.org/beagleboard/18xx-ti-utils.git;protocol=https;branch=R8.7_SP3-bbb.io"
SRCREV:aarch64 = "ba027b093aa013637fcc6271c2d47f3ce99e933e"

do_install:append:aarch64() {
install -m 0755 device-20221220-wl18xx-conf.bin ${D}${sbindir}/wlconf/
install -m 0755 device-20221220-wl18xx-conf.bin ${D}${nonarch_base_libdir}/firmware/ti-connectivity/wl18xx-conf.bin
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
include balena-image.inc

BALENA_BOOT_PARTITION_FILES:append:beaglebone = " uEnv.txt_internal:"

BALENA_BOOT_PARTITION_FILES:append:beagleplay = " \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @delhiryder this commit can be removed completely since @acostach worked out in 1eae4da that we can skip using extlinux.conf

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK @floion

extlinux.conf:/extlinux/extlinux.conf \
"

IMAGE_INSTALL:append:beaglebone = " bb-org-overlays"
IMAGE_INSTALL:append:beaglebone-ai64 = " mmc-utils vxd-dec-fw"
IMAGE_INSTALL:append:beagleplay = " mmc-utils"
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
# on the initramfs.
IMAGE_ROOTFS_MAXSIZE:beaglebone-ai64 = "65536"
PACKAGE_INSTALL:append:beaglebone-ai64 = " cadence-mhdp-fw"
IMAGE_ROOTFS_MAXSIZE:beagleplay = "65536"
IMAGE_ROOTFS_MAXSIZE:beagleplay-k3r5 = "65536"
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ IMAGE_ROOTFS_SIZE:beaglebone-ai64 = "733184"
IMAGE_INSTALL:append:beaglebone = " bb-org-overlays fix-mmc-bbb bb-wl18xx-bluetooth bb-wl18xx-wlan0"
IMAGE_INSTALL:append:beaglebone-ai64 = " mmc-utils vxd-dec-fw"
IMAGE_INSTALL:append:beaglebone-pocket = " boot-scripts"
IMAGE_INSTALL:append:beagleplay = " mmc-utils"

IMAGE_ROOTFS_SIZE:beagleplay = "1966080"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Root partitions are way too large, 733184 would be more appropriate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Alexandru, please refer to this thread from zulip. @floion and I have already gone down the path of trying to reduce the size of the root partition, but not had any success. Here's the original post from Alex (from last September).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @delhiryder , the links you shared take me to the extlinux discussions, I don't see anything about the boot and root partitions sizes. The problem with this is that the flasher image cannot be archived using zip due to the 4GB limit for zip files. cc @floion

10 changes: 10 additions & 0 deletions layers/meta-balena-beaglebone/recipes-core/images/balena-image.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ IMAGE_FSTYPES:append:beaglebone = " balenaos-img balenaos-img.bmap"
IMAGE_FSTYPES:append:beaglebone-pocket = " balenaos-img"
IMAGE_FSTYPES:append:beagleboard-xm = " balenaos-img"

BALENA_BOOT_SIZE:beagleplay = "327680"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, ~100MB should be more than sufficient for the boot partition

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment above.


# Customize balenaos-img
BALENA_BOOT_PARTITION_FILES:beaglebone = " \
MLO: \
Expand All @@ -25,6 +27,14 @@ BALENA_BOOT_PARTITION_FILES:beagleboard-xm = " \
u-boot.img: \
"

BALENA_BOOT_PARTITION_FILES:beagleplay = " \
tispl.bin_unsigned:/tispl.bin \
u-boot.img: \
tiboot3.bin: \
${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \
k3-am625-beagleplay.dtb: \
"

# Beaglebone expects the kernel and dtbs on rootfs
IMAGE_INSTALL:append = " kernel-image-initramfs kernel-devicetree wlconf"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Manager]
RuntimeWatchdogSec=0
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FILESEXTRAPATHS:append := ":${THISDIR}/${PN}"
Copy link
Contributor

@acostach acostach Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave a note here too on the reason for disabling the watchdog

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already added a line to the commit message: fc7769e (reproduced below):

"Also, disabled the hardware watchdog (due an ongoing open issue, whose fix is currently being tested). Add the "test_watchdog" package to the kernel package (for easy verification of the patch, when it become available)."

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't hurt to leave a comment in the file because it's quicker for someone investigating a problem and looking at this file on a remote device to understand the reason behind the configuration. Otherwise he would have to go find the device integration repository, search for the yocto package as well as for the layer which provides/modifies it then look in the git history for it, to finally understand why. cc @floion


SRC_URI:append = " \
file://watchdog-disable.conf \
"

do_install:append() {
# enable watchdog
install -d -m 0755 ${D}/${sysconfdir}/systemd/system.conf.d
install -m 0644 ${WORKDIR}/watchdog-disable.conf ${D}/${sysconfdir}/systemd/system.conf.d/watchdog.conf
}







Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

PACKAGECONFIG:append:aarch64 = " watchdog"
TEST_LIST:append:aarch64 = "\
watchdog \
"

CFLAGS:append:aarch64 = " -static"
Copy link
Contributor

@acostach acostach Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@delhiryder do you know why this recipe was needed? It seems the device works with the linux-firmware provided by meta-balena. Unless there is a specific reason for it, we can drop this and thus decrease partitions and the total image size

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @delhiryder please delete this recipe as it was tested by Alex that it does not seem to be needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK @floion

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PV:beagleplay = "09.00.00.011"
BPN:beagleplay = "ti-linux-firmware"
SRC_URI:beagleplay = "https://github.com/beagleboard/${BPN}/archive/refs/tags/${PV}.tar.gz"

python __anonymous () {
import os
machine = os.getenv('MACHINE')
if machine == "beagleplay":
d.setVarFlag("SRC_URI", "sha256sum", "4ba370a5975131a638c7500d96596313588ab63f19048097f0650e6a7abaf551")
else:
d.setVarFlag("SRC_URI", "sha256sum", "c3f9ad2bb5311cce2490f37a8052f836703d6936aabd840246b6576f1f71f607")
}

#SRC_URI:beagleplay[sha256sum] = "4ba370a5975131a638c7500d96596313588ab63f19048097f0650e6a7abaf551"
WHENCE_CHKSUM:beagleplay = "4279eb9fcb7c0c9e9303a171f491c0e4"

SRC_URI:class-devupstream:beagleplay = "https://github.com/beagleboard/${BPN}/archive/refs/tags/${PV}.tar.gz"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 1920d52d6f37b57d43f9adf533fd40045fe3132b Mon Sep 17 00:00:00 2001
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch is not being applied and also tested that without it the wifi does not have issues so it can be deleted from here @delhiryder

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK @floion

From: delhiryder <[email protected]>
Date: Tue, 21 Nov 2023 01:41:09 +0000
Subject: [PATCH] Changed the behavior of the wlan_en (regulator-3) to
'regulator-off-in-suspend'. Fix for the wlcore/wl1271_sdio_mmc2 errors.

---
arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts b/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
index eda9b77f49ac..0f6ef0693105 100644
--- a/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
+++ b/arch/arm64/boot/dts/ti/k3-am625-beagleplay.dts
@@ -140,7 +140,8 @@ wlan_en: regulator-3 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
enable-active-high;
- regulator-always-on;
+ /* regulator-always-on; */
+ regulator-off-in-suspend;
vin-supply = <&vdd_3v3>;
gpio = <&main_gpio0 38 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
inherit kernel-balena

PV:aarch64 = "6.1.80+git${SRCPV}"
SRCREV:aarch64 = "6.1.80-ti-arm64-r58"
TAG:aarch64 = "6.1.80-ti-arm64-r58"
SRC_URI:aarch64 = " \
git://github.com/beagleboard/linux.git;protocol=https;nobranch=1;tag=${TAG} \
file://defconfig \
"
# SRC_URI:aarch64 = "https://github.com/beagleboard/linux/archive/refs/tags/6.1.80-ti-rt-arm64-r58.tar.gz;protocol=https"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

#
# Script used by hostapps updater to flash bootloader onto internal media.
#

set -o errexit

# The following lines of code are copied from
# https://openbeagle.org/beagleboard/repos-arm64/-/blob/main/bb-u-boot-beagleplay-debian-12/suite/bookworm/debian/install-emmc.sh?ref_type=heads

if [ -b /dev/mmcblk0 ] ; then
#mmc extcsd read /dev/mmcblk0
mmc bootpart enable 1 2 /dev/mmcblk0
mmc bootbus set single_backward x1 x8 /dev/mmcblk0
mmc hwreset enable /dev/mmcblk0 | true

echo "Clearing eMMC boot0"

echo '0' >> /sys/class/block/mmcblk0boot0/force_ro

echo "dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k"
dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k

echo "dd if=/resin-boot/tiboot3.bin of=/dev/mmcblk0boot0 bs=128k"
dd if=/resin-boot/tiboot3.bin of=/dev/mmcblk0boot0 bs=128k
fi

sync

echo 1 > /sys/block/mmcblk0boot0/force_ro
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ FILESEXTRAPATHS:append := ":${THISDIR}/files"

HOSTAPP_HOOKS += "99-resin-uboot"

HOSTAPP_HOOKS:append:beaglebone-ai64 = " 99-flash-bootloader-beaglebone-ai64"
HOSTAPP_HOOKS:append:beaglebone-ai64 = " 99-flash-bootloader-beaglebone-ai64"
HOSTAPP_HOOKS:append:beagleplay = " 99-flash-bootloader-beagleplay"
Loading