Skip to contentSkip to conversation

klibc for 2.5.64

PATCH New Greg KH 3 participants 10 messages Mar 5, 2003 – Mar 12, 2003 Kbuild

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 klibc for 2.5.64

Hi,

Here's a series of changesets that add klibc support to the 2.5.64 kernel. The only change since the last time I sent this is an addition of a LICENSE file to the klibc directory, and a merge with your latest bk tree.

Please pull from:

        bk://kernel.bkbits.net/gregkh/linux/klibc-2.5

If you have any problems or questions with them, please let me know.

I've attached a short changelog of the different things in this repository below, along with a diffstat of the resulting changes

Note, the Cset exclude is for Kai's cset that moved mounting of the root fs into userspace, we can start making those kind of changes later. The only changes here is to add klibc to the build, and add a small example program to the initramfs image that gets unpacked at boot time and run.

I've also placed a patch of all of this, against a clean 2.5.64 kernel at:
kernel.org/pub/linux/kernel/people/gregkh/klibc/klibc-2.5.64.patch.gz
for those who don't want to use BitKeeper.

thanks,

greg k-h

--------------
Changes from your bk tree:

Arnd Bergmann <[email protected]>:
o KLIBC: fix for non-i386 build

Arnd Bergmann <[email protected]>:
o klibc: gen_init_cpio file generation fix

Greg Kroah-Hartman <[email protected]>:
o KLIBC: added LICENSE file for klibc portion

  o Cset exclude: [email protected]|ChangeSet|20030217001132|22043

o KLIBC: fix up some type errors that were highlighted by the posix timer changes
o KLIBC: delete usr/root/hello
o klibc: add file support to gen_init_cpio.c
o klibc: fix up the hello_world example

Kai Germaschewski <[email protected]>:
o klibc make clean

Kai Germaschewski <[email protected]>:
o klibc: Move mounting of the root filesystem into userspace
o klibc: Silence too ambitious warnings
o klibc: Stop on error when building the CPIO
o klibc: Fix the "hello" example (for real)
o klibc: Fix a compiler warning
o kbuild/klibc: Integrate klibc into the build
o klibc: Merge klibc-0.77

