Jump to content

Idea of automatic uboot/kernel recompilation


Hijax

Recommended Posts

Playing with BUILD_MINIMAL I had to several times run compilation script for the same board / system / branch. To speed up verification I thought: what is a point to constantly build u-boot / kernel?

So I added CLEAN_LEVEL option to not delete generated debs.

 

I have noted that from one hand I can disable cleaning of (for example) kernel deb files, but from other hand if there is repository update no new deb is produced.

 

And the idea.... or is this already implemented somewhere?

 

Build of u-boot / kernel is initiated when no deb file exists.

fetch_from_repo function knows if the repository is updated.

 

What is fetch_from_repo returns update status and this is used also in main.sh as additional check? I.e. deb exists but is older than latest repo update so compilation is required.

 

Essentially, to change:

 

if [[ ! -f ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then

 

into something like:

 

if [[ ${UBOOT_UPDATED} == "yes" || ! -f ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then

 

And diff proposal:

diff --git a/lib/general.sh b/lib/general.sh
index dc0718a4..64edeaa8 100644
--- a/lib/general.sh
+++ b/lib/general.sh
@@ -294,6 +294,7 @@ fetch_from_repo()
                        fetch_from_repo "$surl" "$workdir/$i" "$sref"
                done
        fi
+       [[ $changed == false ]] && return 1
 } #############################################################################

 #--------------------------------------------------------------------------------------------------------------------------------
diff --git a/lib/main.sh b/lib/main.sh
index 00ec251c..b9779edb 100644
--- a/lib/main.sh
+++ b/lib/main.sh
@@ -311,10 +311,15 @@ start=$(date +%s)

 # ignore updates help on building all images - for internal purposes
 # fetch_from_repo <url> <dir> <ref> <subdir_flag>
+BOOT_IS_UPDATED=false
+KERNEL_IS_UPDATED=false
 if [[ $IGNORE_UPDATES != yes ]]; then
        display_alert "Downloading sources" "" "info"
        fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
+       [[ $? == 0 ]] && BOOT_IS_UPDATED=true
        fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
+       [[ $? == 0 ]] && KERNEL_IS_UPDATED=true
        if [[ -n $ATFSOURCE ]]; then
                fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
        fi
@@ -357,7 +362,7 @@ for option in $(tr ',' ' ' <<< "$CLEAN_LEVEL"); do
 done

 # Compile u-boot if packed .deb does not exist
-if [[ ! -f ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
+if [[ $BOOT_IS_UPDATED == true || ! -f ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
        if [[ -n $ATFSOURCE ]]; then
                compile_atf
        fi
@@ -365,7 +370,7 @@ if [[ ! -f ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
 fi

 # Compile kernel if packed .deb does not exist
-if [[ ! -f ${DEST}/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then
+if [[ $KERNEL_IS_UPADTED == true || ! -f ${DEST}/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then
        KDEB_CHANGELOG_DIST=$RELEASE
        compile_kernel
 fi

 

 

Link to comment
Share on other sites

1 hour ago, Hijax said:

So you suggest to use CLEAN_LEVEL="debs" to remove debs all the time and eventually add IGNORE_UPDATES ?

 

IGNORE_UPDATES is used internally, when all stuff is rebuild. Rebuilding is done by phases:
1. All kernels and u-boots are rebuild, one by one and in parallel by default

2. When this is done, BSP packages are rebuild in parallel and here I don't want to check things upstream
3. Images can also be build in parallel (if EXTERNAL="no" is used) and here is the same ... 

 

For normal usage your proposition makes sense, but not sure if I want this in BUILD_ALL scenario.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines