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 #679

Closed

Conversation

delhiryder
Copy link
Collaborator

Opening a 'development' pull request, to allow the Balena team to inspect the proposed changes. Code is not (yet) building or running.

@resin-jenkins
Copy link

Can one of the admins verify this patch?

@delhiryder delhiryder force-pushed the add_beagleplay_support_take_4 branch from 97ccbba to 0af3109 Compare May 17, 2024 19:11
@delhiryder
Copy link
Collaborator Author

The Pull Request has been cleaned up and is now ready for review. Code is successfully building a balena-image-flasher target for the beageplay.

@delhiryder
Copy link
Collaborator Author

@floion - any updates on this ?

@floion floion force-pushed the add_beagleplay_support_take_4 branch from 0af3109 to 6d01bfd Compare May 23, 2024 11:43
@floion floion enabled auto-merge May 23, 2024 11:44
@@ -1,2 +1,7 @@
inherit kernel-balena

# BRANCH:aarch64 = "v5.10.168-ti-arm64-r111"
Copy link
Collaborator

Choose a reason for hiding this comment

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

These comments can be removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like @floion has already removed this comment in the new PR (#682)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's have them removed from here. PR 682 is just for testing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The comments have been removed on this PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not resolved

@@ -0,0 +1,2 @@
CONFIG_CMD_BOOTEFI=
CONFIG_EFI_LOADER=
Copy link
Collaborator

Choose a reason for hiding this comment

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

If not using u-boot-ti-staging, then these can be removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed in the latest version of the PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

These still seem to be here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed now... Please confirm and resolve.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not resolved

@@ -1,7 +1,3 @@
inherit kernel-balena

# BRANCH:aarch64 = "v5.10.168-ti-arm64-r111"
Copy link
Collaborator

Choose a reason for hiding this comment

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

These changes from here should be removed from here and also the comments should not be added at all in the previous comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

FILESEXTRAPATHS:append:beaglebone-ai64 := "${THISDIR}/${PN}-beaglebone-ai64"
FILESEXTRAPATHS:append:beagleplay := "${THISDIR}/${PN}-beagleplay"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this added? It does not seem you are using any script for flashing the beagleplay

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. Will remove and retest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I still see this added here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed now. Please confirm and resolve as needed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not resolved

IMAGE_FSTYPES:append:beagleplay = " balenaos-img"
IMAGE_FSTYPES:append:beagleplay-k3r5 = " balenaos-img"

BALENA_BOOT_SIZE:beagleplay="327680"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why use such a large partition? What is the actual size of the files in 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.

The u-boot-bb.org partition is reproduced below from my build machine. Looks like the total size of the files here is 672K, so we should be ok using the default. Will change and retest.

ubuntu@ip-172-31-16-228:~/balena-beaglebone/build/tmp/work/beagleplay_k3r5-poky-eabi/u-boot-bb.org/1_2024.04+gitAUTOINC+881379e9e2-r0/deploy-u-boot-bb.org$ ls -ltrh
total 668K
-rw-r--r-- 2 ubuntu ubuntu 127K May 17 15:56 u-boot-r5spl-beagleplay-2024.04+gitAUTOINC+881379e9e2-r0.bin
lrwxrwxrwx 2 ubuntu ubuntu   60 May 17 15:56 u-boot-r5spl.bin -> u-boot-r5spl-beagleplay-2024.04+gitAUTOINC+881379e9e2-r0.bin
lrwxrwxrwx 2 ubuntu ubuntu   60 May 17 15:56 u-boot-r5spl-beagleplay.bin -> u-boot-r5spl-beagleplay-2024.04+gitAUTOINC+881379e9e2-r0.bin
-rw-r--r-- 2 ubuntu ubuntu 260K May 17 15:56 tiboot3-am62x-gp-evm-beagleplay-k3r5-2024.04+gitAUTOINC+881379e9e2-r0.bin
lrwxrwxrwx 2 ubuntu ubuntu   73 May 17 15:56 tiboot3.bin -> tiboot3-am62x-gp-evm-beagleplay-k3r5-2024.04+gitAUTOINC+881379e9e2-r0.bin
lrwxrwxrwx 2 ubuntu ubuntu   73 May 17 15:56 tiboot3-am62x-gp-evm -> tiboot3-am62x-gp-evm-beagleplay-k3r5-2024.04+gitAUTOINC+881379e9e2-r0.bin
-rw-r--r-- 2 ubuntu ubuntu  194 May 17 15:56 extlinux.conf-beagleplay-k3r5-r0
lrwxrwxrwx 2 ubuntu ubuntu   32 May 17 15:56 extlinux.conf-beagleplay-k3r5 -> extlinux.conf-beagleplay-k3r5-r0
-rw-r--r-- 2 ubuntu ubuntu 260K May 17 15:56 tiboot3-am62x-gp-evm.bin
lrwxrwxrwx 1 ubuntu ubuntu   32 May 17 15:56 extlinux.conf -> extlinux.conf-beagleplay-k3r5-r0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@floion - I was unable to remove this line. The do_resin_boot_dirgen_and_deploy task was failing (see snippet below):

ERROR: balena-image-flasher-1.0-r0 do_resin_boot_dirgen_and_deploy: resin-boot: Not enough space for atomic copy operations.
ERROR: balena-image-flasher-1.0-r0 do_resin_boot_dirgen_and_deploy: ExecutionError('/home/ubuntu/balena-beaglebone/build/tmp/work/beagleplay-poky-linux/balena-image-flasher/1.0-r0/temp/run.do_resin_boot_dirgen_and_deploy.2753352', 1, None, None)
ERROR: Logfile of failure stored in: /home/ubuntu/balena-beaglebone/build/tmp/work/beagleplay-poky-linux/balena-image-flasher/1.0-r0/temp/log.do_resin_boot_dirgen_and_deploy.2753352
ERROR: Task (/home/ubuntu/balena-beaglebone/build/../layers/meta-balena/meta-balena-common/recipes-core/images/balena-image-flasher.bb:do_resin_boot_dirgen_and_deploy) failed with exit code '1'

Keeping it in the recipe (for now)

Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to check the size of the resin-boot partition. You can see what files get added in there by looking at something like tmp/work/<board>-poky-linux/balena-image/1.0-r0/resin-boot in your build directory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hey @floion : Here is the output of my ls -ltrh command from my latest build directory:

ubuntu@ip-172-31-16-228:~/balena-beaglebone/build/tmp/work/beagleplay-poky-linux/balena-image/1.0-r0/resin-boot$ ls -ltrh
total 62M
-rw-r--r-- 1 ubuntu ubuntu 1.3M Jun  4 22:17 tispl.bin
-rw-r--r-- 1 ubuntu ubuntu 746K Jun  4 22:17 u-boot.img
-rw-r--r-- 1 ubuntu ubuntu 260K Jun  4 22:17 tiboot3.bin
-rw-r--r-- 1 ubuntu ubuntu  61M Jun  4 22:17 Image
-rw-r--r-- 1 ubuntu ubuntu  63K Jun  4 22:17 k3-am625-beagleplay.dtb
drwxr-xr-x 2 ubuntu ubuntu 4.0K Jun  4 22:17 extlinux
drwxr-xr-x 2 ubuntu ubuntu 4.0K Jun  4 22:17 splash
-rw-r--r-- 1 ubuntu ubuntu  187 Jun  4 22:17 os-release
drwxr-xr-x 3 ubuntu ubuntu 4.0K Jun  4 22:17 EFI
-rw-r--r-- 1 ubuntu ubuntu 2.8K Jun  4 22:17 device-type.json
drwxr-xr-x 2 ubuntu ubuntu 4.0K Jun  4 22:17 system-connections
drwxr-xr-x 2 ubuntu ubuntu 4.0K Jun  4 22:17 system-proxy
-rw-r--r-- 1 ubuntu ubuntu    0 Jun  4 22:17 extra_uEnv.txt
-rw-r--r-- 1 ubuntu ubuntu   39 Jun  4 22:17 image-version-info
-rw-r--r-- 1 ubuntu ubuntu   24 Jun  4 22:17 balena-image
-rw-r--r-- 1 ubuntu ubuntu   69 Jun  4 22:17 config.json
-rw-r--r-- 1 ubuntu ubuntu  919 Jun  4 22:17 balenaos.fingerprint

Looks like my build is storing the actual kernel image inside the resin_boot directory. Am assuming this is wrong ? How do I fix this ?

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 think one way to do this may be use a compressed version of the kernel image. Can you suggest how this may be done ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume you also have the kernel in the rootfs in the /boot directory. You should instruct u-boot to load the kernel from there instead and doing so you can remove the kernel from the boot partition.
Also, is there a need for k3-am625-beagleplay.dtb in the boot partition? I think you can delete this one also.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As suggested by @floion , I changed the extlinux configuration to pick up the image and DTB files from the /boot partition. This reduced the size of the resin-boot partition to about 2.3 M (which enabled the removal of the extra BALENA_BOOT_SIZE line from this file).

Please review and resolve as needed.

IMAGE_ROOTFS_MAXSIZE:beagleplay = "1966080"
IMAGE_ROOTFS_MAXSIZE:beagleplay-k3r5 = "1966080"

IMAGE_ROOTFS_SIZE:beagleplay = "1966080"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why use so much space? What is the actual size of the generated rootfs?

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 recall that I needed to increase the rootfs_size to get the yocto build to run to completion. I recall that I increased the rootfs in two or three steps (doubling and then tripling it) before things worked.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Like for above, to check how big the rootfs is you can look at tmp/work/<board>-poky-linux/balena-image/1.0-r0/rootfs in your build directory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@floion - here's the output from the du -h command:

ubuntu@ip-172-31-16-228:~/balena-beaglebone/build/tmp/work/beagleplay-poky-linux/balena-image/1.0-r0/rootfs$ du -h --max-depth=1
4.0K    ./proc
72M     ./boot
4.0K    ./sys
62M     ./resin-boot
16K     ./home
2.8M    ./sbin
4.0K    ./media
1.2G    ./lib
4.0K    ./tmp
149M    ./usr
4.0K    ./srv
4.0K    ./run
4.0K    ./dev
12K     ./quirks
4.0K    ./resin-data
72K     ./var
2.6M    ./etc
28K     ./mnt
6.0M    ./bin
1.4G    .

Looks like the bulk of the usage is in the lib subfolder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Which in turn has a (very) large firmware folder:

ubuntu@ip-172-31-16-228:~/balena-beaglebone/build/tmp/work/beagleplay-poky-linux/balena-image/1.0-r0/rootfs/lib$ du -h --max-depth=1
7.3M    ./systemd
1.1G    ./firmware
12K     ./resolvconf
38M     ./modules
12K     ./modprobe.d
12K     ./depmod.d
576K    ./udev
1.2G    .

@floion
Copy link
Collaborator

floion commented May 23, 2024

@delhiryder please see the comments I left above.

Also, the Changelog-entry footer in the git commit log is supposed to be an entry reflecting what the PR changes / adds to the repository. So in your case, there is no need for a Changelog-entry in each commit saying what that commit has made, but rather you can pick one of the commits and add a changelog entry there which would simply say that the Beagleplay support was added.

@floion
Copy link
Collaborator

floion commented May 26, 2024

@resin-jenkins test this please

@delhiryder delhiryder force-pushed the add_beagleplay_support_take_4 branch 3 times, most recently from 95544c2 to 971b42c Compare June 6, 2024 21:29
@delhiryder
Copy link
Collaborator Author

Updated the PR. @floion please review and let me know if this looks ok.

}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please delete the extra line added