-------------
Diffstat:

 Makefile                                        |   37 
 scripts/Makefile.build                          |    6 
 scripts/Makefile.clean                          |   11 
 scripts/Makefile.lib                            |    3 
 scripts/Makefile.user                           |  209 +
 usr/Makefile                                    |   40 
 usr/gen_init_cpio.c                             |   91 
 usr/lib/CAVEATS                                 |   51 
 usr/lib/LICENSE                                 |   73 
 usr/lib/MCONFIG                                 |   48 
 usr/lib/Makefile                                |  141 
 usr/lib/README                                  |   57 
 usr/lib/SOCKETCALLS                             |   21 
 usr/lib/SYSCALLS                                |  146 
 usr/lib/__shared_init.c                         |   56 
 usr/lib/__signal.c                              |   22 
 usr/lib/__static_init.c                         |   40 
 usr/lib/abort.c                                 |   19 
 usr/lib/alarm.c                                 |   29 
 usr/lib/arch/README                             |   67 
 usr/lib/arch/alpha/MCONFIG                      |   17 
 usr/lib/arch/alpha/Makefile.inc                 |   93 
 usr/lib/arch/alpha/README-gcc                   |   23 
 usr/lib/arch/alpha/crt0.S                       |   21 
 usr/lib/arch/alpha/divide.c                     |   57 
 usr/lib/arch/alpha/include/klibc/archsetjmp.h   |   24 
 usr/lib/arch/alpha/include/klibc/archsys.h      |   53 
 usr/lib/arch/alpha/include/machine/asm.h        |   44 
 usr/lib/arch/alpha/pipe.c                       |   28 
 usr/lib/arch/alpha/setjmp.S                     |   61 
 usr/lib/arch/arm/MCONFIG                        |   26 
 usr/lib/arch/arm/Makefile.inc                   |   31 
 usr/lib/arch/arm/crt0.S                         |   25 
 usr/lib/arch/arm/include/klibc/archsetjmp.h     |   14 
 usr/lib/arch/arm/include/klibc/archsys.h        |   12 
 usr/lib/arch/arm/setjmp-arm.S                   |   40 
 usr/lib/arch/arm/setjmp-thumb.S                 |   58 
 usr/lib/arch/cris/MCONFIG                       |   11 
 usr/lib/arch/cris/Makefile.inc                  |   10 
 usr/lib/arch/cris/include/klibc/archsys.h       |   12 
 usr/lib/arch/i386/MCONFIG                       |   24 
 usr/lib/arch/i386/Makefile.inc                  |   27 
 usr/lib/arch/i386/crt0.S                        |   33 
 usr/lib/arch/i386/exits.S                       |   45 
 usr/lib/arch/i386/include/klibc/archsetjmp.h    |   19 
 usr/lib/arch/i386/include/klibc/archsys.h       |   96 
 usr/lib/arch/i386/include/klibc/diverr.h        |   16 
 usr/lib/arch/i386/libgcc/__ashldi3.S            |   29 
 usr/lib/arch/i386/libgcc/__ashrdi3.S            |   29 
 usr/lib/arch/i386/libgcc/__lshrdi3.S            |   29 
 usr/lib/arch/i386/libgcc/__muldi3.S             |   34 
 usr/lib/arch/i386/libgcc/__negdi2.S             |   21 
 usr/lib/arch/i386/setjmp.S                      |   58 
 usr/lib/arch/i386/socketcall.S                  |   38 
 usr/lib/arch/ia64/MCONFIG                       |   11 
 usr/lib/arch/ia64/Makefile.inc                  |   10 
 usr/lib/arch/ia64/include/klibc/archsys.h       |   12 
 usr/lib/arch/m68k/MCONFIG                       |   11 
 usr/lib/arch/m68k/Makefile.inc                  |   10 
 usr/lib/arch/m68k/include/klibc/archsys.h       |   12 
 usr/lib/arch/mips/MCONFIG                       |   18 
 usr/lib/arch/mips/Makefile.inc                  |   24 
 usr/lib/arch/mips/crt0.S                        |   25 
 usr/lib/arch/mips/include/klibc/archsetjmp.h    |   39 
 usr/lib/arch/mips/include/klibc/archsys.h       |   12 
 usr/lib/arch/mips/include/machine/asm.h         |   11 
 usr/lib/arch/mips/include/sgidefs.h             |   20 
 usr/lib/arch/mips/pipe.S                        |   16 
 usr/lib/arch/mips/setjmp.S                      |   82 
 usr/lib/arch/mips/vfork.S                       |   19 
 usr/lib/arch/mips64/MCONFIG                     |   11 
 usr/lib/arch/mips64/Makefile.inc                |   10 
 usr/lib/arch/mips64/include/klibc/archsys.h     |   12 
 usr/lib/arch/parisc/MCONFIG                     |   11 
 usr/lib/arch/parisc/Makefile.inc                |   10 
 usr/lib/arch/parisc/include/klibc/archsys.h     |   12 
 usr/lib/arch/ppc/MCONFIG                        |   11 
 usr/lib/arch/ppc/Makefile.inc                   |   15 
 usr/lib/arch/ppc/crt0.S                         |   29 
 usr/lib/arch/ppc/include/klibc/archsetjmp.h     |   36 
 usr/lib/arch/ppc/include/klibc/archsys.h        |   55 
 usr/lib/arch/ppc/setjmp.S                       |   35 
 usr/lib/arch/ppc64/MCONFIG                      |   11 
 usr/lib/arch/ppc64/Makefile.inc                 |   10 
 usr/lib/arch/ppc64/crt0.S                       |   38 
 usr/lib/arch/ppc64/include/klibc/archsys.h      |   52 
 usr/lib/arch/s390/MCONFIG                       |   13 
 usr/lib/arch/s390/Makefile.inc                  |   16 
 usr/lib/arch/s390/crt0.S                        |   25 
 usr/lib/arch/s390/include/klibc/archsetjmp.h    |   15 
 usr/lib/arch/s390/include/klibc/archsys.h       |   41 
 usr/lib/arch/s390/setjmp.S                      |   32 
 usr/lib/arch/s390x/MCONFIG                      |   13 
 usr/lib/arch/s390x/Makefile.inc                 |   16 
 usr/lib/arch/s390x/crt0.S                       |   21 
 usr/lib/arch/s390x/include/klibc/archsetjmp.h   |   15 
 usr/lib/arch/s390x/include/klibc/archsys.h      |   41 
 usr/lib/arch/s390x/setjmp.S                     |   36 
 usr/lib/arch/sh/MCONFIG                         |   11 
 usr/lib/arch/sh/Makefile.inc                    |   10 
 usr/lib/arch/sh/include/klibc/archsys.h         |   12 
 usr/lib/arch/sparc/MCONFIG                      |   18 
 usr/lib/arch/sparc/Makefile.inc                 |   44 
 usr/lib/arch/sparc/crt0.S                       |    2 
 usr/lib/arch/sparc/crt0i.S                      |  100 
 usr/lib/arch/sparc/divrem.m4                    |  276 +
 usr/lib/arch/sparc/include/klibc/archsetjmp.h   |   16 
 usr/lib/arch/sparc/include/klibc/archsys.h      |   65 
 usr/lib/arch/sparc/include/machine/asm.h        |  192 +
 usr/lib/arch/sparc/include/machine/frame.h      |  138 
 usr/lib/arch/sparc/include/machine/trap.h       |  141 
 usr/lib/arch/sparc/setjmp.S                     |   38 
 usr/lib/arch/sparc/smul.S                       |  160 
 usr/lib/arch/sparc/umul.S                       |  193 +
 usr/lib/arch/sparc64/MCONFIG                    |   21 
 usr/lib/arch/sparc64/Makefile.inc               |   13 
 usr/lib/arch/sparc64/crt0.S                     |    2 
 usr/lib/arch/sparc64/include/klibc/archsetjmp.h |   16 
 usr/lib/arch/sparc64/include/klibc/archsys.h    |  157 
 usr/lib/arch/sparc64/setjmp.S                   |   55 
 usr/lib/arch/x86_64/MCONFIG                     |   16 
 usr/lib/arch/x86_64/Makefile.inc                |   16 
 usr/lib/arch/x86_64/crt0.S                      |   22 
 usr/lib/arch/x86_64/exits.S                     |   35 
 usr/lib/arch/x86_64/include/klibc/archsetjmp.h  |   21 
 usr/lib/arch/x86_64/include/klibc/archsys.h     |   32 
 usr/lib/arch/x86_64/setjmp.S                    |   54 
 usr/lib/assert.c                                |   13 
 usr/lib/atexit.c                                |   10 
 usr/lib/atexit.h                                |   19 
 usr/lib/atoi.c                                  |    3 
 usr/lib/atol.c                                  |    3 
 usr/lib/atoll.c                                 |    3 
 usr/lib/atox.c                                  |   14 
 usr/lib/brk.c                                   |   24 
 usr/lib/bsd_signal.c                            |   11 
 usr/lib/calloc.c                                |   21 
 usr/lib/closelog.c                              |   18 
 usr/lib/creat.c                                 |   12 
 usr/lib/ctypes.c                                |  281 +
 usr/lib/exec_l.c                                |   57 
 usr/lib/execl.c                                 |    8 
 usr/lib/execle.c                                |    8 
 usr/lib/execlp.c                                |    8 
 usr/lib/execlpe.c                               |    8 
 usr/lib/execv.c                                 |   13 
 usr/lib/execvp.c                                |   13 
 usr/lib/execvpe.c                               |   73 
 usr/lib/exitc.c                                 |   36 
 usr/lib/fdatasync.c                             |   15 
 usr/lib/fgetc.c                                 |   20 
 usr/lib/fgets.c                                 |   33 
 usr/lib/fopen.c                                 |   46 
 usr/lib/fork.c                                  |   29 
 usr/lib/fprintf.c                               |   19 
 usr/lib/fputc.c                                 |   14 
 usr/lib/fputs.c                                 |   15 
 usr/lib/fread.c                                 |   35 
 usr/lib/fread2.c                                |   13 
 usr/lib/fwrite.c                                |   35 
 usr/lib/fwrite2.c                               |   13 
 usr/lib/getcwd.c                                |   15 
 usr/lib/getdomainname.c                         |   25 
 usr/lib/getenv.c                                |   22 
 usr/lib/gethostname.c                           |   25 
 usr/lib/getopt.c                                |   74 
 usr/lib/getpriority.c                           |   25 
 usr/lib/globals.c                               |   10 
 usr/lib/include/alloca.h                        |   13 
 usr/lib/include/arpa/inet.h                     |   24 
 usr/lib/include/assert.h                        |   22 
 usr/lib/include/bits32/bitsize/limits.h         |   14 
 usr/lib/include/bits32/bitsize/stddef.h         |   18 
 usr/lib/include/bits32/bitsize/stdint.h         |   34 
 usr/lib/include/bits32/bitsize/stdintconst.h    |   18 
 usr/lib/include/bits32/bitsize/stdintlimits.h   |   22 
 usr/lib/include/bits64/bitsize/limits.h         |   14 
 usr/lib/include/bits64/bitsize/stddef.h         |   13 
 usr/lib/include/bits64/bitsize/stdint.h         |   36 
 usr/lib/include/bits64/bitsize/stdintconst.h    |   18 
 usr/lib/include/bits64/bitsize/stdintlimits.h   |   22 
 usr/lib/include/ctype.h                         |  117 
 usr/lib/include/dirent.h                        |   20 
 usr/lib/include/elf.h                           |   12 
 usr/lib/include/endian.h                        |   41 
 usr/lib/include/errno.h                         |    8 
 usr/lib/include/fcntl.h                         |   11 
 usr/lib/include/grp.h                           |   13 
 usr/lib/include/inttypes.h                      |  226 +
 usr/lib/include/klibc/compiler.h                |   61 
 usr/lib/include/klibc/diverr.h                  |   16 
 usr/lib/include/klibc/extern.h                  |   14 
 usr/lib/include/limits.h                        |   40 
 usr/lib/include/net/if.h                        |    1 
 usr/lib/include/net/if_arp.h                    |    1 
 usr/lib/include/net/if_ether.h                  |    1 
 usr/lib/include/net/if_packet.h                 |    1 
 usr/lib/include/netinet/in.h                    |   29 
 usr/lib/include/netinet/in6.h                   |   10 
 usr/lib/include/netinet/ip.h                    |   13 
 usr/lib/include/netinet/tcp.h                   |   11 
 usr/lib/include/netinet/udp.h                   |   19 
 usr/lib/include/poll.h                          |   16 
 usr/lib/include/sched.h                         |   23 
 usr/lib/include/setjmp.h                        |   43 
 usr/lib/include/signal.h                        |   72 
 usr/lib/include/stdarg.h                        |   14 
 usr/lib/include/stddef.h                        |   24 
 usr/lib/include/stdint.h                        |  113 
 usr/lib/include/stdio.h                         |  109 
 usr/lib/include/stdlib.h                        |   94 
 usr/lib/include/string.h                        |   37 
 usr/lib/include/sys/dirent.h                    |   13 
 usr/lib/include/sys/fsuid.h                     |   14 
 usr/lib/include/sys/ioctl.h                     |   14 
 usr/lib/include/sys/klog.h                      |   24 
 usr/lib/include/sys/mman.h                      |   21 
 usr/lib/include/sys/module.h                    |  158 
 usr/lib/include/sys/mount.h                     |   55 
 usr/lib/include/sys/param.h                     |   11 
 usr/lib/include/sys/reboot.h                    |   25 
 usr/lib/include/sys/resource.h                  |   15 
 usr/lib/include/sys/select.h                    |   13 
 usr/lib/include/sys/socket.h                    |   50 
 usr/lib/include/sys/socketcalls.h               |   28 
 usr/lib/include/sys/stat.h                      |   23 
 usr/lib/include/sys/syscall.h                   |   15 
 usr/lib/include/sys/time.h                      |   16 
 usr/lib/include/sys/times.h                     |   14 
 usr/lib/include/sys/types.h                     |  127 
 usr/lib/include/sys/uio.h                       |   15 
 usr/lib/include/sys/utime.h                     |   10 
 usr/lib/include/sys/utsname.h                   |   23 
 usr/lib/include/sys/vfs.h                       |   14 
 usr/lib/include/sys/wait.h                      |   19 
 usr/lib/include/syslog.h                        |   53 
 usr/lib/include/termios.h                       |   86 
 usr/lib/include/time.h                          |   14 
 usr/lib/include/unistd.h                        |  106 
 usr/lib/include/utime.h                         |   15 
 usr/lib/inet/inet_addr.c                        |   14 
 usr/lib/inet/inet_aton.c                        |   23 
 usr/lib/inet/inet_ntoa.c                        |   19 
 usr/lib/inet/inet_ntop.c                        |   52 
 usr/lib/inet/inet_pton.c                        |   74 
 usr/lib/interp.S                                |   11 
 usr/lib/isatty.c                                |   21 
 usr/lib/libgcc/__divdi3.c                       |   29 
 usr/lib/libgcc/__divsi3.c                       |   29 
 usr/lib/libgcc/__moddi3.c                       |   29 
 usr/lib/libgcc/__modsi3.c                       |   29 
 usr/lib/libgcc/__udivdi3.c                      |   13 
 usr/lib/libgcc/__udivmoddi4.c                   |   32 
 usr/lib/libgcc/__udivmodsi4.c                   |   32 
 usr/lib/libgcc/__udivsi3.c                      |   13 
 usr/lib/libgcc/__umoddi3.c                      |   16 
 usr/lib/libgcc/__umodsi3.c                      |   16 
 usr/lib/llseek.c                                |   34 
 usr/lib/lrand48.c                               |   42 
 usr/lib/makeerrlist.pl                          |   80 
 usr/lib/malloc.c                                |  192 +
 usr/lib/malloc.h                                |   51 
 usr/lib/memccpy.c                               |   23 
 usr/lib/memchr.c                                |   18 
 usr/lib/memcmp.c                                |   19 
 usr/lib/memcpy.c                                |   29 
 usr/lib/memmem.c                                |   44 
 usr/lib/memmove.c                               |   34 
 usr/lib/memset.c                                |   30 
 usr/lib/memswap.c                               |   23 
 usr/lib/mmap.c                                  |   51 
 usr/lib/nice.c                                  |   22 
 usr/lib/onexit.c                                |   39 
 usr/lib/pause.c                                 |   21 
 usr/lib/perror.c                                |   12 
 usr/lib/printf.c                                |   19 
 usr/lib/pty.c                                   |   31 
 usr/lib/puts.c                                  |   13 
 usr/lib/qsort.c                                 |   42 
 usr/lib/raise.c                                 |   11 
 usr/lib/readdir.c                               |   66 
 usr/lib/realloc.c                               |   49 
 usr/lib/reboot.c                                |   15 
 usr/lib/recv.c                                  |   11 
 usr/lib/sbrk.c                                  |   23 
 usr/lib/seed48.c                                |   19 
 usr/lib/select.c                                |    9 
 usr/lib/send.c                                  |   11 
 usr/lib/setegid.c                               |   10 
 usr/lib/setenv.c                                |  124 
 usr/lib/seteuid.c                               |   10 
 usr/lib/setpgrp.c                               |   10 
 usr/lib/setresgid.c                             |   29 
 usr/lib/setresuid.c                             |   30 
 usr/lib/sha1hash.c                              |  317 +
 usr/lib/sigaction.c                             |   19 
 usr/lib/siglist.c                               |  115 
 usr/lib/siglongjmp.c                            |   16 
 usr/lib/signal.c                                |   11 
 usr/lib/sigpending.c                            |   19 
 usr/lib/sigprocmask.c                           |   19 
 usr/lib/sigsuspend.c                            |   19 
 usr/lib/sleep.c                                 |   20 
 usr/lib/snprintf.c                              |   16 
 usr/lib/socketcalls.pl                          |   67 
 usr/lib/socketcalls/socketcommon.h              |   25 
 usr/lib/sprintf.c                               |   18 
 usr/lib/srand48.c                               |   16 
 usr/lib/sscanf.c                                |   17 
 usr/lib/strcat.c                                |   11 
 usr/lib/strchr.c                                |   16 
 usr/lib/strcmp.c                                |   20 
 usr/lib/strcpy.c                                |   20 
 usr/lib/strdup.c                                |   17 
 usr/lib/strerror.c                              |   25 
 usr/lib/strlen.c                                |   14 
 usr/lib/strncat.c                               |   11 
 usr/lib/strncmp.c                               |   20 
 usr/lib/strncpy.c                               |   22 
 usr/lib/strntoimax.c                            |   13 
 usr/lib/strntoumax.c                            |   75 
 usr/lib/strrchr.c                               |   18 
 usr/lib/strsep.c                                |   21 
 usr/lib/strspn.c                                |   67 
 usr/lib/strstr.c                                |   10 
 usr/lib/strtoimax.c                             |    3 
 usr/lib/strtok.c                                |   16 
 usr/lib/strtol.c                                |    3 
 usr/lib/strtoll.c                               |    3 
 usr/lib/strtoul.c                               |    3 
 usr/lib/strtoull.c                              |    3 
 usr/lib/strtoumax.c                             |    3 
 usr/lib/strtox.c                                |   13 
 usr/lib/syscalls.pl                             |   78 
 usr/lib/syscalls/syscommon.h                    |   29 
 usr/lib/syslog.c                                |   68 
 usr/lib/tests/getenvtest.c                      |   26 
 usr/lib/tests/getopttest.c                      |   31 
 usr/lib/tests/hello.c                           |    7 
 usr/lib/tests/idtest.c                          |   14 
 usr/lib/tests/malloctest.c                      | 4145 ++++++++++++++++++++++++
 usr/lib/tests/memstrtest.c                      |   29 
 usr/lib/tests/microhello.c                      |    9 
 usr/lib/tests/minihello.c                       |    7 
 usr/lib/tests/minips.c                          |  452 ++
 usr/lib/tests/nfs_no_rpc.c                      |  538 +++
 usr/lib/tests/setjmptest.c                      |   36 
 usr/lib/tests/testrand48.c                      |   19 
 usr/lib/tests/testvsnp.c                        |  115 
 usr/lib/time.c                                  |   27 
 usr/lib/umount.c                                |   12 
 usr/lib/unsetenv.c                              |   40 
 usr/lib/usleep.c                                |   15 
 usr/lib/utime.c                                 |   30 
 usr/lib/vfprintf.c                              |   26 
 usr/lib/vprintf.c                               |   11 
 usr/lib/vsnprintf.c                             |  433 ++
 usr/lib/vsprintf.c                              |   11 
 usr/lib/vsscanf.c                               |  365 ++
 usr/lib/wait.c                                  |   12 
 usr/lib/wait3.c                                 |   12 
 usr/lib/waitpid.c                               |   12 
 usr/root/Makefile                               |    3 
 usr/root/hello.c                                |   13 
 364 files changed, 18288 insertions(+), 9 deletions(-)
