Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:additional-software:imagebuilder [2021/07/31 13:08] – reorganize content vgaetera | docs:guide-user:additional-software:imagebuilder [2024/04/01 16:18] – [Arch / Manjaro / EndeavourOS] sixx | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Using the Image Builder ====== | ====== Using the Image Builder ====== | ||
| + | See also: | ||
| + | [[docs: | ||
| + | [[docs: | ||
| + | [[docs: | ||
| + | |||
| The Image Builder (previously called the Image Generator) is a pre-compiled environment suitable for creating custom images without the need for compiling them from source. | The Image Builder (previously called the Image Generator) is a pre-compiled environment suitable for creating custom images without the need for compiling them from source. | ||
| It downloads pre-compiled packages and integrates them in a single flashable image. | It downloads pre-compiled packages and integrates them in a single flashable image. | ||
| Line 8: | Line 13: | ||
| * your device has 32MB or less RAM and opkg does not work properly | * your device has 32MB or less RAM and opkg does not work properly | ||
| * you want to mass-flash dozens of devices and you need a specific firmware setup | * you want to mass-flash dozens of devices and you need a specific firmware setup | ||
| - | |||
| - | Alternative guides to achieving the same goal: | ||
| - | [[docs: | ||
| - | [[docs: | ||
| - | |||
| - | Consider also removing packages if you have a device with very little firmware space: | ||
| - | [[docs: | ||
| <WRAP important> | <WRAP important> | ||
| - | Imagebuilder | + | The Image Builder |
| When recent/ | When recent/ | ||
| </ | </ | ||
| - | |||
| - | ===== Frontends based on imagebuilder ===== | ||
| - | There are several tools that provide a frontend interface to the imagebuilder (either web-interface, | ||
| - | |||
| - | See [[docs: | ||
| ===== Prerequisites ===== | ===== Prerequisites ===== | ||
| <WRAP important> | <WRAP important> | ||
| * The Image Builder runs only in 64-bit Linux. You can however run a 64-bit Linux in PC or VM, e.g. VirtualBox, even from 32-bit Windows. | * The Image Builder runs only in 64-bit Linux. You can however run a 64-bit Linux in PC or VM, e.g. VirtualBox, even from 32-bit Windows. | ||
| - | * The Image Builder has similar prerequisites as [[docs: | + | * The Image Builder has similar prerequisites as the [[docs: |
| </ | </ | ||
| Example dependencies in the most common distros: | Example dependencies in the most common distros: | ||
| - | ==== Arch / Manjaro | + | ==== Arch ==== |
| <code bash> | <code bash> | ||
| sudo pacman -S --needed base-devel ncurses zlib gawk git gettext \ | sudo pacman -S --needed base-devel ncurses zlib gawk git gettext \ | ||
| Line 40: | Line 33: | ||
| </ | </ | ||
| - | ==== CentOS / Fedora ==== | + | ==== Fedora ==== |
| <code bash> | <code bash> | ||
| sudo dnf install git gawk gettext ncurses-devel zlib-devel \ | sudo dnf install git gawk gettext ncurses-devel zlib-devel \ | ||
| openssl-devel libxslt wget which @c-development @development-tools \ | openssl-devel libxslt wget which @c-development @development-tools \ | ||
| - | @development-libs zlib-static which python3 | + | @development-libs zlib-static which python3 |
| </ | </ | ||
| - | ==== Debian / Ubuntu ==== | + | ==== Debian |
| <code bash> | <code bash> | ||
| - | sudo apt install build-essential | + | sudo apt install build-essential |
| - | zlib1g-dev gawk git gettext libssl-dev xsltproc rsync wget unzip python | + | gettext libssl-dev xsltproc rsync wget unzip python3 python3-distutils |
| </ | </ | ||
| + | ==== WSL ==== | ||
| + | This method is NOT OFFICIALLY supported. | ||
| + | But it works. | ||
| + | |||
| + | [[docs: | ||
| ===== Obtaining the Image Builder ===== | ===== Obtaining the Image Builder ===== | ||
| You can download an archive that contains the **Image Builder**, it is usually located in the same download page where you find the firmware image for your device. | You can download an archive that contains the **Image Builder**, it is usually located in the same download page where you find the firmware image for your device. | ||
| Line 70: | Line 68: | ||
| <code bash> | <code bash> | ||
| - | tar -J -x -f openwrt*.tar.xz | + | tar -J -x -f openwrt-imagebuilder-*.tar.xz |
| - | cd openwrt-*/ | + | cd openwrt-imagebuilder-*/ |
| </ | </ | ||
| - | Available commands: | + | The image building can be customized with the following variables: |
| - | < | + | ^ Variable ^ Description ^ |
| - | # make help | + | | '' |
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| - | Available Commands: | + | Run '' |
| - | help: This help text | + | |
| - | info: Show a list of available target profiles | + | |
| - | clean: | + | |
| - | image: | + | |
| - | + | ||
| - | Building images: | + | |
| - | By default | + | |
| - | target profile and package set. You can use the following parameters | + | |
| - | to change that: | + | |
| - | + | ||
| - | make image PROFILE="< | + | |
| - | make image PACKAGES="< | + | |
| - | make image FILES="< | + | |
| - | make image BIN_DIR="< | + | |
| - | make image EXTRA_IMAGE_NAME="< | + | |
| - | make image DISABLED_SERVICES="< | + | |
| - | make image ADD_LOCAL_KEY=1 # store locally generated signing key in built images | + | |
| - | + | ||
| - | Print manifest: | + | |
| - | List " | + | |
| - | You can use the following parameters: | + | |
| - | + | ||
| - | make manifest PROFILE="< | + | |
| - | make manifest PACKAGES="< | + | |
| - | make manifest STRIP_ABI=1 # remove ABI version from printed package names | + | |
| - | </ | + | |
| - | + | ||
| - | The image buildding can be customized with the following variables: | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | + | ||
| - | See also: [[https:// | + | |
| ==== Selecting profile ==== | ==== Selecting profile ==== | ||
| Line 121: | Line 88: | ||
| <code bash> | <code bash> | ||
| - | PROFILE=profile-name | + | PROFILE="profile-name" |
| </ | </ | ||
| - | Run '' | + | Run '' |
| - | + | ||
| - | < | + | |
| - | # make info | + | |
| - | + | ||
| - | Available Profiles: | + | |
| - | + | ||
| - | Default: | + | |
| - | Default Profile | + | |
| - | Packages: kmod-usb-core kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport | + | |
| - | ai-br100: | + | |
| - | Aigale Ai-BR100 | + | |
| - | Packages: kmod-usb2 kmod-usb-ohci | + | |
| - | rp-n53: | + | |
| - | Asus RP-N53 | + | |
| - | Packages: | + | |
| - | rt-n14u: | + | |
| - | Asus RT-N14u | + | |
| - | Packages: | + | |
| - | whr-1166d: | + | |
| - | Buffalo WHR-1166D | + | |
| - | Packages: | + | |
| - | whr-300hp2: | + | |
| - | Buffalo WHR-300HP2 | + | |
| - | Packages: | + | |
| - | ... | + | |
| - | </ | + | |
| ==== Selecting packages ==== | ==== Selecting packages ==== | ||
| The '' | The '' | ||
| - | By default (empty PACKAGES variable) the Image Generator | + | By default (empty PACKAGES variable) the Image Builder |
| <code bash> | <code bash> | ||
| Line 162: | Line 103: | ||
| The example above will include pkg1, pkg2, pkg3, and exclude pkg4, pkg5, pkg6, note the " | The example above will include pkg1, pkg2, pkg3, and exclude pkg4, pkg5, pkg6, note the " | ||
| - | You don't need to list all dependencies of the packages you need in this list, the Image Generator | + | You don't need to list all dependencies of the packages you need in this list, the Image Builder |
| The list of currently installed packages on your device can be obtained with the following command: | The list of currently installed packages on your device can be obtained with the following command: | ||
| <code bash> | <code bash> | ||
| - | echo $(opkg | + | echo $(opkg |
| </ | </ | ||
| - | < | + | <WRAP important> |
| Many devices are limited in storage capacity and there is no guarantee that the build system will detect when you have added too many packages to fit into the device storage space, which may render the device unbootable if installed. | Many devices are limited in storage capacity and there is no guarantee that the build system will detect when you have added too many packages to fit into the device storage space, which may render the device unbootable if installed. | ||
| If in doubt, do not go overboard. | If in doubt, do not go overboard. | ||
| Use what you had installed on the device last as a guide or create a minimal image first, install it to the device and test what you would like to add first. | Use what you had installed on the device last as a guide or create a minimal image first, install it to the device and test what you would like to add first. | ||
| + | Consider removing unnecessary packages to [[docs: | ||
| </ | </ | ||
| + | |||
| + | In addition ABI versioned packages such as '' | ||
| + | You may get compile errors when these are provided as packages. | ||
| + | To avoid issues you should omit them from image builder and let the correct versions be installed via package dependencies. | ||
| + | The '' | ||
| ==== Custom packages ==== | ==== Custom packages ==== | ||
| Line 180: | Line 127: | ||
| ==== Custom files ==== | ==== Custom files ==== | ||
| - | The '' | + | The '' |
| This is especially useful if you need to change the network configuration from default before flashing, or if you are preparing an image for mass-flashing many devices. | This is especially useful if you need to change the network configuration from default before flashing, or if you are preparing an image for mass-flashing many devices. | ||
| <code bash> | <code bash> | ||
| - | FILES=files/ | + | FILES="files" |
| </ | </ | ||
| - | The '' | + | The '' |
| + | |||
| + | It is strongly recommended to use [[docs: | ||
| + | This helps minimize conflicts with auto-generated settings which can change between versions. | ||
| + | |||
| + | see: [[: | ||
| ==== Building image ==== | ==== Building image ==== | ||
| Line 193: | Line 145: | ||
| <code bash> | <code bash> | ||
| - | make image PROFILE=profile-name PACKAGES=" | + | make image \ |
| + | PROFILE="profile-name" \ | ||
| + | PACKAGES=" | ||
| + | FILES="files" \ | ||
| + | DISABLED_SERVICES=" | ||
| </ | </ | ||
| Line 214: | Line 170: | ||
| scp root@192.168.1.1:/ | scp root@192.168.1.1:/ | ||
| scp root@192.168.1.1:/ | scp root@192.168.1.1:/ | ||
| - | make image PROFILE=wl500gp PACKAGES=" | + | make image \ |
| + | PROFILE="wl500gp" \ | ||
| + | PACKAGES=" | ||
| + | FILES="files" \ | ||
| + | DISABLED_SERVICES=" | ||
| </ | </ | ||
| ===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
| - Did you run everything as a non-root user? | - Did you run everything as a non-root user? | ||
| - | - Check the log output are there package issues (conflicts, improper names) | + | - Check the logged |
| - | - Wait a few hours/day upstream packages may be in an inconsistent state | + | - Check the logged output, did you exceed maximum space? |
| + | - Check the logged output, are there other obvious errors? | ||
| + | - Wait a few hours/day(s) upstream packages may be in an inconsistent state especially on master/ | ||
| - Verify you have a supported OS, prerequisites, | - Verify you have a supported OS, prerequisites, | ||
| Line 226: | Line 188: | ||
| The topics below go beyond simple usage and aimed at developers and advanced users. | The topics below go beyond simple usage and aimed at developers and advanced users. | ||
| - | ==== Building the Image Generator with all packages inside | + | ==== Detailed help ==== |
| - | It is possible to use a **buildroot*** to create your own Image Generator and integrate in it all packages so it will be able to generate images without downloading packages: | + | See also: [[https:// |
| - | In the graphical configuration, | + | Getting detailed help: |
| - | Then build the image, including '' | + | |
| - | Enabling '' | + | < |
| + | # make help | ||
| - | <code bash> | + | Available Commands: |
| - | make IGNORE_ERRORS=1 | + | help: This help text |
| + | info: Show a list of available target profiles | ||
| + | clean: | ||
| + | image: | ||
| + | |||
| + | Building images: | ||
| + | By default 'make image' will create an image with the default | ||
| + | target profile and package set. You can use the following parameters | ||
| + | to change that: | ||
| + | |||
| + | make image PROFILE="< | ||
| + | make image PACKAGES="< | ||
| + | make image FILES="< | ||
| + | make image BIN_DIR="< | ||
| + | make image EXTRA_IMAGE_NAME="< | ||
| + | make image DISABLED_SERVICES="< | ||
| + | make image ADD_LOCAL_KEY=1 # store locally generated signing key in built images | ||
| + | |||
| + | Print manifest: | ||
| + | List " | ||
| + | You can use the following parameters: | ||
| + | |||
| + | make manifest PROFILE="< | ||
| + | make manifest PACKAGES="< | ||
| + | make manifest STRIP_ABI=1 # remove ABI version from printed package names | ||
| </ | </ | ||
| + | |||
| + | ==== Available profiles ==== | ||
| + | Listing available profiles: | ||
| + | |||
| + | < | ||
| + | # make info | ||
| + | |||
| + | Available Profiles: | ||
| + | |||
| + | Default: | ||
| + | Default Profile | ||
| + | Packages: kmod-usb-core kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport | ||
| + | ai-br100: | ||
| + | Aigale Ai-BR100 | ||
| + | Packages: kmod-usb2 kmod-usb-ohci | ||
| + | rp-n53: | ||
| + | Asus RP-N53 | ||
| + | Packages: | ||
| + | rt-n14u: | ||
| + | Asus RT-N14u | ||
| + | Packages: | ||
| + | whr-1166d: | ||
| + | Buffalo WHR-1166D | ||
| + | Packages: | ||
| + | whr-300hp2: | ||
| + | Buffalo WHR-300HP2 | ||
| + | Packages: | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | ==== Building the Image Builder with all packages inside ==== | ||
| + | It is possible to use a buildroot to create your own Image Builder and integrate in it all packages so it will be able to generate images without downloading packages. | ||
| + | |||
| + | In the graphical configuration, | ||
| + | You can [[docs: | ||
| Don't call '' | Don't call '' | ||
| ==== Adding package repositories ==== | ==== Adding package repositories ==== | ||
| - | The **Image Generator** | + | The Image Builder |
| The package sources are configured in the '' | The package sources are configured in the '' | ||
| Sources are specified in //opkg// native config format. | Sources are specified in //opkg// native config format. | ||
| Line 267: | Line 288: | ||
| The '' | The '' | ||
| - | If you want to add a custom local repository, copy the '' | + | If you want to add a custom local repository, copy the '' |
| If you have problems with using you local repository because the " | If you have problems with using you local repository because the " | ||
| Line 273: | Line 294: | ||
| NOTE: if you want to override packages coming from an existing feed, you must write your custom feed ABOVE the line of the package feed containing the packages you want to override, as shown in the examples above. | NOTE: if you want to override packages coming from an existing feed, you must write your custom feed ABOVE the line of the package feed containing the packages you want to override, as shown in the examples above. | ||
| + | |||
| + | ==== Restricting root access ==== | ||
| + | Create a non-privileged admin user and lock root password. | ||
| + | Configure privilege elevation with sudo. | ||
| + | Set up key-based authentication and disable password authentication for Dropbear. | ||
| + | |||
| + | <code bash> | ||
| + | mkdir -p files/ | ||
| + | cat << " | ||
| + | USER_NAME=" | ||
| + | USER_SSHPUB=" | ||
| + | USER_SHELL="/ | ||
| + | SUDO_USER=" | ||
| + | SUDO_GROUP=" | ||
| + | groupadd -r " | ||
| + | useradd -m -G " | ||
| + | passwd -l " | ||
| + | cat << EOI > / | ||
| + | %${SUDO_GROUP} ALL=(ALL) ALL | ||
| + | EOI | ||
| + | USER_HOME=" | ||
| + | mkdir -p " | ||
| + | cat << EOI > " | ||
| + | ${USER_SSHPUB} | ||
| + | EOI | ||
| + | uci set dropbear.@dropbear[0].PasswordAuth=" | ||
| + | uci set dropbear.@dropbear[0].RootPasswordAuth=" | ||
| + | uci commit dropbear | ||
| + | / | ||
| + | EOF | ||
| + | make image \ | ||
| + | FILES=" | ||
| + | PACKAGES=" | ||
| + | </ | ||
| ==== Adding/ | ==== Adding/ | ||
| - | The image generation | + | |
| + | <WRAP important> | ||
| + | Examples below may contain version dependent / legacy information and are for informational purposes. They are very low level so expect to have a good level of skill and familiarity with the ImageBuilder / OpenWrt in general. | ||
| + | </ | ||
| + | |||
| + | The image building | ||
| If you add a new profile without also adding an appropriate macro to the image-generation Makefile, no suitable firmware file will get generated when using the custom profile. | If you add a new profile without also adding an appropriate macro to the image-generation Makefile, no suitable firmware file will get generated when using the custom profile. | ||
| Remove the ''/ | Remove the ''/ | ||
| Line 308: | Line 368: | ||
| Note that it requires patching of the '' | Note that it requires patching of the '' | ||
| + | |||
| + | It is based on older Chaos Calmer era code... and not applicable to modern ImageBuilders but useful as a reference... | ||
| </ | </ | ||
| Line 343: | Line 405: | ||
| <code bash> | <code bash> | ||
| make image \ | make image \ | ||
| - | | + | PROFILE="tlwr841" |
| - | PACKAGES=" | + | PACKAGES=" |
| - | FILES_REMOVE=" | + | FILES_REMOVE=" |
| </ | </ | ||
| - | |||