# SRCREV:aarch64 = "ac0ddc64cced3bdaa8ba5aa56a9a3cdc01825744"
# PV:aarch64 = "5.10.168+git${SRCPV}"

SRC_URI:remove:aarch64 = " file://0001-defconfig-switch-default-kernel-compression-to-LZMA.patch"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, aside from removing these comments, is it also mandatory to remove the patch also?

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 will remove this line and retest.

Added a new 'beagleplay' device type coffee script. Also updated the "#Supported Machines" sections of the local.conf.sample to make the 'beagleplay' machine target available for building via bitbake.
@delhiryder delhiryder force-pushed the add_beagleplay_support_take_4 branch from 971b42c to 7b962bf Compare June 11, 2024 16:01
@delhiryder
Copy link
Collaborator Author

@floion - rebased and updated the PR. Please take a look.

@floion floion force-pushed the add_beagleplay_support_take_4 branch from 7b962bf to 51cd3e1 Compare June 13, 2024 07:10
@flowzone-app flowzone-app bot enabled auto-merge June 13, 2024 07:16
auto-merge was automatically disabled June 13, 2024 19:34

Head branch was pushed to by a user without write access

@delhiryder delhiryder force-pushed the add_beagleplay_support_take_4 branch from 51cd3e1 to 6751010 Compare June 13, 2024 19:34
@floion floion force-pushed the add_beagleplay_support_take_4 branch from 6751010 to 7df302a Compare June 20, 2024 12:10
tiboot3.bin: \
${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \
k3-am625-beagleplay.dtb: \
extlinux.conf:/extlinux/extlinux.conf \
Copy link
Collaborator

Choose a reason for hiding this comment

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

If only the flasher is using extlinux.conf then this needs to be moved out of here and instead added to balena-image-flasher.bbappend If you add it to the balena-image.inc, it will also be included in the non-flasher image and I believe that one is not supposed to use 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.

I have made this change.

# the name of the bootloader config file to be written to internal media
INTERNAL_DEVICE_BOOTLOADER_CONFIG:beaglebone = "uEnv.txt_internal"
INTERNAL_DEVICE_BOOTLOADER_CONFIG:beagleplay = "uEnv.txt_internal"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we use this so it can be removed

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 made this change.


# the pathname (relative to /boot/) where the internal bootloader config file should reside in
# (currently assuming this is on partition 1 of the internal media)
INTERNAL_DEVICE_BOOTLOADER_CONFIG_PATH:beaglebone = "/uEnv.txt"
INTERNAL_DEVICE_BOOTLOADER_CONFIG_PATH:beagleplay = "/uEnv.txt"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we use this so it can be removed

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 made this change.

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

Choose a reason for hiding this comment

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

This append here can be removed since we do not really care about the beagleplay-k3r5 machine

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed , as requested.

@@ -2,23 +2,66 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}"

