Skip to content

Commit

Permalink
torizon-common: Add beagleplay initial support
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Castello <[email protected]>
  • Loading branch information
microhobby committed Sep 18, 2024
1 parent 2a0cce6 commit 75d0a65
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 4 deletions.
9 changes: 6 additions & 3 deletions conf/distro/include/torizon.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ IMAGE_BOOT_FILES_REMOVE:sota = "boot.scr-${MACHINE};boot.scr overlays.txt overla
IMAGE_BOOT_FILES_REMOVE:append:apalis-imx8 = " hdmitxfw.bin dpfw.bin"

DISTRO_FEATURES:append = " virtualization stateless-system"
# FIXME: We need the opengl for beagleplay, but this can be an issue for
# upstream, so I'm comenting here to not forget in the next rebase
DISTRO_FEATURES:remove = "3g alsa irda pcmcia nfc ldconfig pulseaudio wayland x11 ptest multiarch vulkan"
DISTRO_FEATURES:imx-generic-bsp:remove = "opengl"

# FIXME: This can be an issue for the upstream, so we are only commenting
# instead of removing it.
# No need for x11 even for native
DISTRO_FEATURES_NATIVE:imx-generic-bsp:remove = "x11"
DISTRO_FEATURES_NATIVESDK:imx-generic-bsp:remove = "x11"
# DISTRO_FEATURES_NATIVE:remove = "x11"
# DISTRO_FEATURES_NATIVESDK:remove = "x11"

# Note, enable or disable the useradd-staticids in a configured system,
# the TMPDIR/DEPLOY_DIR/SSTATE_DIR may contain incorrect uid/gid values.
Expand Down
74 changes: 74 additions & 0 deletions conf/machine/include/beagleplay.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# taken from meta-freescale/conf/machine/include/utilities.inc
def make_dtb_boot_files(d):
# Generate IMAGE_BOOT_FILES entries for device tree files listed in
# KERNEL_DEVICETREE.
# Use only the basename for dtb files:
alldtbs = d.getVar('KERNEL_DEVICETREE')


# DTBs may be built out of kernel with devicetree.bbclass
if not alldtbs:
return ''

def transform(dtb):
if not (dtb.endswith('dtb') or dtb.endswith('dtbo')):
# eg: whatever/bcm2708-rpi-b.dtb has:
# DEPLOYDIR file: bcm2708-rpi-b.dtb
# destination: bcm2708-rpi-b.dtb
bb.error("KERNEL_DEVICETREE entry %s is not a .dtb or .dtbo file." % (dtb) )
return os.path.basename(dtb)

return ' '.join([transform(dtb) for dtb in alldtbs.split() if dtb])

WKS_FILE = "sdimage-2part.wks"
WKS_FILE_DEPENDS:remove = "tezi-metadata virtual/dtb"
CORE_IMAGE_BASE_INSTALL:append = "resize-helper"

KERNEL_BUILTIN_WIREGUARD:beagleplay = "1"
CORE_IMAGE_BASE_INSTALL:remove = "kernel-module-wireguard wireguard-tools"
PREFERRED_PROVIDER_virtual/bootloader = "u-boot-bb.org"
PREFERRED_PROVIDER_virtual/bootloader:sota = "u-boot-bb.org"
PREFERRED_PROVIDER_virtual/bootloader:beagleplay = "u-boot-bb.org"
PREFERRED_PROVIDER_u-boot:beagleplay = "u-boot-bb.org"
PREFERRED_PROVIDER_virtual/dtb = ""
WKS_FILE_DEPENDS_BOOTLOADERS:beagleplay = "virtual/bootloader"
WKS_FILE_DEPENDS:append:beagleplay = " u-boot-default-script"
PREFERRED_PROVIDER_u-boot-default-script:beagleplay = "u-boot-distro-boot"
PREFERRED_PROVIDER_u-boot-default-script:sota:beagleplay = "u-boot-distro-boot"

PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv"
PREFERRED_RPROVIDER_u-boot-fw-utils = "libubootenv"

IMAGE_FSTYPES:remove:beagleplay = "ext3 jffs2 teziimg"

# We need ota-ext4 and wic for beagle
IMAGE_FSTYPES_REMOVE = ""
IMAGE_BOOT_FILES:beagleplay = "u-boot.img tispl.bin tiboot3.bin ${@make_dtb_boot_files(d)} "
IMAGE_BOOT_FILES:sota:beaglebone-yocto = "u-boot.img tispl.bin tiboot3.bin ${@make_dtb_boot_files(d)} "
IMAGE_BOOT_FILES_REMOVE:sota:remove = "boot.scr-${MACHINE};boot.scr"
IMAGE_BOOT_FILES:append = " boot.scr-${MACHINE};boot.scr "

LINUX_VERSION_EXTENSION = "-torizon-${LINUX_KERNEL_TYPE}"

## same bahavior
# This boot arguments are the same from torizon.bbclass
OSTREE_KERNEL_ARGS:sota:append:beagleplay = "console=ttyS2,115200 root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash "

UBOOT_BINARY_OTA_IGNORE:beagleplay = "1"

PREFERRED_PROVIDER_virtual/mesa = "mesa-pvr"
PREFERRED_PROVIDER_virtual/egl = "mesa-pvr"
PREFERRED_PROVIDER_virtual/libgles1 = "mesa-pvr"
PREFERRED_PROVIDER_virtual/libgles2 = "mesa-pvr"
PREFERRED_PROVIDER_virtual/libgles3 = "mesa-pvr"
PREFERRED_PROVIDER_virtual/libgbm = "mesa-pvr"
PREFERRED_PROVIDER_virtual/libglx = "mesa-pvr"
PREFERRED_PROVIDER_virtual/libgl = "mesa-pvr"

INITRAMFS_MAXSIZE = "315400"

BBMASK += " \
meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex \
meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend \
meta-common-torizon/recipes-bsp/u-boot/u-boot-toradex_%.bbappend \
"
52 changes: 52 additions & 0 deletions recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/boot.cmd.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-License-Identifier: GPL-2.0+ OR MIT
#
# Copyright 2023 MicroHobby
#
# TorizonCore boot script.

setenv bootlimit 3
setenv devtype mmc
setenv devnum 1
setenv bootdevice 0
setenv otaroot 2

if test -z "${altbootcmd}"
then
env set altbootcmd 'env set rollback 1; run bootcmd'
env save
fi

if test "${rollback}" = "1" && test "${upgrade_available}" = "1"
then
# Make sure to reset upgrade_available to avoid unnecessary wear
# Note this also makes rollback permanent. aktualizr will reset rollback
# when a new (hopefully better) update comes in.
env set upgrade_available 0
env save
fi

# save default U-Boot devicetree file to use in a rollback situation
env set fdtfile "k3-am625-beagleplay.dtb"

if test -n "${loadaddr}"
then
ext4load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}
else
ext4load ${devtype} ${devnum}:${otaroot} ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize}
fi

if test "${debug}" = "1"
then
echo "Enabling kernel debug"
env set tdxargs "${tdxargs} rodata=off nokaslr maxcpus=1 kgdboc=ttymxc0,115200"
fi

# now that we have all the environment variables, we can set the bootcmd
setenv bootargs "${defargs} ${bootargs} ${tdxargs}"

ext4load ${devtype} ${devnum}:${otaroot} ${kernel_addr_r} /boot${kernel_image}
ext4load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} /boot${ramdisk_image}
env set ramdisk_size ${filesize}
load ${devtype} ${devnum}:1 ${fdt_addr_r} ${fdtfile}

@@KERNEL_BOOTCMD@@ ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr_r}
6 changes: 6 additions & 0 deletions recipes-bsp/u-boot/u-boot-distro-boot/beagleplay/uEnv.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kernel_image_type=@@KERNEL_IMAGETYPE@@
overlays_file="overlays.txt"
bootlimit=3
devtype=mmc
devnum=1
otaroot=2
5 changes: 5 additions & 0 deletions recipes-devtools/python/python3-cryptography_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# fix the wrong triple
do_compile:prepend() {
export CARGO_BUILD_TARGET="${RUST_HOST_SYS}"
}
5 changes: 5 additions & 0 deletions recipes-kernel/linux/files/beagleplay.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CONFIG_REMOTEPROC is not set
# CONFIG_PRU_REMOTEPROC is not set
# CONFIG_TI_K3_DSP_REMOTEPROC is not set
# CONFIG_TI_K3_R5_REMOTEPROC is not set
# CONFIG_TI_K3_M4_REMOTEPROC is not set
2 changes: 2 additions & 0 deletions recipes-kernel/linux/linux-bb.org_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

require common.inc
2 changes: 1 addition & 1 deletion scripts/setup-environment-internal
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fi
# Create a common list of "<machine>(<layer>)", sorted by <machine>
# Blacklist unsupported machines of TorizonCore
MACHLAYERS=$(find layers/ -print | grep "conf/machine/.*\.conf" |
grep -E '(apalis.*\.conf|colibri.*\.conf|verdin.*\.conf|qemuarm64\.conf|genericx86-64\.conf|raspberrypi4-64\.conf|raspberrypi3-64\.conf|intel-corei7-64\.conf|nezha-allwinner-d1\.conf|beaglebone-yocto\.conf)' |
grep -E '(apalis.*\.conf|colibri.*\.conf|verdin.*\.conf|qemuarm64\.conf|genericx86-64\.conf|raspberrypi4-64\.conf|raspberrypi3-64\.conf|intel-corei7-64\.conf|nezha-allwinner-d1\.conf|beaglebone-yocto\.conf|beagleplay\.conf)' |
grep -E -v '(imx7-nand|colibri-vf|tk1|colibri-imx7|colibri-imx6ull|verdin-am62-k3r5)\.conf' |
sed -e 's/\.conf//g' -e 's/layers\///' |
awk -F'/conf/machine/' '{print $NF "(" $1 ")"}' | LC_ALL=C sort)
Expand Down

0 comments on commit 75d0a65

Please sign in to comment.