]> git.webhop.me Git - bs-cst-neutrino-hd.git/commitdiff
busybox: fix df if build with uclibc
authorMarkham <markham001@gmx.de>
Sun, 6 Aug 2017 15:27:51 +0000 (17:27 +0200)
committerMarkham <markham001@gmx.de>
Sun, 6 Aug 2017 15:27:51 +0000 (17:27 +0200)
archive-patches/busybox-1.26.2-fix-df-uclibc.diff [new file with mode: 0644]
make/applications.mk

diff --git a/archive-patches/busybox-1.26.2-fix-df-uclibc.diff b/archive-patches/busybox-1.26.2-fix-df-uclibc.diff
new file mode 100644 (file)
index 0000000..42241cd
--- /dev/null
@@ -0,0 +1,90 @@
+--- a/coreutils/df.c   2017-07-06 17:14:57.000000000 +0200
++++ b/coreutils/df.c   2015-07-13 04:18:47.000000000 +0200
+@@ -7,6 +7,10 @@
+  *
+  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+  */
++
++/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
++/* http://www.opengroup.org/onlinepubs/007904975/utilities/df.html */
++
+ /* Mar 16, 2003      Manuel Novoa III   (mjn3@codepoet.org)
+  *
+  * Size reduction.  Removed floating point dependency.  Added error checking
+@@ -127,19 +109,8 @@
+       if (opt & OPT_MEGA)
+               df_disp_hr = 1024*1024;
+-      if (opt & OPT_BSIZE) {
+-              /* GNU coreutils 8.25 accepts "-BMiB" form too */
+-              int i;
+-              for (i = 0; kmg_i_suffixes[i].suffix[0]; i++) {
+-                      if (strcmp(kmg_i_suffixes[i].suffix, chp) == 0) {
+-                              df_disp_hr = kmg_i_suffixes[i].mult;
+-                              goto got_it;
+-                      }
+-              }
+-              /* Range used to disallow 0 */
+-              df_disp_hr = xatoul_range_sfx(chp, 1, ULONG_MAX, kmg_i_suffixes);
+- got_it: ;
+-      }
++      if (opt & OPT_BSIZE)
++              df_disp_hr = xatoul_range(chp, 1, ULONG_MAX); /* disallow 0 */
+       /* From the manpage of df from coreutils-6.10:
+        * Disk space is shown in 1K blocks by default, unless the environment
+@@ -212,17 +183,12 @@
+                       bb_simple_perror_msg(mount_point);
+                       goto set_error;
+               }
+-              /* Some uclibc versions were seen to lose f_frsize
+-               * (kernel does return it, but then uclibc does not copy it)
+-               */
+-              if (s.f_frsize == 0)
+-                      s.f_frsize = s.f_bsize;
+               if ((s.f_blocks > 0) || !mount_table || (opt & OPT_ALL)) {
+                       if (opt & OPT_INODE) {
+                               s.f_blocks = s.f_files;
+                               s.f_bavail = s.f_bfree = s.f_ffree;
+-                              s.f_frsize = 1;
++                              s.f_bsize = 1;
+                               if (df_disp_hr)
+                                       df_disp_hr = 1;
+@@ -280,26 +246,26 @@
+ #if ENABLE_FEATURE_HUMAN_READABLE
+                       printf(" %9s ",
+-                              /* f_blocks x f_frsize / df_disp_hr, show one fractional,
++                              /* f_blocks x f_bsize / df_disp_hr, show one fractional,
+                                * use suffixes if df_disp_hr == 0 */
+-                              make_human_readable_str(s.f_blocks, s.f_frsize, df_disp_hr));
++                              make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
+                       printf(" %9s " + 1,
+-                              /* EXPR x f_frsize / df_disp_hr, show one fractional,
++                              /* EXPR x f_bsize / df_disp_hr, show one fractional,
+                                * use suffixes if df_disp_hr == 0 */
+                               make_human_readable_str((s.f_blocks - s.f_bfree),
+-                                              s.f_frsize, df_disp_hr));
++                                              s.f_bsize, df_disp_hr));
+                       printf("%9s %3u%% %s\n",
+-                              /* f_bavail x f_frsize / df_disp_hr, show one fractional,
++                              /* f_bavail x f_bsize / df_disp_hr, show one fractional,
+                                * use suffixes if df_disp_hr == 0 */
+-                              make_human_readable_str(s.f_bavail, s.f_frsize, df_disp_hr),
++                              make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr),
+                               blocks_percent_used, mount_point);
+ #else
+                       printf(" %9lu %9lu %9lu %3u%% %s\n",
+-                              kscale(s.f_blocks, s.f_frsize),
+-                              kscale(s.f_blocks - s.f_bfree, s.f_frsize),
+-                              kscale(s.f_bavail, s.f_frsize),
++                              kscale(s.f_blocks, s.f_bsize),
++                              kscale(s.f_blocks - s.f_bfree, s.f_bsize),
++                              kscale(s.f_bavail, s.f_bsize),
+                               blocks_percent_used, mount_point);
+ #endif
+               }
index 4566568cb443eef0b88ad9626affbd24cc3def17..672749f414982ad76685ce6557839ca953ecf4d1 100755 (executable)
@@ -22,12 +22,16 @@ busyboxconfig: $(ARCHIVE)/busybox-$(BUSYBOX_VER).tar.bz2 | $(TARGETPREFIX)
                cp $(PATCHES)/busybox-1.22.1-hd1.config .config && \
                make ARCH=arm CROSS_COMPILE=$(TARGET)- menuconfig
 
+ifeq ($(PLATFORM), $(filter $(PLATFORM), apollo kronos))
+DF_FIX = $(PATCH)/busybox-1.26.2-fix-df-uclibc.diff;
+endif
 $(D)/busybox: $(ARCHIVE)/busybox-$(BUSYBOX_VER).tar.bz2 | $(TARGETPREFIX)
        $(UNTAR)/busybox-$(BUSYBOX_VER).tar.bz2
        pushd $(BUILD_TMP)/busybox-$(BUSYBOX_VER) && \
                $(PATCH)/busybox-1.18-hack-init-s-console.patch; \
                $(PATCH)/busybox-1.21.1-changing-the-order-sys-tree-is-scanned-with-mdev.diff; \
                $(PATCH)/busybox-1.21.1-mdev.diff; \
+               $(DF_FIX) \
                cp $(PATCHES)/busybox-1.22.1-hd1.config .config && \
                sed -i -e 's#^CONFIG_PREFIX.*#CONFIG_PREFIX="$(TARGETPREFIX)"#' .config && \
                $(MAKE) all  CROSS_COMPILE=$(TARGET)- CFLAGS_EXTRA="$(TARGET_CFLAGS)" && \