Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-developer:toolchain:use-buildsystem [2022/01/07 22:48] – sorcun | docs:guide-developer:toolchain:use-buildsystem [2024/10/16 18:12] (current) – [Build system usage] jannoke | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| </ | </ | ||
| - | Typical build steps in a [[docs: | + | <WRAP important> |
| + | There is an issue affecting the current OpenWrt source tree (from at least 21.02 onwards): OpenWrt images built in certain setups will succeed, but they will hang on boot if installed on a device. To work around this issue, please follow the instructions posted [[https:// | ||
| + | </ | ||
| + | |||
| + | After [[docs: | ||
| <code bash> | <code bash> | ||
| Line 16: | Line 20: | ||
| git branch -a | git branch -a | ||
| git tag | git tag | ||
| - | git checkout | + | git checkout |
| # Update the feeds | # Update the feeds | ||
| Line 22: | Line 26: | ||
| ./ | ./ | ||
| - | # Configure the firmware image and the kernel | + | # Configure the firmware image |
| make menuconfig | make menuconfig | ||
| - | make kernel_menuconfig | + | |
| + | # Optional: configure the kernel (usually not required) | ||
| + | # Don't, unless have a strong reason to | ||
| + | make -j$(nproc) | ||
| # Build the firmware image | # Build the firmware image | ||
| - | make -j $(nproc) defconfig download clean world | + | make -j$(nproc) defconfig download clean world |
| </ | </ | ||
| Line 93: | Line 100: | ||
| - Create a dir: '' | - Create a dir: '' | ||
| - Write a Makefile or download one '' | - Write a Makefile or download one '' | ||
| - | - Append a line with your custom feed to '' | + | - Append a line with your custom feed to '' |
| - Now run: '' | - Now run: '' | ||
| - | - Build your package.\\ Select it in the menu of '' | + | - Build your package.\\ Select it in the menu of '' |
| ===== Selecting code revision ===== | ===== Selecting code revision ===== | ||
| Line 139: | Line 146: | ||
| git checkout ${REV_HASH} | git checkout ${REV_HASH} | ||
| REV_BRANCH=" | REV_BRANCH=" | ||
| + | |||
| + | # Replace all src-git with src-git-full: | ||
| sed -e "/ | sed -e "/ | ||
| + | |||
| ./ | ./ | ||
| + | |||
| + | # Edit every line of feeds.conf in a loop to set the chosen revision hash | ||
| sed -n -e "/ | sed -n -e "/ | ||
| | while read -r FEED_ID | | while read -r FEED_ID | ||
| Line 148: | Line 160: | ||
| sed -i -e "/ | sed -i -e "/ | ||
| done | done | ||
| + | |||
| ./ | ./ | ||
| ./ | ./ | ||
| Line 280: | Line 293: | ||
| :!: Also you won't be able to install kernel packages from the official repositories when you make changes here. | :!: Also you won't be able to install kernel packages from the official repositories when you make changes here. | ||
| - | While you won't typically need to do this, you can do it: | + | While you won't typically need to do this, first define the target, subtarget, and device in a '' |
| + | <code bash> | ||
| + | CONFIG_TARGET_x86=y | ||
| + | CONFIG_TARGET_x86_64=y | ||
| + | CONFIG_TARGET_x86_64_DEVICE_generic=y | ||
| + | </ | ||
| + | Now run the following where subtarget is not a variable, it is a literal and it references the '' | ||
| <code bash> | <code bash> | ||
| make kernel_menuconfig CONFIG_TARGET=subtarget | make kernel_menuconfig CONFIG_TARGET=subtarget | ||
| Line 295: | Line 314: | ||
| </ | </ | ||
| - | === Source mirrors === | + | ==== Source mirrors |
| The 'Build system settings' | The 'Build system settings' | ||
| - Local mirror for source packages | - Local mirror for source packages | ||
| Line 354: | Line 373: | ||
| <code bash> | <code bash> | ||
| make download | make download | ||
| - | ionice -c 3 nice -n19 make -j9 | + | ionice -c 3 chrt --idle 0 nice -n19 make -j9 |
| </ | </ | ||
| Line 370: | Line 389: | ||
| It doesn' | It doesn' | ||
| + | |||
| + | Note: you must have done a full tree build (make, or make world) beforehand for this to work reliably. | ||
| === Spotting build errors === | === Spotting build errors === | ||
| Line 414: | Line 435: | ||
| make -i ... | make -i ... | ||
| </ | </ | ||
| + | |||
| + | |||
| + | === Make a summary information of generated image === | ||
| + | <code bash> | ||
| + | make json_overview_image_info | ||
| + | </ | ||
| + | Generate a summary of the image (including default packages, type of target, etc... ) in JSON format. The output is available in ''< | ||
| + | |||
| + | |||
| + | === Calculate checksum for generated files === | ||
| + | <code bash> | ||
| + | make checksum | ||
| + | </ | ||
| + | The following action will take place: a checksum will be computed and saved for the output files. This checksum will then be stored in the '< | ||
| ===== Locating images ===== | ===== Locating images ===== | ||
| Line 425: | Line 460: | ||
| ===== Cleaning up ===== | ===== Cleaning up ===== | ||
| You might need to clean your //build environment// | You might need to clean your //build environment// | ||
| - | The following '' | ||
| + | The build artefacts, toolchain, build tools and downloaded feeds & sources files can be cleaned selectively.\\ | ||
| + | The following '' | ||
| + | |||
| + | ^ > Cleaned components > \\ v make argument v^ Compiled binaries:\\ firmware, kernel, packages ^ Toolchain\\ (target-specific) | ||
| + | | clean | x | | | | | | | ||
| + | | targetclean | ||
| + | | dirclean | ||
| + | | config-clean | | | | x | | | | ||
| + | | distclean | ||
| ==== Clean ==== | ==== Clean ==== | ||
| <code bash> | <code bash> | ||
| Line 436: | Line 479: | ||
| It is a good practice to do '' | It is a good practice to do '' | ||
| That may not be necessary always, but as a general rule it helps to ensure quality builds. | That may not be necessary always, but as a general rule it helps to ensure quality builds. | ||
| + | |||
| + | ==== Targetclean ==== | ||
| + | <code bash> | ||
| + | make targetclean | ||
| + | </ | ||
| + | |||
| + | This cleans also the target-specific toolchain in addition of doing '' | ||
| + | Does a '' | ||
| + | Note: '' | ||
| ==== Dirclean ==== | ==== Dirclean ==== | ||
| Line 442: | Line 494: | ||
| </ | </ | ||
| - | This is your basic "full clean" operation. | + | This is your basic "full clean" operation. |
| - | Deletes contents of the directories ''/ | + | Deletes contents of the directories ''/ |
| ==== Distclean ==== | ==== Distclean ==== | ||
| Line 453: | Line 506: | ||
| :!: In addition to all else, this will **erase your build configuration ''< | :!: In addition to all else, this will **erase your build configuration ''< | ||
| Use only if you need a " | Use only if you need a " | ||
| + | |||
| ==== Selective cleanup ==== | ==== Selective cleanup ==== | ||