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:46] – spelling 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: | + | 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. | ||
| Line 10: | 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/ | ||
| </ | </ | ||
| Line 26: | Line 22: | ||
| <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 37: | 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 67: | 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-*/ |
| </ | </ | ||
| Line 79: | Line 80: | ||
| | '' | | '' | ||
| | '' | | '' | ||
| - | | '' | + | | '' |
| - | Run '' | + | Run '' |
| ==== Selecting profile ==== | ==== Selecting profile ==== | ||
| Line 87: | Line 88: | ||
| <code bash> | <code bash> | ||
| - | PROFILE=profile-name | + | PROFILE="profile-name" |
| </ | </ | ||
| Line 107: | Line 108: | ||
| <code bash> | <code bash> | ||
| - | echo $(opkg | + | echo $(opkg |
| </ | </ | ||
| Line 114: | Line 115: | ||
| 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 124: | Line 131: | ||
| <code bash> | <code bash> | ||
| - | FILES=files/ | + | FILES="files" |
| </ | </ | ||
| - | The '' | + | The '' |
| It is strongly recommended to use [[docs: | It is strongly recommended to use [[docs: | ||
| This helps minimize conflicts with auto-generated settings which can change between versions. | This helps minimize conflicts with auto-generated settings which can change between versions. | ||
| + | |||
| + | see: [[: | ||
| ==== Building image ==== | ==== Building image ==== | ||
| Line 136: | Line 145: | ||
| <code bash> | <code bash> | ||
| - | make image PROFILE=profile-name PACKAGES=" | + | make image \ |
| + | PROFILE="profile-name" \ | ||
| + | PACKAGES=" | ||
| + | FILES="files" \ | ||
| + | DISABLED_SERVICES=" | ||
| </ | </ | ||
| Line 157: | 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 170: | Line 189: | ||
| ==== Detailed help ==== | ==== Detailed help ==== | ||
| + | See also: [[https:// | ||
| + | |||
| Getting detailed help: | Getting detailed help: | ||
| Line 202: | Line 223: | ||
| make manifest STRIP_ABI=1 # remove ABI version from printed package names | make manifest STRIP_ABI=1 # remove ABI version from printed package names | ||
| </ | </ | ||
| - | |||
| - | See also: [[https:// | ||
| ==== Available profiles ==== | ==== Available profiles ==== | ||
| Line 235: | Line 254: | ||
| ==== Building the Image Builder with all packages inside ==== | ==== 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. | + | 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, | In the graphical configuration, | ||
| - | Then build the image, including '' | + | You can [[docs: |
| - | + | ||
| - | Enabling | + | |
| - | + | ||
| - | <code bash> | + | |
| - | make IGNORE_ERRORS=1 | + | |
| - | </ | + | |
| Don't call '' | Don't call '' | ||
| Line 275: | 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 281: | 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/ | ||
| + | |||
| + | <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 is tied to the profile names. | The image building is tied to the profile names. | ||
| 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. | ||
| Line 316: | 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 351: | Line 405: | ||
| <code bash> | <code bash> | ||
| make image \ | make image \ | ||
| - | | + | PROFILE="tlwr841" |
| - | PACKAGES=" | + | PACKAGES=" |
| - | FILES_REMOVE=" | + | FILES_REMOVE=" |
| </ | </ | ||
| - | |||