summaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* fixdep: avoid underflow when end of entry doesn't coincide with EOFArsen Arsenović2023-02-271-0/+5
| | | | | | | Bug: https://bugs.gentoo.org/893776 Closes: https://bugs.busybox.net/show_bug.cgi?id=15326 Signed-off-by: Arsen Arsenović <arsen@gentoo.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* kbuild: fix building sha256Bernhard Reutner-Fischer2022-04-211-0/+1
| | | | | | | | | | | Pass down the correct EXTRA_CFLAGS to the compiler driver when building assembler source. Otherwise building busybox for a multilib other than the default failed to link since hash_md5_sha256_x86-64_shaNI.o and hash_md5_sha_x86-64_shaNI.o were built for the default arch which might not what we requested in the EXTRA_CFLAGS. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* build system: detect if build host has no bzip2Denys Vlasenko2022-01-043-3/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/echo.c: fix NUL handling in "abc\0 def"Denys Vlasenko2021-12-281-14/+21
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/randomtest.loop: let user know about SKIP_MOUNT_MAND_TESTSDenys Vlasenko2021-08-161-3/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: remove remains of FEATURE_TOUCH_NODEREFDenys Vlasenko2021-08-151-2/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: use SOURCE_DATE_EPOCH for timestamp if availablePaul Spooren2021-06-051-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | The SOURCE_DATE_EPOCH is an effort of the Reproducible Builds organization to make timestamps/build dates in compiled tools deterministic over several repetitive builds. Busybox shows by default the build date timestamp which changes whenever compiled. To have a reasonable accurate build date while staying reproducible, it's possible to use the *date of last source modification* rather than the current time and date. Further information on SOURCE_DATE_EPOCH are available online [1]. This patch modifies `confdata.c` so that the content of the SOURCE_DATE_EPOCH env variable is used as timestamp. To be independent of different timezones between builds, whenever SOURCE_DATE_EPOCH is defined the GMT time is used. [1]: https://reproducible-builds.org/docs/source-date-epoch/ Signed-off-by: Paul Spooren <mail@aparcar.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* gen_build_files: Use C locale when calling sed on globbed filesKhem Raj2021-06-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When include/applets.h is re-generated it generates code macros in include/applets.h e.g. IF_XZCAT(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat)) ... IF_CHVT(APPLET_NOEXEC(chvt, chvt, BB_DIR_USR_BIN, BB_SUID_DROP, chvt)) ... sed is used to process source files like below to feed into this header generation sed -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c this means we let shell decide the order of .c files being fed into sed tool, applets.h has code snippets thats generated out of code fragments from these .c files and the order of the generated code depends on the order of .c files being fed to sed and then piped to generate tool, even though the generated code is logically same, it does result in re-odered code in applets.h based on which shell was used during build on exact busybox sources since sort order is different based on chosen locale and also default shell being bash or dash This sets the environment variable LC_ALL to the value C, which will enforce bytewise sorting, irrespective of the shell Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* gcc-version.sh: fix for "invalid number" message during Android NDK buildsChris Renshaw2021-04-221-2/+2
| | | | | | | | | A CR in the gcc output would cause the following to show throughout build: : invalid numberbox-1.32.1/scripts/gcc-version.sh: line 12: printf: 9 Signed-off-by: Chris Renshaw <osm0sis@outlook.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* gcc-version.sh: Cygwin fixDenys Vlasenko2021-04-181-1/+1
| | | | | | | On Cygwin, "echo __GNUC__ __GNUC_MINOR__ | gcc -E -xc -" can print extra empty trailing line. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix "warning array subscript has type 'char'"Denys Vlasenko2021-04-146-21/+21
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: avoid build failure during bisectionRon Yorston2021-04-131-1/+1
| | | | | | | | | | | | | | | | | | Commit 4bdc914ff (build system: fix compiler warnings) added a test on the return value of fgets() in split-include.c. During bisection it's possible to go back to a state where a configuration value didn't exist. This results in an empty include file corresponding to the missing feature. If a subsequent bisection returns to a state where the feature exists split-include treats the empty file as an error and the build fails. Add a call to ferror() to distinguish between fgets() failing due to an error and due to there being no data to read. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* bloat-o-meter: avoid double countingRon Yorston2021-03-091-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable 'echo' in the default config, run 'make baseline', then re-enable 'echo' and run 'make bloatcheck': function old new delta .rodata 182521 182622 +101 packed_usage 33714 33792 +78 applet_main 3168 3176 +8 applet_names 2730 2735 +5 applet_suid 99 100 +1 applet_install_loc 198 199 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/0 up/down: 194/0) Total: 194 bytes text data bss dec hex filename 955052 4195 1808 961055 eaa1f busybox_old 955153 4195 1808 961156 eaa84 busybox_unstripped The Total bytes value doesn't equal the change in the size of the binary. The packed_usage and applet_* items are in .rodata and are counted twice. With this modified bloat-o-meter the size of named items is deducted from .rodata: function old new delta packed_usage 33714 33792 +78 applet_main 3168 3176 +8 .rodata 105105 105113 +8 applet_names 2730 2735 +5 applet_suid 99 100 +1 applet_install_loc 198 199 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/0 up/down: 101/0) Total: 101 bytes text data bss dec hex filename 955052 4195 1808 961055 eaa1f busybox_old 955153 4195 1808 961156 eaa84 busybox_unstripped v2: Sections numbered less than 10 were always being omitted from consideration because splitting "[ 1] .interp" leaves "1]" in x[1] where the section name is expected. This wasn't a problem for .rodata (numbered 15 in my testing) but let's fix it anyway. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* trylink: do not drop libs from CONFIG_EXTRA_LDLIBSDenys Vlasenko2021-02-231-5/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tar: add TODO about a bug with non-writable directories on extractDenys Vlasenko2021-01-011-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2020-06-241-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2020-06-231-0/+22
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: remove KBUILD_STR()Jean-Philippe Brucker2020-04-294-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using GNU Make >=4.3, the KBUILD_STR() definition interferes badly with dependency checks during build, and forces a complete rebuild every time Make runs. In if_changed_rule, Kconfig checks if the command used to build a file has changed since last execution. The previous command is stored in the generated .<file>.o.cmd file. For example applets/.applets.o.cmd defines a "cmd_applets/applets.o" variable: cmd_applets/applets.o := gcc ... -D"KBUILD_STR(s)=#s" ... Here the '#' should be escaped with a backslash, otherwise GNU Make interprets it as starting a comment, and ignore the rest of the variable. As a result of this truncation, the previous command doesn't equal the new command and Make rebuilds each target. The problem started to appear when GNU Make 4.3 (released January 2020), introduced a backward-incompatible fix to macros containing a '#'. While the above use of '#', a simple Make variable, still needs to be escaped, a '#' within a function invocation doesn't need to be escaped anymore. As Martin Dorey explained on the GNU Make discussion [1], the above declaration is generated from make-cmd, defined as: make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))) Since GNU Make 4.3, the first argument of subst should not have a backslash. make-cmd now looks for literally \# and doesn't find it, and as a result doesn't add the backslash when generating .o.cmd files. [1] http://savannah.gnu.org/bugs/?20513 We could fix it by changing make-cmd to "$(subst #,\#,...)", but to avoid compatibility headaches, simply get rid of the KBUILD_STR definition, as done in Linux by b42841b7bb62 ("kbuild: Get rid of KBUILD_STR"). Quote the string arguments directly rather than asking the preprocessor to quote them. Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/echo.c: resolve implicit declaration of function 'dup2'Nicolas Hüppelshäuser2019-03-051-0/+1
| | | | | Signed-off-by: Nicolas Hüppelshäuser <nicolas.hueppelshaeuser@emlix.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* checkstack.pl: tweak bfin reBernhard Reutner-Fischer2019-01-181-1/+1
| | | | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* checkstack: pull from upstreamBernhard Reutner-Fischer2019-01-171-32/+75
| | | | | | merge upstream changes Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* checkstack.pl: fix arch autodetectionBernhard Reutner-Fischer2019-01-171-0/+1
| | | | | | chomp trailing newlines Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* build system: fix compiler warningsDenys Vlasenko2019-01-064-6/+12
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: allow hush to run embedded scriptsRon Yorston2018-11-272-1/+9
| | | | | | | | | | | | | Embedded scripts require a shell to be present in the BusyBox binary. Allow either ash or hush to be used for this purpose. If both are enabled ash takes precedence. The size of the binary is unchanged in the default configuration: both ash and hush are present but support for embedded scripts isn't compiled into hush. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Tweaks to build process for embedded scriptsRon Yorston2018-11-272-16/+10
| | | | | | | | | | | | | | | | | | | - Force a rebuild if a script in applets_sh is changed. - Move the dummy usage messages for custom applets to usage.h and change the name from 'dummy' to 'scripted'. - Hide an error from gen_build_files.sh if an embed directory exists but is empty. - Tidy up embedded_scripts script. v2: Remove a couple of unnecessary tests in embedded_scripts, as pointed out by Xabier Oneca. Drop the stripping of comments. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/trylink: be more clever when deciding that "lib elimination" has ↵Denys Vlasenko2018-11-191-12/+9
| | | | | | | | | | | | | | | | | | | | | | finished: Before: Trying libraries: crypt m resolv Library crypt is not needed, excluding it Library m is needed, can't exclude it (yet) Library resolv is needed, can't exclude it (yet) Library m is needed, can't exclude it (yet) Library resolv is needed, can't exclude it (yet) Final link with: m resolv After: Trying libraries: crypt m resolv Library crypt is not needed, excluding it Library m is needed, can't exclude it (yet) Library resolv is needed, can't exclude it (yet) Final link with: m resolv Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Ensure build works when KBUILD_OUTPUT is set, closes 11511Ron Yorston2018-11-181-1/+1
| | | | | | | | The build process for embedded scripts didn't have consistent support for saving output to a different directory. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Treat custom and applet scripts as appletsRon Yorston2018-11-172-26/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BusyBox has support for embedded shell scripts. Two types can be distinguished: custom scripts and scripts implementing applets. Custom scripts should be placed in the 'embed' directory at build time. They are given a default applet configuration and appear as applets to the user but no further configuration is possible. Applet scripts are integrated with the BusyBox build system and are intended to be used to ship standard applets that just happen to be implemented as scripts. They can be configured at build time and appear just like native applets. Such scripts should be placed in the 'applets_sh' directory. A stub C program should be written to provide the usual applet configuration details and placed in a suitable subsystem directory. It may be helpful to have a configuration option to enable any dependencies the script requires: see the 'nologin' applet for an example. function old new delta scripted_main - 41 +41 applet_names 2773 2781 +8 applet_main 1600 1604 +4 i2cdetect_main 672 674 +2 applet_suid 100 101 +1 applet_install_loc 200 201 +1 applet_flags 100 101 +1 packed_usage 33180 33179 -1 tryexec 159 152 -7 evalcommand 1661 1653 -8 script_names 9 - -9 packed_scripts 123 114 -9 complete_cmd_dir_file 826 811 -15 shellexec 271 254 -17 find_command 1007 990 -17 busybox_main 642 624 -18 run_applet_and_exit 100 78 -22 find_script_by_name 51 - -51 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 6/9 up/down: 58/-174) Total: -116 bytes text data bss dec hex filename 950034 477 7296 957807 e9d6f busybox_old 949918 477 7296 957691 e9cfb busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/embedded_scripts: do not add superfluous NUL to script_names[]Denys Vlasenko2018-11-021-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: allow shell scripts to be embedded in the binaryDenys Vlasenko2018-11-011-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To assist in the deployment of shell scripts it may be convenient to embed them in the BusyBox binary. 'Embed scripts in the binary' takes any files in the directory 'embed', concatenates them with null separators, compresses them and embeds them in the binary. When scripts are embedded in the binary, scripts can be run as 'busybox SCRIPT [ARGS]' or by usual (sym)link mechanism. embed/nologin is provided as an example. function old new delta packed_scripts - 123 +123 unpack_scripts - 87 +87 ash_main 1103 1171 +68 run_applet_and_exit 78 128 +50 get_script_content - 32 +32 script_names - 10 +10 expmeta 663 659 -4 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 2/1 up/down: 370/-4) Total: 366 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/randomtest: disable CONFIG_NSLOOKUP for uclibcDenys Vlasenko2018-06-261-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/randomtest: disable CONFIG_FEATURE_INETD_RPC for glibcDenys Vlasenko2018-06-261-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/randomtest: disable CONFIG_FEATURE_MOUNT_NFS for glibcDenys Vlasenko2018-06-261-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update release script to generate detached signatures and checksum filesEli Schwartz2018-06-091-17/+5
| | | | | | | | This is more usable for programmatically checking the validity of a release. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/kconfig/mconf.c: survive is SIGWINCH is not definedDenys Vlasenko2018-04-061-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* placate gcc 8.0.1 sprintf overflow warnings in config toolsDenys Vlasenko2018-04-051-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/randomtest: do not try building static libbysuboxDenys Vlasenko2017-12-311-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2017-12-311-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: fix a compiler warningDenys Vlasenko2017-09-071-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: fix "allnoconfig" to clear all options. Closes 10296Denys Vlasenko2017-09-071-2/+52
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* klibc-utils: new applets: resume, nuke, minipsDenys Vlasenko2017-08-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | minips is a pure alias to ps, just in case someone needs 100% klibc-utils compat. nuke is a primitive version of "rm -rf" without options and error checks. ~30 bytes. resume is a tool for initramfs which resumes from a given block device. function old new delta resume_main - 582 +582 packed_usage 31640 31712 +72 nuke_main - 28 +28 xstrtoull - 24 +24 applet_names 2646 2665 +19 applet_main 1532 1544 +12 applet_suid 96 97 +1 applet_install_loc 192 193 +1 applet_flags 96 97 +1 ------------------------------------------------------------------------------ (add/remove: 5/0 grow/shrink: 6/0 up/down: 740/0) Total: 740 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* do not use `a' quoting style in commentsDenys Vlasenko2017-08-021-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* crond: do not assume setenv() does not leakDenys Vlasenko2017-07-221-0/+18
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: FEATURE_LIBBUSYBOX_STATIC - try to pull libc/libm into libbusyboxDenys Vlasenko2017-07-151-6/+12
| | | | | | It variously fails with different toolchains I tried... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fixes for bugs found by make_single_applets.shDenys Vlasenko2017-07-031-0/+26
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scripts/randomtest: update things which can't be tested on uclibcDenys Vlasenko2017-07-031-0/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove "local" bashism from a few scriptsDenys Vlasenko2017-01-242-9/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2016-12-121-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* trylink: use "mktemp tmp.XXXXXXXXXX" to placate OS XDenys Vlasenko2016-07-121-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: make CONFIG_FEATURE_USE_BSS_TAIL less funkyDenys Vlasenko2016-06-291-72/+28
| | | | | | | | | | CONFIG_FEATURE_USE_BSS_TAIL code was aliasing bb_common_bufsiz1 to _end. This is unreliable: _end may be not sufficiently aligned. Change code to simply enlarge COMMON_BUFSIZE when we detect that _end has significant amount of space to the end of page. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>