About openwrt-imagebuilder-wrapper ,add custom file no effective



  • Hello:

    I need to build custom firmware on Onion omega2+. I try openwrt-imagebuilder-wrapper to work, but add custom file is no effective. Above is my operation :

    • type in command "bash onion_buildenv setup_imagebuilder" would generate
      directory openwrt-imagebuilder/

    • create new diectory files/etc on additions/(Completion path: /home/user/openwrt-imagebuilder-wrapper/additions/files/etc/)and add target file mycfg.conf

    • type in command" bash onion_buildenv build_all_firmware ",I get binary file onion_omega2p-23.05.3-20240909.bin on output/

    when i upgrade omega2+ with command "sysupgrade -F -n onion_omega2p-23.05.3-20240909.bin", can not find target mycfg.conf in /etc

    PS: I git clone repo, I follow recommand text “bash onion_buildenv setup_imagebuilder” in terminal show above error:

    tar (child): /home/mulu553/openwrt-imagebuilder-wrapper/openwrt-imagebuilder-23.05.3-ramips-mt76x8.Linux-x86_64.tar.xz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    ERROR: invalid archive /home/mulu553/openwrt-imagebuilder-wrapper/openwrt-imagebuilder-23.05.3-ramips-mt76x8.Linux-x86_64.tar.xz
    

    but it's not key, because i can download openwrt-imagebuilder-23.05.3-ramips-mt76x8.Linux-x86_64.tar.xz form http://downloads.onioniot.com/releases/23.05.3/targets/ramips/mt76x8/



  • @mulu553

    I don't use the image builder but I looked at the script and ran a quick test to confirm the details below.

    I see the issue downloading is the script had the download function disabled. Open onion_buildenv script in your favorite text editor (vi, vim, nano etc) you can see it is commented out here:

    download_builder() {
    	# download_file "$IMAGE_BUILDER_URL" "$IMAGE_BUILDER_ZIP"
    	return 0
    }
    

    Remove the # to enable the download again.

    To copy your files into the built firmware run the command:

    bash onion_buildenv update_imagebuilder



  • @crispyoz thank you answer, I run you suggestion and test, it run as you say.
    To my question, actually possible operatetion mistake.I do a repeartion. while type in "bash clean_imagebuilder" , directory openwrt-imagebuilder/ is gone. when I generate it again. Unusual, I found my target file mycfg.conf still alive. I build image and upgrade on omega2+, custom is effective



  • @mulu553 the command "bash onion_buildenv clean_imagebuilder" just deletes the directory "openwrt-imagebuilder" and the downloaded tar openwrt-imagebuilder-23.05.3-ramips-mt76x8.Linux-x86_64.tar.xz, so it doesn't remove the "additions" directory that contains your customisations. Therefore when you build again your customisations are included.

    You can see all of this in the script file onion_buildenv. If you add "set -x" at the top of the script, you can see what commands it is executing.

    #!/bin/bash
    
    set -x
    
    cd $(dirname $0)
    
    

  • administrators

    Thanks for finding this issue and submitting a PR @crispyoz !
    This was an oversight on my end (I blame lack of sleep due to newborn)

    The PR has been merged and the issue has been resolved, the OnionIoT/openwrt-imagebuilder-wrapper will now work as intended out of the box.



  • @crispyoz thank you for your reply. I am not familiar with shell program that i ignore build scripts and profile, So I consider "clean_imagebuilder" as reload build at first. Thanks your guide and support, I know what happen while image build, I has fix my build and run each test several times. Now imagebuilder work as my expectation that I can take attention to my application develop right now.



  • @mulu553 Thanks for update, happy you are now able to get to work. Good luck with your project.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.