inherit resin-u-boot

SRC_URI += " \
SRC_URI:append:beaglebone-ai64-k3r5 = " \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be SRC_URI:append:beaglebone-ai64 instead of SRC_URI:append:beaglebone-ai64-k3r5 since we do not care about that machine and also keeps this code clearer for the future when somebody looks into it.

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 made this change.

For the beagleplay MC targets, change this to "u-boot-bb.org" (this is maintained by the bb/ti team). Explicity set the UBOOT_GIT_URI to the one from git.beagleboard.org. Also specified the release version and SRCREV.
Added an extlinux.conf file, to ensure that the OS boots up properly. Added patches suggested by the beagleboard discord community - these were needed to get the wlcore startup errors being encountered during initial bootup.
Add kernel wlan_en regulator patch as suggested by Nishanth Menon (of TI). 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 easiy verification of the patch, when it become available).
Added appropriate variables and append/remove packages and packagegroups to the balena-image* recipes. Had to increase the IMAGE_ROOTFS_SIZE to 1966080 to enable the recipe to run to completion.
Updated the balena-image-flasher and associated dependent recipes to support building a balena-image-flasher image for the beagleplay device.

Changelog-entry: Add beagleplay support
Signed-off-by: Sidd Gupta <[email protected]>
Make sure to get the wl18xx-conf.bin file from the `beagleboard` repo (instead of the git.ti.com one). This is needed (in conjunction with the 6.1.80 kernel) to make sure the wifi interface comes up properly.
@floion
Copy link
Collaborator

floion commented Aug 30, 2024

Superseded by #686

@floion floion closed this Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants