Adding OpenWrt packages into build

Discuss the technical details of Gargoyle and ongoing development

Moderator: Moderators

pythonic
Posts: 86
Joined: Mon Mar 11, 2019 5:47 am
Location: Australia

Adding OpenWrt packages into build

Post by pythonic »

What's the best way to add specific OpenWrt packages (e.g. irqbalance) into the Gargoyle build environment?

I tried make custom, but that doesn't appear to be pulling in all current (for the branch, i.e. 19.07 at the moment) packages as irqbalance can't be found in the config tool.

Lantis
Moderator
Posts: 5978
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by Lantis »

Code: Select all

--- a/build.sh
+++ b/build.sh
@@ -625,9 +625,7 @@ for target in $targets ; do
                fi
                other_packages=$(ls "$openwrt_package_dir" )
                for other in $other_packages ; do
-                       if [ ! -d "$target-src/package/$other" ] ; then
-                               cp -r "$openwrt_package_dir/$other" $target-src/package
-                       fi
+                       cp -r "$openwrt_package_dir/$other" $target-src/package
                done
        fi

http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

pythonic
Posts: 86
Joined: Mon Mar 11, 2019 5:47 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by pythonic »

Thanks! 8-)

pythonic
Posts: 86
Joined: Mon Mar 11, 2019 5:47 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by pythonic »

I can get a "make custom" run to build but it fails copying the packges to $top_dir/built/custom/[default|default_kernelspecific] - the tail end of the build output looks like this:

Code: Select all

Signing package index...
make[3]: Leaving directory '$top_dir/custom-src'
export MAKEFLAGS= ;make -w -r json_overview_image_info
make[3]: Entering directory '$top_dir/custom-src'
make[3]: Nothing to be done for 'json_overview_image_info'.
make[3]: Leaving directory '$top_dir/custom-src'
export MAKEFLAGS= ;make -w -r checksum
make[3]: Entering directory '$top_dir/custom-src'
make[3]: Leaving directory '$top_dir/custom-src'
make[2]: Leaving directory '$top_dir/custom-src'
make[1]: Leaving directory '$top_dir/custom-src'
cp: cannot create regular file '$top_dir/built/custom/default/': Not a directory
...
cp: cannot create regular file '$top_dir/built/custom/default/': Not a directory
cp: cannot create regular file '$top_dir/built/custom/default_kernelspecific/': Not a directory
...
cp: cannot create regular file '$top_dir/built/custom/default_kernelspecific/': Not a directory
NB: "$top_dir" has been substituted for the actual gargoyle checkout path in the above

The images and packages have been built in $gargoyle_dir/custom-src/bin and the contents of $gargoyle_dir/custom-src/bin/targets/$arch/generic have been copied to $gargoyle_dir/images/custom

I haven't tried yet to boot one of the ipq806x images I generated this way to see whether irqbalance is actually in the image as I wanted.

I attempted to use a diff from a "make custom" generated config to add irqbalance to the standard ipq806x target config, but that didn't find the package (not surprising looking closely at the code around your patch). I'm still thinking about a better way to maintain an enhanced build without having to use "make custom"...

Lantis
Moderator
Posts: 5978
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by Lantis »

You could make a patch which adds the irqbalance makefile into the packages folder?
Or you can include irqbalance into Gargoyle packages.

I'll look at the code that copies images/packages soon. I don't use custom very often sorry.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

pythonic
Posts: 86
Joined: Mon Mar 11, 2019 5:47 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by pythonic »

I figured the full custom build wasn't being exercised much because the wiki info suggests using make custom just to build a config file, so mentioned my experience for the info of others and possible future attention.

My first attempt to copy just the irqbalance package directory wasn't successful - I'm still looking into why. The patch option had also occurred to me, but I decided I needed to understand what it takes to get it built first ;)

ispyisail
Moderator
Posts: 4928
Joined: Mon Apr 06, 2009 3:15 am
Location: New Zealand

Re: Adding OpenWrt packages into build

Post by ispyisail »

+1

Lantis
Moderator
Posts: 5978
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by Lantis »

I've had a failure on my build system so i can't actually test this at the moment sorry.
My guess... in build.sh most of the uses of "$default_profile" should actually be replaced by "$profile_name". I think there has been a mixup of the variable usage.

In your case, i think swapping it on lines 705, 708, 720 and 723 will get you a lot closer.

Can you let me know how you go please? Meanwhile i'm off to do an OS rebuild :roll:
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