author
#1 lore raw

PATCH 1/1 gen_init_cpio fixes for 2.5.64

Hi,

Here are two patches split out of the big klibc patch that fix some problems in the gen_init_cpio.c code. The first one allows files to be added to the cpio image and fixes a padding error, and the second one fixes some build problems with the cpio image (if there was an error, the build would not stop.)

Please pull from:
bk://kernel.bkbits.net/gregkh/linux/initramfs-2.5

I'll send the two patches as followups to this message to lkml for those who want to see them.

thanks,

greg k-h

 usr/Makefile        |   26 ++++++++++++---
 usr/gen_init_cpio.c |   90 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 4 deletions(-)

-----

[email protected], 2003-03-07 16:46:13-08:00, [email protected]
kbuild: handle any failures of the gen_init_cpio or initramfs image to stop the build.

This also shows how to add files to the initramfs build, but is commented out.

Patch originally done by Kai.

 usr/Makefile |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

------

[email protected], 2003-03-07 16:39:06-08:00, [email protected]
gen_init_cpio: Add the ability to add files to the cpio image.

Push file://home/greg/linux/BK/initramfs-2.5 -> file://home/greg/linux/BK/bleed-2.5

 usr/gen_init_cpio.c |   90 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+)

------

author
#2 lore raw

PATCH 1/1 gen_init_cpio fixes for 2.5.64

ChangeSet 1.1124, 2003/03/07 16:39:06-08:00, [email protected]

gen_init_cpio: Add the ability to add files to the cpio image.

 usr/gen_init_cpio.c |   90 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+)
usr/gen_init_cpio.c +90 -0
diff -Nru a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
@@ -5,10 +5,28 @@
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
+#include <fcntl.h>
 
 static unsigned int offset;
 static unsigned int ino = 721;
 
+static void push_string(const char *name)
+{
+	unsigned int name_len = strlen(name) + 1;
+
+	fputs(name, stdout);
+	putchar(0);
+	offset += name_len;
+}
+
+static void push_pad (void)
+{
+	while (offset & 3) {
+		putchar(0);
+		offset++;
+	}
+}
+
 static void push_rest(const char *name)
 {
 	unsigned int name_len = strlen(name) + 1;
@@ -118,6 +136,78 @@
 		0);			/* chksum */
 	push_hdr(s);
 	push_rest(name);
+}
+
+/* Not marked static to keep the compiler quiet, as no one uses this yet... */
+void cpio_mkfile(const char *filename, const char *location,
+			unsigned int mode, uid_t uid, gid_t gid)
+{
+	char s[256];
+	char *filebuf;
+	struct stat buf;
+	int file;
+	int retval;
+	int i;
+
+	mode |= S_IFREG;
+
+	retval = stat (filename, &buf);
+	if (retval) {
+		fprintf (stderr, "Filename %s could not be located\n", filename);
+		goto error;
+	}
+
+	file = open (filename, O_RDONLY);
+	if (file < 0) {
+		fprintf (stderr, "Filename %s could not be opened for reading\n", filename);
+		goto error;
+	}
+
+	filebuf = malloc(buf.st_size);
+	if (!filebuf) {
+		fprintf (stderr, "out of memory\n");
+		goto error_close;
+	}
+
+	retval = read (file, filebuf, buf.st_size);
+	if (retval < 0) {
+		fprintf (stderr, "Can not read %s file\n", filename);
+		goto error_free;
+	}
+
+	sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX"
+	       "%08X%08X%08X%08X%08X%08X%08X",
+		"070701",		/* magic */
+		ino++,			/* ino */
+		mode,			/* mode */
+		(long) uid,		/* uid */
+		(long) gid,		/* gid */
+		1,			/* nlink */
+		(long) buf.st_mtime,	/* mtime */
+		(int) buf.st_size,	/* filesize */
+		3,			/* major */
+		1,			/* minor */
+		0,			/* rmajor */
+		0,			/* rminor */
+		strlen(location) + 1,	/* namesize */
+		0);			/* chksum */
+	push_hdr(s);
+	push_string(location);
+	push_pad();
+
+	for (i = 0; i < buf.st_size; ++i)
+		fputc(filebuf[i], stdout);
+	close(file);
+	free(filebuf);
+	push_pad();
+	return;
+	
+error_free:
+	free(filebuf);
+error_close:
+	close(file);
+error:
+	exit(-1);
 }
 
 int main (int argc, char *argv[])
