summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2023-02-27fixdep: avoid underflow when end of entry doesn't coincide with EOFArsen Arsenović
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>
2022-04-21kbuild: fix building sha256Bernhard Reutner-Fischer
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>
2022-01-04build system: detect if build host has no bzip2Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-12-28scripts/echo.c: fix NUL handling in "abc\0 def"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-08-16scripts/randomtest.loop: let user know about SKIP_MOUNT_MAND_TESTSDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-08-15*: remove remains of FEATURE_TOUCH_NODEREFDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-05build system: use SOURCE_DATE_EPOCH for timestamp if availablePaul Spooren
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>
2021-06-05gen_build_files: Use C locale when calling sed on globbed filesKhem Raj
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>
2021-04-22gcc-version.sh: fix for "invalid number" message during Android NDK buildsChris Renshaw
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>
2021-04-18gcc-version.sh: Cygwin fixDenys Vlasenko
On Cygwin, "echo __GNUC__ __GNUC_MINOR__ | gcc -E -xc -" can print extra empty trailing line. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14fix "warning array subscript has type 'char'"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13build system: avoid build failure during bisectionRon Yorston
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>
2021-03-09bloat-o-meter: avoid double countingRon Yorston
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>
2021-02-23trylink: do not drop libs from CONFIG_EXTRA_LDLIBSDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01tar: add TODO about a bug with non-writable directories on extractDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-29build system: remove KBUILD_STR()Jean-Philippe Brucker
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>
2019-03-05scripts/echo.c: resolve implicit declaration of function 'dup2'Nicolas Hüppelshäuser
Signed-off-by: Nicolas Hüppelshäuser <nicolas.hueppelshaeuser@emlix.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-18checkstack.pl: tweak bfin reBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2019-01-17checkstack: pull from upstreamBernhard Reutner-Fischer
merge upstream changes Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2019-01-17checkstack.pl: fix arch autodetectionBernhard Reutner-Fischer
chomp trailing newlines Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2019-01-06build system: fix compiler warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-27hush: allow hush to run embedded scriptsRon Yorston
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>
2018-11-27Tweaks to build process for embedded scriptsRon Yorston
- 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>
2018-11-19scripts/trylink: be more clever when deciding that "lib elimination" has ↵Denys Vlasenko
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>
2018-11-18Ensure build works when KBUILD_OUTPUT is set, closes 11511Ron Yorston
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>
2018-11-17Treat custom and applet scripts as appletsRon Yorston
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>
2018-11-02scripts/embedded_scripts: do not add superfluous NUL to script_names[]Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-01ash: allow shell scripts to be embedded in the binaryDenys Vlasenko
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>
2018-06-26scripts/randomtest: disable CONFIG_NSLOOKUP for uclibcDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-26scripts/randomtest: disable CONFIG_FEATURE_INETD_RPC for glibcDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-26scripts/randomtest: disable CONFIG_FEATURE_MOUNT_NFS for glibcDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-09Update release script to generate detached signatures and checksum filesEli Schwartz
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>
2018-04-06scripts/kconfig/mconf.c: survive is SIGWINCH is not definedDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-05placate gcc 8.0.1 sprintf overflow warnings in config toolsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-12-31scripts/randomtest: do not try building static libbysuboxDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-12-31randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-07build system: fix a compiler warningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-07build system: fix "allnoconfig" to clear all options. Closes 10296Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-18klibc-utils: new applets: resume, nuke, minipsDenys Vlasenko
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>
2017-08-02do not use `a' quoting style in commentsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-22crond: do not assume setenv() does not leakDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-15build system: FEATURE_LIBBUSYBOX_STATIC - try to pull libc/libm into libbusyboxDenys Vlasenko
It variously fails with different toolchains I tried... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03fixes for bugs found by make_single_applets.shDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03scripts/randomtest: update things which can't be tested on uclibcDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-24remove "local" bashism from a few scriptsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-12trylink: use "mktemp tmp.XXXXXXXXXX" to placate OS XDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-29build system: make CONFIG_FEATURE_USE_BSS_TAIL less funkyDenys Vlasenko
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>