pythonic
Posts: 86
Joined: Mon Mar 11, 2019 5:47 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by pythonic »

Lantis wrote:
Sat Feb 27, 2021 2:29 am
My guess... in build.sh most of the uses of "$default_profile" should actually be replaced by "$profile_name". I think there has been a mixup of the variable usage.

In your case, i think swapping it on lines 705, 708, 720 and 723 will get you a lot closer.

Can you let me know how you go please?
Making those 4 changes has resulted in a make custom build running to completion with the built and images directories being populated as expected.
Lantis wrote:
Sat Feb 27, 2021 2:29 am
Meanwhile i'm off to do an OS rebuild :roll:
:(

pythonic
Posts: 86
Joined: Mon Mar 11, 2019 5:47 am
Location: Australia

Re: Adding OpenWrt packages into build

Post by pythonic »

For the record, the change I tested was:

Code: Select all

--- build.sh.orig
+++ build.sh
@@ -702,10 +702,10 @@
        index_files=$(find "$package_base_dir" -name "Packa*")
        if [ -n "$package_files" ] && [ -n "$index_files" ] ; then
                for pf in $package_files ; do
-                       cp "$pf" "$top_dir/built/$target/$default_profile/"
+                       cp "$pf" "$top_dir/built/$target/$profile_name/"
                done
                for inf in $index_files ; do
-                       cp "$inf" "$top_dir/built/$target/$default_profile/"
+                       cp "$inf" "$top_dir/built/$target/$profile_name/"
                done
        fi
        #copy build specific packages to build/target specific directory
@@ -717,10 +717,10 @@
        index_files=$(find "$package_base_dir" -name "Packa*")
        if [ -n "$package_files" ] && [ -n "$index_files" ] ; then
                for pf in $package_files ; do
-                       cp "$pf" "$top_dir/built/$target/$default_profile"_kernelspecific/
+                       cp "$pf" "$top_dir/built/$target/$profile_name"_kernelspecific/
                done
                for inf in $index_files ; do
-                       cp "$inf" "$top_dir/built/$target/$default_profile"_kernelspecific/
+                       cp "$inf" "$top_dir/built/$target/$profile_name"_kernelspecific/
                done
        fi

I also got tired of looking for the images amongst copied ipks so added:

Code: Select all

--- build.sh.orig
+++ build.sh
@@ -731,10 +731,12 @@
        if [ ! -e "$targets_dir/$target/profiles/$default_profile/profile_images"  ]  ; then 
                for imf in $image_files ; do
                        if [ ! -d "$imf" ] ; then
-                               newname=$(echo "$imf" | sed 's/^.*\///g' | sed "s/openwrt/gargoyle_$lower_short_gargoyle_version/>
-                               cp "$imf" "$top_dir/images/$target/$newname"
-                               if [ "$distribution" = "true" ] ; then
-                                       cp "$imf" "$top_dir/Distribution/Images/$target-$default_profile/$newname"
+                               if [ "${imf##*.}" != "ipk" ] ; then
+                                       newname=$(echo "$imf" | sed 's/^.*\///g' | sed "s/openwrt/gargoyle_$lower_short_gargoyle_>
+                                       cp "$imf" "$top_dir/images/$target/$newname"
+                                       if [ "$distribution" = "true" ] ; then
+                                               cp "$imf" "$top_dir/Distribution/Images/$target-$default_profile/$newname"
+                                       fi
                                fi
                        fi
                done
@@ -745,10 +747,12 @@
                        candidates=$(find "bin/targets/$arch/$subtarget_arch/" 2>/dev/null | grep "$escaped_pi" )
                        for c in $candidates ; do
                                if [ ! -d "$c" ] ; then
-                                       newname=$(echo "$c" | sed 's/^.*\///g' | sed "s/openwrt/gargoyle_$lower_short_gargoyle_ve>
-                                       cp "$c" "$top_dir/images/$target/$newname"
-                                       if [ "$distribution" = "true" ] ; then
-                                               cp "$c" "$top_dir/Distribution/Images/$target-$default_profile/$newname"
+                                       if [ "${c##*.}" != "ipk" ] ; then
+                                               newname=$(echo "$c" | sed 's/^.*\///g' | sed "s/openwrt/gargoyle_$lower_short_gar>
+                                               cp "$c" "$top_dir/images/$target/$newname"
+                                               if [ "$distribution" = "true" ] ; then
+                                                       cp "$c" "$top_dir/Distribution/Images/$target-$default_profile/$newname"
+                                               fi
                                        fi
                                fi
                        done

Post Reply