logo elektroda
logo elektroda
X
logo elektroda

Demonstration: How to Customize and Build OpenBeken Firmware Directly in Your Browser

divadiow 
For the most common devices based on platforms supported by OpenBeken, the general firmware releases cater to most users' needs. Occasionally a device comes up that can only be partially made working with the standard firmware. Devices like the TH03 temperature and humidity sensor with segment display driven by a GN6932. To save space, the GN6932 driver was disabled by default.

For Beken firmwares, and others, enablement of a driver usually requires a change to the SDK, which are in submodules of the main app, in conjunction with a change to code in the main app. This typically requires creating your own fork of the main app and submodule, cloning to your PC, making the required changes to both forks, messing around with Git to get those changes in your submodule fork pushed upstream into the main app so you can eventually open a PR (pull request) to initiate a firmware build.

Thanks to @max4elektroda the process is a little easier now and can be completed in the browser. The idea was conceived here and later detailed here after release.

Using this new technique, the process of making a change to the OpenBK7231N submodule code through to downloading your compiled custom binaries will now be demonstrated. This demonstration relates to changes required to get OpenBeken fully working on a Moes Tuya Matter bulb but it serves as a template for the process to follow to make any number of customisations to OpenBeken.



Anyone wanting to convert their Moes Tuya Matter Beken device to OpenBeken, with the correct TLV partition address set in the build, no longer has to use the older binaries in PR (pull request) 1340 or mess around in the OpenBK7321N submodule, pushing changes upstream to a PR in the main app to start the build workflow. Changes can be made within the main app that are then applied to the submodule at build time.

PR 1340 required changes to BkDriverFlash.c here https://github.com/openshwprojects/OpenBK7231..._os/beken378/func/user_driver/BkDriverFlash.c

Create your own custom build on the latest code

-Register for a GitHub account and login

-Navigate to https://github.com/openshwprojects/OpenBK7231T_App and create your own fork of the main app
GitHub interface for the OpenBK7231T_App repository

-Customize your fork name or stick with the original
GitHub screen for creating a fork of the OpenBK7231T_App repository.

-In your fork navigate to the platforms folder then BK7231N

-Click Add file -> Create new file
Screenshot showing the GitHub interface on the OpenBK7231T_App page with the Create new file option selected.

-Type "override/" then the name of each folder of the rest of the submodule path followed by a "/" until you get the empty file to create - "BkDriverFlash.c" in this case.
Eventually you'll have created this path and file sdk/OpenBK7231N/platforms/bk7231n/bk7231n_os/beken378/func/user_driver/BkDriverFlash.c under OpenBK7231T_App/platforms/BK7231N (Note: I missed the c in "func" in my screenshots - so imagine it's there!)

Screenshot of a GitHub repository with file editing view.

-Copy the raw content of the real BkDriverFlash.c from the submodule location into the empty file space just created -
GitHub editor interface displaying the BkDriverFlash.c file.

-Make the required changes to the content of the file - in this case we're changing the start address of the BK_PARTITION_RF_FIRMWARE from 0x1D0000 to 0x1E3000
Code snippet in a GitHub repository with a new partition start address.

-Commit your changes, giving your commit a short meaningful descriptive name
Commit changes window on GitHub with message and Commit changes button highlighted.

You'll see that your file is created and your main branch is 1 commit ahead of the base repository.
Screenshot of the GitHub repository OpenBK7231T_App showing the BkDriverFlash.c file

-Navigate back up to BK7231N folder and open the prebuild.sh file
Screenshot of pre_build.sh file in GitHub repository

-Edit this file by clicking the pencil icon on the right and then uncomment (remove the "#" from the beginning of) lines 11, 12, 14, 15, 16, 17, 19, 23, 25, 26, 27 and 29 and click "commit changes...". Use default or set custom commit message for this change.

-navigate to the root of your fork and you'll see you're now 2 commits ahead of the base repo. The "2 commits ahead" link is clickable where you'll see a summary of your changes

Screenshot of the OpenBK7231T_App GitHub repository showing the main branch view. Screenshot of comparing changes in OpenBK7231T_App code on GitHub.

-Create a pull request to the base repository. Give it a decent title, description optional, and finally submit the PR with "Create pull request" at the bottom
Screenshot of a pull request creation form on GitHub for the OpenBK7231T_App project.

-If this is your first PR then you'll have to wait for the administrator to approve the build. You'll see your PR listed in here https://github.com/openshwprojects/OpenBK7231T_App/pulls and the build paused under Actions https://github.com/openshwprojects/OpenBK7231T_App/actions

Screenshot showing the GitHub Actions page for the OpenBK7231T_App project.
Screenshot of a pending GitHub workflow approval.

-Once approved, the build will run and if all is well, successfully.
Screenshot from GitHub showing a pull request with all tests successfully passed.

-Review the status of the override script success by expanding Build (platform you made changes to) -> Run make
Build screen of the OpenBK7231N project showing the execution steps of the process.

Example success:
Code: Text
Log in, to see the code


To get to your binaries click one of the blue "Details" links and navigate to the bottom of the "Summary" page
Screenshot showing a GitHub page with build results for OpenBK7231T_App.

The zip file will contain all platform binaries even though your changes are only effective in the platform to which a change was made - BK7231N in this case

Screenshot showing the contents of a ZIP archive with various binary files and disk images.

Your custom firmware is ready to be OTA or UART flashed to your device.

About Author
divadiow
divadiow wrote 2829 posts with rating 489 , helped 254 times. Live in city Bristol. Been with us since 2023 year.

Comments

max4elektroda 24 Oct 2024 16:24

Thanks for your good work to make a more detailed documentation on how to use this feature. I hope it's o.k. if I add some more information by showing a different approach on how to do the same change... [Read more]

divadiow 24 Oct 2024 16:30

nice! even easier! thank you [Read more]

divadiow 16 Dec 2024 07:39

this was a bad example. TMGN enablement only requires a change to the main app https://github.com/openshwprojects/OpenBK7231T_App/pull/1469 [Read more]

%}