Dev environment for multiple images - Am I assuming correctly?


bozden
 Share

1 1
Go to solution Solved by bozden,

Recommended Posts

I have several applications running on different boards. After reading documents/forum posts and checking the code here and there, I came to the following setup and I'll be very pleased if someone confirms it.

 

Application A1, A2,..An

Board B1, B2,...Bn

 

1) Create multiple compile_Ax_By.sh, containing:

 

#!/bin/bash
# Define my application
MYAPP=A1
# Call ./compile.sh with predefined parameters
./compile.sh BOARD="orangepipcplus" BRANCH="current" RELEASE="focal" BUILD_DESKTOP="yes" KERNEL_ONLY="no" KERNEL_CONFIGURE="no"

 

2) In userpatches/customize-image.sh add a single line to my custom my-custom-image.sh (in case original got overwritten by update)

 

3) In userpatches/my-custom-image.sh put my main logic with case and/or common functions:

 

# MY VARIABLES
...
# MY MAIN
main() {
 case $MYAPP in
 App1)
  ...
 App2)
  ...
 esac
}
# MY SUBS
...

 

4) Create userpatches/lib.config and form a similar case structure for variables

 

case $HKBOX_TYPE in
App1)
  PACKAGE_LIST_ADDITIONAL="$PACKAGE_LIST_ADDITIONAL ..."
  ;;
App2)
...
esac

# common ones here

 

 

One thing I couldn't find is the name of the final image. Something like Armbian_MyApp_MyBoard_....img would be nice. Otherwise it overwrites the original...

 

 

 

Link to post
Share on other sites

Donate and support the project!

OK, after a weeks effort, I (quick-)examined the code, found some related posts and got help from @Werner, thank you for breaking the "you are on your own" rule :beer:.

 

The structure above needs major revising, if we go step by step:

 

1) I have to write the variables in the outher bash to some .sh file (e.g. under userpatches/overlay/myapp) to be copied to chroot environment to be sourced.

2 & 3) I cannot do this, because in "image-helpers.sh" customize_image routine only one file, "customize-image.sh" is copied to $SDCARD. So I must combine everything into that file.

3) In customize-image.sh, I need to source the file I've saved in step 1 to get my variables back

4) Is ok, but can only be used for setting variables.

 

And finally how I can include my own files... See:

Now I have to test this whole thing.

Cheers

 

Link to post
Share on other sites

We like to help but we simply do not have time to do so. We do have a constant lack of human ressources :(

Those who help, including myself, are volunteers to the project and do this in their free time. The primary goal for years now is to raise funds to hire fulltime professionals but we are still not even close to get there...

Link to post
Share on other sites

12 minutes ago, bozden said:

thank you for breaking the "you are on your own" rule

We like to help but we simply do not have time to do so. We do have a constant lack of human ressources :(

Those who help, including myself, are volunteers to the project and do this in their free time. The primary goal for years now is to raise funds to hire fulltime professionals but we are still not even close to get there...

Link to post
Share on other sites

I fully understand this, that quote was attribute to "No end-user support: built from trunk" wording in motd :)

 

I learned linux playing with these SBC's, mainly Armbian and it is a hobby for me. I have several installations at my home-office as hobby projects. If I ever earn some money from these stuff I'll donate it. But for this or helping others on the forums, I need to learn first :) 

 

Things like chroot environment, kernel parameters, kernel compiling are very new to me. The build script is very high quality code from my perspective. Last week, by examining it I learned a lot. For example the "wait_for_package_manager" function in general.sh provides solution for some of my problems. Kudos for @Igor and everybody contributed.

 

I'll try to "document" my adventure for other newbies.

 

Link to post
Share on other sites

On 10/25/2020 at 10:54 AM, bozden said:

One thing I couldn't find is the name of the final image. Something like Armbian_MyApp_MyBoard_....img would be nice. Otherwise it overwrites the original...

 

 

So a cheat to let customize image see the board would be for the script to source sdcard/etc/armbian-release

 

Then you'll have a board var etc.  Sorry typing on my phone otherwise if provide a better example 

Link to post
Share on other sites

  • Solution
7 hours ago, lanefu said:

 

So a cheat to let customize image see the board would be for the script to source sdcard/etc/armbian-release

 

Then you'll have a board var etc.  Sorry typing on my phone otherwise if provide a better example 

 

Thank you for the tip. I currently solved this without cheating:

1) I use a shared folder on VirtualBox

2) On the main bash I'm running, after the compilation is done I create MyApp folder, and move from the output/images folder renaming 3 files generated.

Simple solution for my dumb question :/

 

 

Link to post
Share on other sites

 Share

1 1