Skip to content

Commit

Permalink
Add hadk_tools wrapper to call mk.image for each device
Browse files Browse the repository at this point in the history
We need to create images for each device we can reuse the hadk_tools
infrastructure with some adjustments.

Part of SailfishOS-SonyXperia/bugs#19

Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>
  • Loading branch information
Thaodan committed Jul 31, 2022
1 parent 95ae513 commit 57c37c1
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
For some of our scripts we require [[/~https://github.com/SailfishOS-SonyXperia/hadk_tools][HADK-Tools]] and the platform SDK to be setup.

** Setup
To setup install hadk-tools into your local ~~/.local~ folder by running
~make install PREFIX=~/.local~ from the hadk_tools folder.
To setup install hadk-tools into your local ~$HOME/.local~ folder by running
~make install PREFIX=$HOME/.local~ from the hadk_tools folder.


After doing so follow this [[/~https://github.com/SailfishOS-SonyXperia/hadk_tools/blob/master/doc/hadk.tools.org#basic-setup][document]] till the end.
Expand All @@ -58,6 +58,10 @@

After the Android environment has been setup just call it with your obs project passed as -P.

** hadk_tools.mkimage.sh

Create install images for each device supported by the OBS project that is passed as -P.


* Dependencies

Expand Down
57 changes: 57 additions & 0 deletions hadk.tools.mkimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

set -e

scriptdir="$(dirname -- "$( readlink -f -- "$0"; )")"

. $scriptdir/shared.sh
. $scriptdir/shared.hadk_tools.setup.sh

usage_description="Fetch device we build for from obs_project and use hadk_tools to build image for each supported devices, requires that plaform SDK has been setup"

while getopts hr:b:P:p:A:t arg ; do
case $arg in
P) obs_project=$OPTARG;;
A) obs_api_url=$OPTARG;;
t) hadk_tools_templates_dir=$OPT_ARG;;
h) usage; exit 0;;
?|*) usage; exit 1;;
esac
done
shift $(($OPTIND - 1))

obs_checkout_prj $obs_project

osc_parse_env

TARGET_UNIT=mk.image.hadk

# Tell the mk.image to use our adaptation repository
# instead of trying to use a local repository
SFOS_ADAPTION0_URL=$(osc_repo_baseurl "$obs_project")

export SFOS_ADAPTION0_URL

osc_hadk_setup_supported_devices

hadk_setup_tmp_unit

# fetch droid-config-ssu-kickstarts here
for device in $SUPPORTED_DEVICES; do
osc getbinaries "$obs_project" \
droid-version-$device \
latest_$adaptation_repo_arch \
$adaptation_repo_arch
done

rm -rf hybris/droid-configs/installroot/installroot
mkdir -p hybris/droid-configs/installroot/installroot
(
cd hybris/droid-configs/installroot
rpm2cpio \
$ANDROID_ROOT/droid-local-repo/$DEVICE_NUM/droid-config-$DEVICE_NUM-ssu-kickstarts-*.$PORT_ARCH.rpm \
| cpio -idv &> /dev/null
)


hadk.build -t "$hadk_tools_templates_dir" -f "$tmp_unit"
8 changes: 8 additions & 0 deletions shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ obs_checkout_prj_pkg() {
)
}

osc_repo_baseurl() {
local repofile_url
for repofile_url in $(osc repourls) ; do
# We only want the first result
break
done
curl --silent "$repofile_url"|grep baseurl| cut -d'=' -f2
}

gen_build_script() {
cat > build.script <<EOF
Expand Down

0 comments on commit 57c37c1

Please sign in to comment.