FYI, it helps a lot to strip those binaries. Maybe I should add that to the makefile.
On Aug 11, 2016 2:54 PM, "Barret Rhoden" <[email protected]> wrote: > Merged to master at 5e3ed80f093b..d135f0f66150 (from, to] > > You can see the entire diff with 'git diff' or at > https://github.com/brho/akaros/compare/5e3ed80f093b...d135f0f66150 > > > Careful with this. It'll grow the size of your initramfs a lot. I > didn't do a good before-and-after, but my kern/kfs/bin is large now: > > $ du -h kern/kfs/bin/ > 4.5M kern/kfs/bin/tests/utest > 4.6M kern/kfs/bin/tests > 137M kern/kfs/bin/ > > on another machine that is a few patches back, it's only 42 MB for > bin. my current machine might have a few extra binaries floating > around, but not 100 MB worth. > > This might pop up as an issue if you're moving the kernel around or > loading things directly. > > $ du -h obj/kern/* > 191M obj/kern/akaros-kernel > 191M obj/kern/akaros-kernel-64b > 30M obj/kern/akaros-kernel.asm > 50M obj/kern/akaros-kernel.gz > 176M obj/kern/initramfs.cpio > 176M obj/kern/initramfs.cpio.o > 180K obj/kern/ksyms.map > 212K obj/kern/ksyms-refl.c > 4.0K obj/kern/ksyms-refl.d > 296K obj/kern/ksyms-refl.o > > Barret > > > On 2016-08-11 at 12:41 Dan Cross <[email protected]> wrote: > > Add a Makefile and patchset to build coreutils for Akaros. > > > > Note that we hack the Makefile to fake manpage generation, > > as this requires running the output of the freshly-built > > commands through 'help2man'. But since those commands target > > Akaros, they won't run on the build machine (which will > > typically run some sort of POSIXy operating system like > > Linux). > > > > Change-Id: Icf3e17107184a4b024582e41063e251fe1b07880 > > Signed-off-by: Dan Cross <[email protected]> > > --- > > tools/sys-apps/coreutils/Makefile | 57 +++++ > > .../akaros-patches/8.25/coreutils-8.25.patch | 233 > > +++++++++++++++++++++ 2 files changed, 290 insertions(+) > > create mode 100644 tools/sys-apps/coreutils/Makefile > > create mode 100644 > > tools/sys-apps/coreutils/akaros-patches/8.25/coreutils-8.25.patch > > > > diff --git a/tools/sys-apps/coreutils/Makefile > > b/tools/sys-apps/coreutils/Makefile new file mode 100644 > > index 0000000..97bb9d6 > > --- /dev/null > > +++ b/tools/sys-apps/coreutils/Makefile > > @@ -0,0 +1,57 @@ > > +include ../../Makefrag > > + > > +########## Package-specific variables > > +version := 8.25 > > +src-dir = coreutils-$(version) > > +build-dir = $(src-dir)/build > > +tarball = coreutils-$(version).tar.xz > > +fetch-url = http://ftp.gnu.org/gnu/coreutils/$(tarball) > > +config-opts = --prefix=/usr \ > > + --bindir=/bin \ > > + --disable-nls \ > > + --host=x86_64-ucb-akaros \ > > + --build=i686-pc-linux-gnu > > + > > +########## Generic Infrastructure > > + > > +PHONY := all > > +all: make > > + > > +%.tar.xz: > > + $(Q)wget $(fetch-url) > > + > > +akaros-patches := $(sort $(wildcard akaros-patches/$(version)/*)) > > + > > +$(build-dir): $(tarball) $(akaros-patches) > > + rm -fr $(src-dir) > > + tar -xf $< > > + $(Q)mkdir $(build-dir) > > && \ > > + for i in $(akaros-patches); > > do \ > > + (cd $(src-dir) && patch -p1 > > < ../$$i); \ > > + done > > + > > +PHONY += config > > +$(build-dir)/Makefile config: $(build-dir) > > + cd $(build-dir) && env ../configure $(config-opts) && \ > > + sed -i '/^.run_help2man = .*dummy-man/s/^.//' Makefile && \ > > + sed -i '/^run_help2man = .*help2man/d' Makefile > > + > > +PHONY += make > > +make: config > > + $(Q)$(MAKE) -C $(build-dir) > > + > > +PHONY += install > > +install: make > > + $(Q)$(MAKE) -C $(build-dir) install-exec DESTDIR=$(KFS_ROOT) > > + > > +PHONY += clean > > +clean: > > + $(Q)[ -d $(build-dir) ] > > && \ > > + [ -f $(build-dir)/Makefile ] > > && \ > > + $(MAKE) -C $(build-dir) clean || true > > + > > +PHONY += mrproper > > +mrproper: > > + $(Q)rm -rf $(src-dir) > > + > > +.PHONY: $(PHONY) > > diff --git > > a/tools/sys-apps/coreutils/akaros-patches/8.25/coreutils-8.25.patch > > b/tools/sys-apps/coreutils/akaros-patches/8.25/coreutils-8.25.patch > > new file mode 100644 index 0000000..560a835 --- /dev/null > > +++ > > b/tools/sys-apps/coreutils/akaros-patches/8.25/coreutils-8.25.patch > > @@ -0,0 +1,233 @@ +diff -ur > > coreutils-8.25.dist/build-aux/config.guess > > coreutils-8.25/build-aux/config.guess +--- > > coreutils-8.25.dist/build-aux/config.guess 2016-01-16 > > 12:11:09.000000000 -0500 ++++ > > coreutils-8.25/build-aux/config.guess 2016-05-25 > > 13:45:03.633843452 -0400 +@@ -233,6 +233,10 @@ > > + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` > > + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} > > + exit ;; > > ++ *:Akaros:*:*) > > ++ UNAME_MACHINE_ARCH=x86_64 > > ++ echo x86_64-ucb-akaros1.0 > > ++ exit ;; > > + *:OpenBSD:*:*) > > + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` > > + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} > > +diff -ur coreutils-8.25.dist/build-aux/config.sub > > coreutils-8.25/build-aux/config.sub +--- > > coreutils-8.25.dist/build-aux/config.sub 2016-01-16 > > 12:11:09.000000000 -0500 ++++ > > coreutils-8.25/build-aux/config.sub 2016-05-25 > > 13:45:28.554516328 -0400 +@@ -1378,7 +1378,7 @@ > > + | -hpux* | -unos* | -osf* | -luna* | -dgux* | > > -auroraux* | -solaris* \ > > + | -sym* | -kopensolaris* | -plan9* \ > > + | -amigaos* | -amigados* | -msdos* | -newsos* | > > -unicos* | -aof* \ +- | -aos* | -aros* | -cloudabi* | > > -sortix* \ ++ | -akaros* | -aos* | -aros* | -cloudabi* | > > -sortix* \ > > + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | > > -mvs* \ > > + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | > > -xenix* \ > > + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* > > \ +diff -ur coreutils-8.25.dist/lib/strerror.c > > coreutils-8.25/lib/strerror.c +--- > > coreutils-8.25.dist/lib/strerror.c 2016-01-01 > > 08:45:55.000000000 -0500 ++++ coreutils-8.25/lib/strerror.c > > 2016-05-25 14:00:06.510268916 -0400 +@@ -38,14 +38,13 @@ > > + { > > + static char buf[STACKBUF_LEN]; > > + size_t len; > > ++ const char *estr = errstr(); > > + > > + /* Cast away const, due to the historical signature of strerror; > > + callers should not be modifying the string. */ > > + const char *msg = strerror_override (n); > > +- if (msg) > > +- return (char *) msg; > > +- > > +- msg = strerror (n); > > ++ if (!msg) > > ++ msg = strerror (n); > > + > > + /* Our strerror_r implementation might use the system's strerror > > + buffer, so all other clients of strerror have to see the error > > +@@ -66,5 +65,11 @@ > > + if (sizeof buf <= len) > > + abort (); > > + > > +- return memcpy (buf, msg, len + 1); > > ++ memcpy (buf, msg, len + 1); > > ++ if (estr && *estr) { > > ++ memcpy(buf + len, ", ", 2); > > ++ memcpy(buf + len + 2, estr, strlen(estr) + 1); > > ++ } > > ++ > > ++ return buf; > > + } > > +diff -ur coreutils-8.25.dist/src/echo.c coreutils-8.25/src/echo.c > > +--- coreutils-8.25.dist/src/echo.c 2016-01-01 > > 08:48:50.000000000 -0500 ++++ coreutils-8.25/src/echo.c > > 2016-07-15 14:53:14.351486065 -0400 +@@ -111,6 +111,8 @@ > > + bool allow_options = > > + (! getenv ("POSIXLY_CORRECT") > > + || (! DEFAULT_ECHO_TO_XPG && 1 < argc && STREQ (argv[1], > > "-n"))); ++ char *buf, *b; > > ++ size_t len; > > + > > + /* System V machines already have a /bin/sh with a v9 behavior. > > + Use the identical behavior for these machines so that the > > +@@ -189,6 +191,20 @@ > > + > > + just_echo: > > + > > ++ len = 0; > > ++ for (int i = 0; i < argc; i++) > > ++ { > > ++ len += 1; > > ++ len += strlen (argv[i]); > > ++ } > > ++ buf = calloc(1, len); > > ++ if (buf == NULL) > > ++ { > > ++ perror("malloc failed"); > > ++ exit(EXIT_FAILURE); > > ++ } > > ++ b = buf; > > ++ > > + if (do_v9) > > + { > > + while (argc > 0) > > +@@ -243,30 +259,34 @@ > > + case '\\': break; > > + > > + not_an_escape: > > +- default: putchar ('\\'); break; > > ++ default: *b++ = '\\'; break; > > + } > > + } > > +- putchar (c); > > ++ *b++ = c; > > + } > > + argc--; > > + argv++; > > + if (argc > 0) > > +- putchar (' '); > > ++ *b++ = ' '; > > + } > > + } > > + else > > + { > > + while (argc > 0) > > + { > > +- fputs (argv[0], stdout); > > ++ len = strlen(argv[0]); > > ++ memmove(b, argv[0], len); > > ++ b += len; > > + argc--; > > + argv++; > > + if (argc > 0) > > +- putchar (' '); > > ++ *b++ = ' '; > > + } > > + } > > + > > + if (display_return) > > +- putchar ('\n'); > > ++ *b++ = '\n'; > > ++ write(1, buf, b - buf); > > ++ free(buf); > > + return EXIT_SUCCESS; > > + } > > +diff -ur coreutils-8.25.dist/src/ls.c coreutils-8.25/src/ls.c > > +--- coreutils-8.25.dist/src/ls.c 2016-01-14 > > 07:16:23.000000000 -0500 ++++ coreutils-8.25/src/ls.c > > 2016-05-25 13:50:13.426213819 -0400 +@@ -3203,6 +3203,7 @@ > > + if (nlink_width < b_len) > > + nlink_width = b_len; > > + > > ++#ifndef __ros__ > > + if (S_ISCHR (f->stat.st_mode) || S_ISBLK > > (f->stat.st_mode)) > > + { > > + char buf[INT_BUFSIZE_BOUND (uintmax_t)]; > > +@@ -3218,6 +3219,7 @@ > > + } > > + else > > + { > > ++#endif > > + char buf[LONGEST_HUMAN_READABLE + 1]; > > + uintmax_t size = unsigned_file_size (f->stat.st_size); > > + int len = mbswidth (human_readable (size, buf, > > +@@ -3226,7 +3228,9 @@ > > + 0); > > + if (file_size_width < len) > > + file_size_width = len; > > ++#ifndef __ros__ > > + } > > ++#endif > > + } > > + } > > + > > +@@ -3951,6 +3955,7 @@ > > + p = buf; > > + } > > + > > ++#ifndef __ros__ > > + if (f->stat_ok > > + && (S_ISCHR (f->stat.st_mode) || S_ISBLK (f->stat.st_mode))) > > + { > > +@@ -3968,6 +3973,7 @@ > > + } > > + else > > + { > > ++#endif > > + char hbuf[LONGEST_HUMAN_READABLE + 1]; > > + char const *size = > > + (! f->stat_ok > > +@@ -3981,7 +3987,9 @@ > > + while ((*p++ = *size++)) > > + continue; > > + p[-1] = ' '; > > ++#ifndef __ros__ > > + } > > ++#endif > > + > > + when_local = localtime (&when_timespec.tv_sec); > > + s = 0; > > +diff -ur coreutils-8.25.dist/src/mknod.c coreutils-8.25/src/mknod.c > > +--- coreutils-8.25.dist/src/mknod.c 2016-01-01 > > 08:48:50.000000000 -0500 ++++ coreutils-8.25/src/mknod.c > > 2016-05-25 13:52:28.825875896 -0400 +@@ -91,6 +91,7 @@ > > + int > > + main (int argc, char **argv) > > + { > > ++#ifndef __ros__ > > + mode_t newmode; > > + char const *specified_mode = NULL; > > + int optc; > > +@@ -269,6 +270,9 @@ > > + if (specified_mode && lchmod (argv[optind], newmode) != 0) > > + error (EXIT_FAILURE, errno, _("cannot set permissions of %s"), > > + quoteaf (argv[optind])); > > ++#else > > ++ error (EXIT_FAILURE, EINVAL, _("Akaros does not support mknod.")); > > ++#endif > > + > > + return EXIT_SUCCESS; > > + } > > +diff -ur coreutils-8.25.dist/src/stat.c coreutils-8.25/src/stat.c > > +--- coreutils-8.25.dist/src/stat.c 2016-01-13 > > 06:16:39.000000000 -0500 ++++ coreutils-8.25/src/stat.c > > 2016-05-25 13:53:24.807390596 -0400 +@@ -1049,15 +1049,19 @@ > > + out_string (pformat, prefix_len, > > + gw_ent ? gw_ent->gr_name : "UNKNOWN"); > > + break; > > ++#ifndef __ros__ > > + case 't': > > + out_uint_x (pformat, prefix_len, major (statbuf->st_rdev)); > > + break; > > ++#endif > > + case 'm': > > + fail |= out_mount_point (filename, pformat, prefix_len, > > statbuf); > > + break; > > ++#ifndef __ros__ > > + case 'T': > > + out_uint_x (pformat, prefix_len, minor (statbuf->st_rdev)); > > + break; > > ++#endif > > + case 's': > > + out_int (pformat, prefix_len, statbuf->st_size); > > + break; > > -- > You received this message because you are subscribed to the Google Groups > "Akaros" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