author
#3 lore raw

Re: [PATCH] gen_init_cpio fixes for 2.5.64

ChangeSet 1.1125, 2003/03/07 16:46:13-08:00, [email protected]

kbuild: handle any failures of the gen_init_cpio or initramfs image to stop the build.

This also shows how to add files to the initramfs build, but is commented out.

Patch originally done by Kai.

 usr/Makefile |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)
usr/Makefile +22 -4
diff -Nru a/usr/Makefile b/usr/Makefile
@@ -1,16 +1,34 @@
 
 obj-y := initramfs_data.o
 
-host-progs := gen_init_cpio
+host-progs  := gen_init_cpio
 
 clean-files := initramfs_data.cpio.gz
 
 LDFLAGS_initramfs_data.o := $(LDFLAGS_BLOB) -r -T
 
-$(obj)/initramfs_data.o: $(src)/initramfs_data.scr $(obj)/initramfs_data.cpio.gz FORCE
+$(obj)/initramfs_data.o: $(src)/initramfs_data.scr \
+			 $(obj)/initramfs_data.cpio.gz FORCE
 	$(call if_changed,ld)
 
-$(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio
-	./$< | gzip -9c > $@
+# initramfs-y are the programs which will be copied into the CPIO
+# archive. Currently, the filenames are hardcoded in gen_init_cpio,
+# but we need the information for the build as well, so it's duplicated
+# here.
 
+# Commented out for now
+# initramfs-y := $(obj)/root/hello
+
+quiet_cmd_cpio = CPIO    $@
+      cmd_cpio = ./$< > $@
+
+$(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio $(initramfs-y) FORCE
+	$(call if_changed,cpio)
+
+targets += $(obj)/initramfs_data.cpio
+
+$(obj)/initramfs_data.cpio.gz: $(obj)/initramfs_data.cpio FORCE
+	$(call if_changed,gzip)
+
+targets += $(obj)/initramfs_data.cpio.gz
 
#4 lore raw

Re: [PATCH] gen_init_cpio fixes for 2.5.64

In reply to Greg KH
Quoted 4 lines · Greg KH

ChangeSet 1.1124, 2003/03/07 16:39:06-08:00, [email protected]

gen_init_cpio: Add the ability to add files to the cpio image.

Have you been able to boot the kernel with a cpio-archive that contains files larger than a few k? The kernel crashes on me when writing to the file in ramfs.
It crashes i the third or forth flush_window or so..

--
Anders Gustafsson - [email protected] - http://0x63.nu/

author
#5 lore raw

Re: [PATCH] gen_init_cpio fixes for 2.5.64

Quoted 9 lines · Anders Gustafsson
Quoted 4 lines · Greg KH

ChangeSet 1.1124, 2003/03/07 16:39:06-08:00, [email protected]

gen_init_cpio: Add the ability to add files to the cpio image.

Have you been able to boot the kernel with a cpio-archive that contains files larger than a few k? The kernel crashes on me when writing to the file in ramfs.

I have not tried that, no.

Quoted 1 line

It crashes i the third or forth flush_window or so..

What does the oops show?

thanks,

greg k-h

#6 lore raw

Re: [PATCH] gen_init_cpio fixes for 2.5.64

Quoted 11 lines · Greg KH
Quoted 9 lines · Anders Gustafsson
Quoted 4 lines · Greg KH

ChangeSet 1.1124, 2003/03/07 16:39:06-08:00, [email protected]

gen_init_cpio: Add the ability to add files to the cpio image.

Have you been able to boot the kernel with a cpio-archive that contains files larger than a few k? The kernel crashes on me when writing to the file in ramfs.

Quoted 5 lines

I have not tried that, no.

Quoted 1 line

It crashes i the third or forth flush_window or so..

What does the oops show?

I don't have the possibility to capture it at the moment, I have no serialports on my laptop and no other computer I can test it on at hand at the moment.

But it's really easy to reproduce, just add a:

        cpio_mkfile("/bin/busybox","/bin/sh",0755,0,0);

or something similar in usr/gen_init_cpio.c

Signature · 1 line
Anders Gustafsson - [email protected] - http://0x63.nu/
#7 lore raw

PATCH 1/1 fix big initramfs (was: [PATCH] gen_init_cpio fixes for 2.5.64)

In reply to Greg KH
Quoted 11 lines · Greg KH
Quoted 9 lines · Anders Gustafsson
Quoted 4 lines · Greg KH

ChangeSet 1.1124, 2003/03/07 16:39:06-08:00, [email protected]

gen_init_cpio: Add the ability to add files to the cpio image.

Have you been able to boot the kernel with a cpio-archive that contains files larger than a few k? The kernel crashes on me when writing to the file in ramfs.

Quoted 5 lines

I have not tried that, no.

Quoted 1 line

It crashes i the third or forth flush_window or so..

What does the oops show?

The oops shows a crash in balance_dirty_pages. Or rather get_dirty_limits(), and in get_dirty_limits() we have:

    unmapped_ratio = 100 - (ps->nr_mapped * 100) / total_pages;

total_pages is initialized in page_writeback_init(), which is a init-call, called far later than populate_rootfs(). So, BOOM, division by zero.

Patch below makes the call to page_writeback_init() explicit in start_kernel, just before populate_rootfs().

Signature · 86 lines
Anders Gustafsson - [email protected] - http://0x63.nu/

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[email protected], 2003-03-12 09:14:47+01:00, [email protected]
  Explicitly call page_writeback_init because it must be called before populate_rootfs()


 init/main.c         |    3 +++
 mm/page-writeback.c |    4 +---
 2 files changed, 4 insertions(+), 3 deletions(-)


diff -Nru a/init/main.c b/init/main.c
--- a/init/main.c	Wed Mar 12 09:16:57 2003
+++ b/init/main.c	Wed Mar 12 09:16:57 2003
@@ -70,6 +70,7 @@
 extern void pte_chain_init(void);
 extern void radix_tree_init(void);
 extern void free_initmem(void);
+extern void page_writeback_init(void);
 extern void populate_rootfs(void);
 extern void driver_init(void);
 
@@ -429,6 +430,8 @@
 	vfs_caches_init(num_physpages);
 	radix_tree_init();
 	signals_init();
+	/* rootfs populating might need page-writeback */
+	page_writeback_init();
 	populate_rootfs();
 #ifdef CONFIG_PROC_FS
 	proc_root_init();
diff -Nru a/mm/page-writeback.c b/mm/page-writeback.c
--- a/mm/page-writeback.c	Wed Mar 12 09:16:57 2003
+++ b/mm/page-writeback.c	Wed Mar 12 09:16:57 2003
@@ -369,7 +369,7 @@
  * dirty memory thresholds: allowing too much dirty highmem pins an excessive
  * number of buffer_heads.
  */
-static int __init page_writeback_init(void)
+void __init page_writeback_init(void)
 {
 	long buffer_pages = nr_free_buffer_pages();
 	long correction;
@@ -392,9 +392,7 @@
 	add_timer(&wb_timer);
 	set_ratelimit();
 	register_cpu_notifier(&ratelimit_nb);
-	return 0;
 }
-module_init(page_writeback_init);
 
 int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {

===================================================================


This BitKeeper patch contains the following changesets:
1.1102
## Wrapped with gzip_uu ##


begin 664 bkpatch17604
M'XL(`/GL;CX``]656V^;,!B&K^-?\4F]Z4$!&QMSF#)E:ZNMVJ15F7HU39$#
M#D$<!4Z:3OSX&6C2-DV[M>I-P<@'[$^OW^\!'\!5+2M_(/)05G6$#N!K42M_
M@-><&OE2]R=%H?MF*)0P0[DR$UGE,C5GB9G))$%ZQJ50P0)6>KT_(`;=CJB;
M4OJ#R?F7J^^?)@B-1G"Z$'DD?TH%HQ%21;42:5B/A5JD16ZH2N1U)I4P@B)K
MME,;"V-+WS9Q*+9Y0SAF3A.0D!#!B`RQQ5S.D$C*;!S&D2P>+Z>8$DL_E/"&
M<L?VT!D0@Q!L`::F+D0W/)\PGSDGF/@8PZT?XUL?X,2"(4:?X6U%GZ(`SM=E
M&@>Q2F\@$&D*I8CD]+J*E9R)()G&>:Q@)@.QK"7H9K:LVWXW5X:Z-2\J"651
M+E.AY+32V9K7AT?H&U#;)AQ=WIF.AB^\$,("HX_0>?LG+ML]&F+99)G9JAQN
M51I!OV%&NSW;M+$=CSH-G<\(<QQNN=P+YTSLVOI4I#YA+L'$:3CU2"OB>>=;
MF\Q,Q/E&2N^]1[V&V0[FC73U"'-#X<Z]4#^/I.Q$>"`!Z^QU`._1VZ+\9@;M
M8/QKL^G?SSB%/4PMB[%&*\:T0]MV'X*-??(DV`2&]'V!W1/Q`X;5=5<TJ)?[
M,O,*WL^H8P%!%WVU*N(0IKW2/>H/V_='>HUGZ\FZ<G354G(/I7__Z%Y,+LJ*
M8"'3<5&'J5%4T1YR,2.<4$8;YG%F=4AX[/^1H._N7]=_H3M(W//E%2A<=`C(
MM=+G'70D/(G`!W3!*`$+#<QCZ%5M5,9Y!%D<+13D4O8A[A"%8Q,-]D75$;>G
7J,YUD-3+;,0QGU&.!?H+R/-63[0'````
`
end
#8 lore raw

Re: [PATCH] fix big initramfs (was: [PATCH] gen_init_cpio fixes for 2.5.64)

Quoted 4 lines · Anders Gustafsson

Patch below makes the call to page_writeback_init() explicit in start_kernel, just before populate_rootfs().

Fair enough.

Quoted 1 line

+extern void page_writeback_init(void);

But please don't put declarations of external functions into .c. It is always the wrong thing to do, even though others have done it...

writeback.h is a fine place for this declaration.

#9 lore raw

Re: [PATCH] fix big initramfs (was: [PATCH] gen_init_cpio fixes for 2.5.64)

Quoted 5 lines · Andrew Morton
Quoted 3 lines

Patch below makes the call to page_writeback_init() explicit in start_kernel, just before populate_rootfs().

Fair enough.

Sending to Linus too then.

Quoted 6 lines
Quoted 1 line

+extern void page_writeback_init(void);

But please don't put declarations of external functions into .c. It is always the wrong thing to do, even though others have done it...

writeback.h is a fine place for this declaration.

Allright, I did that first, but then I saw the other declarations, and wanted to follow the style. Revised patch below.

Signature · 101 lines
Anders Gustafsson - [email protected] - http://0x63.nu/

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[email protected], 2003-03-12 10:01:46+01:00, [email protected]
  Explicitly call page_writeback_init because it must be called before populate_
  rootfs()


 include/linux/writeback.h |    1 +
 init/main.c               |    3 +++
 mm/page-writeback.c       |    4 +---
 3 files changed, 5 insertions(+), 3 deletions(-)


diff -Nru a/include/linux/writeback.h b/include/linux/writeback.h
--- a/include/linux/writeback.h	Wed Mar 12 10:09:13 2003
+++ b/include/linux/writeback.h	Wed Mar 12 10:09:13 2003
@@ -79,6 +79,7 @@
 extern int dirty_expire_centisecs;
 
 
+void page_writeback_init(void);
 void balance_dirty_pages(struct address_space *mapping);
 void balance_dirty_pages_ratelimited(struct address_space *mapping);
 int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
diff -Nru a/init/main.c b/init/main.c
--- a/init/main.c	Wed Mar 12 10:09:13 2003
+++ b/init/main.c	Wed Mar 12 10:09:13 2003
@@ -35,6 +35,7 @@
 #include <linux/profile.h>
 #include <linux/rcupdate.h>
 #include <linux/moduleparam.h>
+#include <linux/writeback.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -429,6 +430,8 @@
 	vfs_caches_init(num_physpages);
 	radix_tree_init();
 	signals_init();
+	/* rootfs populating might need page-writeback */
+	page_writeback_init();
 	populate_rootfs();
 #ifdef CONFIG_PROC_FS
 	proc_root_init();
diff -Nru a/mm/page-writeback.c b/mm/page-writeback.c
--- a/mm/page-writeback.c	Wed Mar 12 10:09:13 2003
+++ b/mm/page-writeback.c	Wed Mar 12 10:09:13 2003
@@ -369,7 +369,7 @@
  * dirty memory thresholds: allowing too much dirty highmem pins an excessive
  * number of buffer_heads.
  */
-static int __init page_writeback_init(void)
+void __init page_writeback_init(void)
 {
 	long buffer_pages = nr_free_buffer_pages();
 	long correction;
@@ -392,9 +392,7 @@
 	add_timer(&wb_timer);
 	set_ratelimit();
 	register_cpu_notifier(&ratelimit_nb);
-	return 0;
 }
-module_init(page_writeback_init);
 
 int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {

===================================================================


This BitKeeper patch contains the following changesets:
1.1102
## Wrapped with gzip_uu ##


begin 664 bkpatch18281
M'XL(`#GY;CX``]566V_:,!A]QK_"4E]Z$8D_VW$2-BJVMMJJ35K5J4_3A$QB
M("(7E`NE4W[\G`1H!Z%=45\*"8X3^]/Q\3DG'.&[3*6]CHQ]E683=(2_)EG>
MZY"E8$9<Z/YMDNB^Z<M<FKY:F#.5QBHT1S,S4K,9TB-N9.Y-\4+/[W7`8)L[
M^<-<]3JW5U_NOG^Z1:C?QQ=3&4_43Y7C?A_E2;J0H9\-9#X-D]C(4QEGD<JE
MX251N1E:4D*H_EI@,V*)$@3A=NF!#R`Y*)]0[@B.Y&P>#?Q@HI+=Z8PPH/ID
M($HF;,M%EQ@,`$(Q8:8^@&(@/0(]+L[T+R%XQ<=@Q0,^8[A+T&?\MJ`OD(>O
MEO,P\((\?,">#$,\EQ,UO$^#7(VD-QL&<9#CD?)DD2FL+Z,BJ_KU6.7KJW&2
M*CQ/YD4H<S74!5.]8>/L^`1]PXQS8:&;1]Y1]Y4?A(@DZ!S7]/X)YM4R#5F4
M46160+L;H(;7K)FS>MD6*RW;97;)QB/@MBVH(UQ_S.4VL_LJ-7OF$F!N*9@+
M;2""V`L+7YEA$!=+\['`=!L*H0"TM,;"&7'N@:.8E&-K!\JS]9X"HL+FC@;T
MO!JJK3,C&<1K;AH]N+H`MVPB2N7H.]SQI3-V?7VV`/JGPE,(EN,*4IMJ+^K*
M9&],V9;-?JT)^/U"8:!@:?`.\)(RF[#:@)1LVX^Y^^P'[]%^C4Q^X&YZ7Q_:
M3C?[M^L`;UX[@`$MDL!OPWU</3CY4(NDQ65M\CC8UON%L=_?6LF,4LY+K8R5
M)"SG59)@[TX2391M2:*%H@/$<,EL31JZ;II:%,,&[%YMZ#FNI0?KQM9-DR:;
MR'GY)?WJA$-1XDU5.$@R/S22=-*2<(2#`,99R5W!::T*E_^_*M[E>[H)\YV@
MV%!S2#2P:D>/5FF#/^[$S3FZY@PP11WS=(5E#2^()S@*)M,<QTHUT?*H37QJ
@HDZ;HJJD6?_UTYOLS;(BZEN>[9.1#>@OWSU4;VD*````
`
end