summaryrefslogtreecommitdiff
path: root/i/pc104/initrd
diff options
context:
space:
mode:
authorjutteau2007-05-11 18:10:19 +0000
committerjutteau2007-05-11 18:10:19 +0000
commit5e1a84ab74d5e97582427f016f291a8c11e66f99 (patch)
treeddae3f36a21e7fa7c97145f4a49edcfe50063aa3 /i/pc104/initrd
parentb95709754c870cbb793266ce8e605a81d01a4f75 (diff)
Completion du script de mise à jour de la pc-104 :
* Ajout des sources de busybox dans ./conf/busybox/ * Ajout d'un fichier réclamé par les script dans ./conf/busybox.links
Diffstat (limited to 'i/pc104/initrd')
-rw-r--r--i/pc104/initrd/conf/busybox.links18
-rw-r--r--i/pc104/initrd/conf/busybox/AUTHORS173
-rw-r--r--i/pc104/initrd/conf/busybox/Config.in496
-rw-r--r--i/pc104/initrd/conf/busybox/INSTALL125
-rw-r--r--i/pc104/initrd/conf/busybox/LICENSE348
-rw-r--r--i/pc104/initrd/conf/busybox/Makefile1280
-rw-r--r--i/pc104/initrd/conf/busybox/Makefile.custom145
-rw-r--r--i/pc104/initrd/conf/busybox/Makefile.flags61
-rw-r--r--i/pc104/initrd/conf/busybox/Makefile.help42
-rw-r--r--i/pc104/initrd/conf/busybox/README198
-rw-r--r--i/pc104/initrd/conf/busybox/TODO320
-rw-r--r--i/pc104/initrd/conf/busybox/applets/Kbuild22
-rw-r--r--i/pc104/initrd/conf/busybox/applets/applets.c495
-rw-r--r--i/pc104/initrd/conf/busybox/applets/busybox.c147
-rwxr-xr-xi/pc104/initrd/conf/busybox/applets/busybox.mkll24
-rw-r--r--i/pc104/initrd/conf/busybox/applets/individual.c27
-rwxr-xr-xi/pc104/initrd/conf/busybox/applets/install.sh94
-rw-r--r--i/pc104/initrd/conf/busybox/applets/usage.c17
-rwxr-xr-xi/pc104/initrd/conf/busybox/applets/usage_compressed19
-rw-r--r--i/pc104/initrd/conf/busybox/arch/i386/Makefile5
-rw-r--r--i/pc104/initrd/conf/busybox/archival/Config.in300
-rw-r--r--i/pc104/initrd/conf/busybox/archival/Kbuild22
-rw-r--r--i/pc104/initrd/conf/busybox/archival/ar.c94
-rw-r--r--i/pc104/initrd/conf/busybox/archival/bbunzip.c355
-rw-r--r--i/pc104/initrd/conf/busybox/archival/cpio.c87
-rw-r--r--i/pc104/initrd/conf/busybox/archival/dpkg.c1754
-rw-r--r--i/pc104/initrd/conf/busybox/archival/dpkg_deb.c97
-rw-r--r--i/pc104/initrd/conf/busybox/archival/gzip.c2085
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/Kbuild59
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/archive_xread_all_eof.c20
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/check_header_gzip.c59
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/data_align.c17
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_all.c127
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_buffer.c17
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_stdout.c13
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/data_skip.c16
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_bunzip2.c731
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_uncompress.c308
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_unlzma.c497
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_unzip.c1104
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/filter_accept_all.c17
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/filter_accept_list.c19
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/filter_accept_list_reassign.c44
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/filter_accept_reject_list.c33
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/find_list_entry.c54
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/get_header_ar.c126
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/get_header_cpio.c160
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/get_header_tar.c284
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/get_header_tar_bz2.c20
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/get_header_tar_gz.c31
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/get_header_tar_lzma.c22
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/header_list.c11
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/header_skip.c10
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/header_verbose_list.c31
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/init_handle.c22
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/open_transformer.c44
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/seek_by_jump.c24
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/seek_by_read.c18
-rw-r--r--i/pc104/initrd/conf/busybox/archival/libunarchive/unpack_ar_archive.c22
-rw-r--r--i/pc104/initrd/conf/busybox/archival/rpm.c367
-rw-r--r--i/pc104/initrd/conf/busybox/archival/rpm2cpio.c90
-rw-r--r--i/pc104/initrd/conf/busybox/archival/tar.c939
-rw-r--r--i/pc104/initrd/conf/busybox/archival/unzip.c376
-rwxr-xr-xi/pc104/initrd/conf/busybox/busyboxbin0 -> 573272 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/busybox.links18
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/Config.in105
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/Kbuild19
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/chvt.c34
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/clear.c22
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/deallocvt.c38
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/dumpkmap.c66
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/loadfont.c194
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/loadkmap.c62
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/openvt.c43
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/reset.c33
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/resize.c70
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/setconsole.c48
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/setkeycodes.c50
-rw-r--r--i/pc104/initrd/conf/busybox/console-tools/setlogcons.c32
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/Config.in782
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/Kbuild85
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/basename.c51
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/cal.c352
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/cat.c43
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/catv.c70
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/chgrp.c28
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/chmod.c159
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/chown.c167
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/chroot.c38
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/cksum.c54
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/cmp.c145
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/comm.c127
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/cp.c100
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/cut.c287
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/date.c241
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/dd.c249
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/df.c155
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/diff.c1227
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/dirname.c27
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/dos2unix.c116
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/du.c247
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/echo.c159
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/env.c128
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/expr.c506
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/false.c20
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/fold.c155
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/head.c140
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/hostid.c26
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/id.c130
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/install.c202
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/length.c20
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/libcoreutils/Kbuild12
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/libcoreutils/coreutils.h16
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/libcoreutils/cp_mv_stat.c43
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/libcoreutils/getopt_mk_fifo_nod.c51
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/ln.c105
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/logname.c43
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/ls.c957
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/md5_sha1_sum.c185
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/mkdir.c82
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/mkfifo.c39
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/mknod.c51
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/mv.c137
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/nice.c55
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/nohup.c60
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/od.c225
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/od_bloaty.c1465
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/printenv.c42
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/printf.c313
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/pwd.c26
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/realpath.c47
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/rm.c53
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/rmdir.c61
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/seq.c41
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/sleep.c68
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/sort.c401
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/stat.c676
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/stty.c1189
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/sum.c100
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/sync.c24
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/tail.c278
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/tee.c101
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/test.c586
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/touch.c62
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/tr.c254
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/true.c20
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/tty.c44
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/uname.c108
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/uniq.c104
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/usleep.c29
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/uudecode.c181
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/uuencode.c76
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/watch.c80
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/wc.c205
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/who.c76
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/whoami.c26
-rw-r--r--i/pc104/initrd/conf/busybox/coreutils/yes.c42
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/Config.in88
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/Kbuild13
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/mktemp.c49
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/pipe_progress.c43
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/readlink.c52
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/run_parts.c192
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/start_stop_daemon.c330
-rw-r--r--i/pc104/initrd/conf/busybox/debianutils/which.c48
-rwxr-xr-xi/pc104/initrd/conf/busybox/docs/autodocifier.pl303
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/FAQ.html1108
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/about.html24
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/busybox-growth.ps404
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/copyright.txt30
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/developer.html69
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/download.html29
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/footer.html47
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/header.html96
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/back.pngbin0 -> 322 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/busybox.jpegbin0 -> 9023 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/busybox.pngbin0 -> 34014 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/busybox1.pngbin0 -> 10913 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/busybox2.jpgbin0 -> 8204 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/busybox3.jpgbin0 -> 3292 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/dir.pngbin0 -> 309 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/donate.pngbin0 -> 807 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/fm.mini.pngbin0 -> 7708 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/gfx_by_gimp.pngbin0 -> 3955 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/ltbutton2.pngbin0 -> 6798 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/osuosl.pngbin0 -> 8683 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/sdsmall.pngbin0 -> 1593 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/text.pngbin0 -> 307 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/valid-html401.pngbin0 -> 1950 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/vh40.gifbin0 -> 906 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/images/written.in.vi.pngbin0 -> 4394 bytes
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/index.html1
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/license.html97
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/links.html19
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/lists.html46
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/news.html252
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/oldnews.html1140
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/products.html170
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/screenshot.html62
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/shame.html82
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/sponsors.html35
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/subversion.html52
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox.net/tinyutils.html86
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox_footer.pod258
-rw-r--r--i/pc104/initrd/conf/busybox/docs/busybox_header.pod82
-rw-r--r--i/pc104/initrd/conf/busybox/docs/cgi/cl.html46
-rw-r--r--i/pc104/initrd/conf/busybox/docs/cgi/env.html149
-rw-r--r--i/pc104/initrd/conf/busybox/docs/cgi/in.html33
-rw-r--r--i/pc104/initrd/conf/busybox/docs/cgi/interface.html29
-rw-r--r--i/pc104/initrd/conf/busybox/docs/cgi/out.html126
-rw-r--r--i/pc104/initrd/conf/busybox/docs/contributing.txt449
-rw-r--r--i/pc104/initrd/conf/busybox/docs/draft-coar-cgi-v11-03-clean.html2674
-rw-r--r--i/pc104/initrd/conf/busybox/docs/ipv4_ipv6.txt223
-rw-r--r--i/pc104/initrd/conf/busybox/docs/keep_data_small.txt206
-rw-r--r--i/pc104/initrd/conf/busybox/docs/mdev.txt68
-rw-r--r--i/pc104/initrd/conf/busybox/docs/new-applet-HOWTO.txt151
-rw-r--r--i/pc104/initrd/conf/busybox/docs/sigint.htm627
-rw-r--r--i/pc104/initrd/conf/busybox/docs/style-guide.txt689
-rw-r--r--i/pc104/initrd/conf/busybox/docs/tar_pax.txt239
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/Config.in67
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/Kbuild12
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/README12
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/chattr.c190
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/e2fs_defs.h561
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/e2fs_lib.c197
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/e2fs_lib.h30
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/fsck.c1243
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/lsattr.c115
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/Config.in67
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/Kbuild16
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/README3
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/Kbuild23
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/blkid.h105
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/blkidP.h187
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/blkid_getsize.c179
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/cache.c126
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/dev.c214
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/devname.c367
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/devno.c222
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/list.c110
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/list.h73
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/probe.c721
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/probe.h375
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/read.c461
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/resolve.c139
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/save.c189
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/blkid/tag.c432
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/chattr.c220
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2fsbb.h43
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2fsck.c13548
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2fsck.h640
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/Kbuild15
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/e2p.h64
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/feature.c187
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/fgetsetflags.c70
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/fgetsetversion.c70
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/hashstr.c70
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/iod.c52
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/ls.c273
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/mntopts.c134
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/ostype.c74
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/parse_num.c65
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/pe.c32
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/pf.c74
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/ps.c27
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/e2p/uuid.c78
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/Kbuild23
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c174
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/alloc_sb.c58
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/alloc_stats.c53
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/alloc_tables.c118
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/badblocks.c328
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/bb_compat.c64
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/bb_inode.c268
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/bitmaps.c211
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/bitops.c91
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/bitops.h107
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/block.c438
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c264
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/bmove.c156
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/brel.h87
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/brel_ma.c196
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/check_desc.c69
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c381
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/cmp_bitmaps.c73
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dblist.c260
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dblist_dir.c76
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dir_iterate.c220
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c133
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dirhash.c234
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/dupfs.c97
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/e2image.h52
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/expanddir.c127
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_err.h116
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_ext_attr.h53
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_fs.h570
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_io.h114
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2_types.h2
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h923
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2fsP.h89
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs_inline.c367
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ext_attr.c101
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/fileio.c377
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/finddev.c199
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/flushb.c83
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/freefs.c128
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/gen_bitmap.c49
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/get_pathname.c157
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/getsectsize.c58
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/getsize.c291
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/icount.c467
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/imager.c377
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ind_block.c71
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/initialize.c388
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/inline.c33
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/inode.c767
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/inode_io.c271
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/io_manager.c70
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/irel.h115
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/irel_ma.c367
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/ismounted.c357
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/jfs_dat.h65
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/kernel-jbd.h236
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/kernel-list.h113
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/link.c135
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/lookup.c70
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c142
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c428
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/namei.c205
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/newdir.c73
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/openfs.c330
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/read_bb.c98
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/read_bb_file.c98
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/res_gdt.c221
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/rs_bitmap.c107
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c296
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/sparse.c79
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/swapfs.c236
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/test_io.c380
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/unix_io.c703
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/unlink.c100
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/valid_blk.c57
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/version.c51
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/ext2fs/write_bb_file.c35
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/fsck.c1392
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/fsck.h16
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/lsattr.c129
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/mke2fs.c1336
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/tune2fs.c729
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/util.c267
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/util.h22
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/Kbuild14
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/compare.c55
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/gen_uuid.c304
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/pack.c69
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/parse.c80
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/unpack.c63
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/unparse.c77
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/uuid.h104
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/uuidP.h60
-rw-r--r--i/pc104/initrd/conf/busybox/e2fsprogs/old_e2fsprogs/uuid/uuid_time.c161
-rw-r--r--i/pc104/initrd/conf/busybox/editors/Config.in138
-rw-r--r--i/pc104/initrd/conf/busybox/editors/Kbuild12
-rw-r--r--i/pc104/initrd/conf/busybox/editors/awk.c2781
-rw-r--r--i/pc104/initrd/conf/busybox/editors/ed.c1232
-rw-r--r--i/pc104/initrd/conf/busybox/editors/patch.c278
-rw-r--r--i/pc104/initrd/conf/busybox/editors/sed.c1347
-rw-r--r--i/pc104/initrd/conf/busybox/editors/vi.c3999
-rw-r--r--i/pc104/initrd/conf/busybox/examples/bootfloppy/bootfloppy.txt180
-rw-r--r--i/pc104/initrd/conf/busybox/examples/bootfloppy/display.txt4
-rw-r--r--i/pc104/initrd/conf/busybox/examples/bootfloppy/etc/fstab2
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/bootfloppy/etc/init.d/rcS3
-rw-r--r--i/pc104/initrd/conf/busybox/examples/bootfloppy/etc/inittab5
-rw-r--r--i/pc104/initrd/conf/busybox/examples/bootfloppy/etc/profile8
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/bootfloppy/mkdevs.sh62
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/bootfloppy/mkrootfs.sh105
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/bootfloppy/mksyslinux.sh48
-rw-r--r--i/pc104/initrd/conf/busybox/examples/bootfloppy/quickstart.txt15
-rw-r--r--i/pc104/initrd/conf/busybox/examples/bootfloppy/syslinux.cfg7
-rw-r--r--i/pc104/initrd/conf/busybox/examples/busybox.spec44
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/depmod.pl289
-rw-r--r--i/pc104/initrd/conf/busybox/examples/devfsd.conf133
-rw-r--r--i/pc104/initrd/conf/busybox/examples/dnsd.conf1
-rw-r--r--i/pc104/initrd/conf/busybox/examples/inetd.conf73
-rw-r--r--i/pc104/initrd/conf/busybox/examples/inittab90
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/mk2knr.pl84
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/udhcp/sample.bound31
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/udhcp/sample.deconfig4
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/udhcp/sample.nak4
-rwxr-xr-xi/pc104/initrd/conf/busybox/examples/udhcp/sample.renew31
-rw-r--r--i/pc104/initrd/conf/busybox/examples/udhcp/sample.script7
-rw-r--r--i/pc104/initrd/conf/busybox/examples/udhcp/simple.script40
-rw-r--r--i/pc104/initrd/conf/busybox/examples/udhcp/udhcpd.conf123
-rw-r--r--i/pc104/initrd/conf/busybox/examples/undeb53
-rw-r--r--i/pc104/initrd/conf/busybox/examples/unrpm48
-rw-r--r--i/pc104/initrd/conf/busybox/examples/zcip.script38
-rw-r--r--i/pc104/initrd/conf/busybox/findutils/Config.in175
-rw-r--r--i/pc104/initrd/conf/busybox/findutils/Kbuild10
-rw-r--r--i/pc104/initrd/conf/busybox/findutils/find.c645
-rw-r--r--i/pc104/initrd/conf/busybox/findutils/grep.c507
-rw-r--r--i/pc104/initrd/conf/busybox/findutils/xargs.c540
-rw-r--r--i/pc104/initrd/conf/busybox/include/applets.h341
-rw-r--r--i/pc104/initrd/conf/busybox/include/busybox.h39
-rw-r--r--i/pc104/initrd/conf/busybox/include/dump.h50
-rw-r--r--i/pc104/initrd/conf/busybox/include/grp_.h133
-rw-r--r--i/pc104/initrd/conf/busybox/include/inet_common.h25
-rw-r--r--i/pc104/initrd/conf/busybox/include/libbb.h902
-rw-r--r--i/pc104/initrd/conf/busybox/include/platform.h311
-rw-r--r--i/pc104/initrd/conf/busybox/include/pwd_.h122
-rw-r--r--i/pc104/initrd/conf/busybox/include/shadow_.h114
-rw-r--r--i/pc104/initrd/conf/busybox/include/unarchive.h118
-rw-r--r--i/pc104/initrd/conf/busybox/include/usage.h3688
-rw-r--r--i/pc104/initrd/conf/busybox/include/xatonum.h157
-rw-r--r--i/pc104/initrd/conf/busybox/include/xregex.h18
-rw-r--r--i/pc104/initrd/conf/busybox/init/Config.in89
-rw-r--r--i/pc104/initrd/conf/busybox/init/Kbuild10
-rw-r--r--i/pc104/initrd/conf/busybox/init/halt.c59
-rw-r--r--i/pc104/initrd/conf/busybox/init/init.c1043
-rw-r--r--i/pc104/initrd/conf/busybox/init/mesg.c46
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/Config.in88
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/Kbuild120
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/README11
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/ask_confirmation.c36
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/bb_askpass.c75
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/bb_do_delay.c24
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/bb_pwd.c129
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/bb_strtonum.c156
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/change_identity.c51
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/chomp.c19
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/compare_string_array.c37
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/concat_path_file.c27
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/concat_subpath_file.c23
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/copy_file.c343
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/copyfd.c106
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/correct_password.c69
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/crc32.c39
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/create_icmp6_socket.c37
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/create_icmp_socket.c35
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/default_error_retval.c19
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/device_open.c30
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/dump.c805
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/error_msg.c23
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/error_msg_and_die.c33
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/execable.c71
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/fclose_nonstdin.c23
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/fflush_stdout_and_exit.c21
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/fgets_str.c53
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/find_mount_point.c53
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/find_pid_by_name.c55
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/find_root_device.c34
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/full_write.c36
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/get_console.c72
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/get_last_path_component.c32
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/get_line_from_file.c69
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/getopt32.c531
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/herror_msg.c22
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/herror_msg_and_die.c23
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/human_readable.c89
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/inet_common.c235
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/info_msg.c23
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/inode_hash.c90
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/isdirectory.c39
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/kernel_version.c37
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/last_char_is.c24
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/lineedit.c1801
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/llist.c108
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/login.c105
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/loop.c149
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/make_directory.c104
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/makedev.c23
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/md5.c450
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/messages.c61
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/mode_string.c128
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/mtab.c52
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/mtab_file.c17
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/obscure.c170
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/parse_mode.c148
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/perror_msg.c23
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/perror_msg_and_die.c24
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/perror_nomsg.c21
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/perror_nomsg_and_die.c21
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/process_escape_sequence.c89
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/procps.c249
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/pw_encrypt.c29
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/read.c137
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/recursive_action.c126
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/remove_file.c111
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/restricted_shell.c46
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/run_shell.c101
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/safe_strncpy.c21
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/safe_write.c26
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/selinux_common.c40
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/setup_environment.c83
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/sha1.c178
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/simplify_path.c50
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/skip_whitespace.c25
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/speed_table.c117
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/trim.c31
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/u_signal_names.c57
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/uuencode.c63
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/vdprintf.c21
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/verror_msg.c46
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/vfork_daemon_rexec.c63
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/vherror_msg.c15
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/vinfo_msg.c26
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/vperror_msg.c15
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/warn_ignoring_args.c17
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/wfopen.c20
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/wfopen_input.c31
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xatonum.c70
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xatonum_template.c185
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xconnect.c330
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xfuncs.c616
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xgetcwd.c44
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xgethostbyname.c19
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xreadlink.c48
-rw-r--r--i/pc104/initrd/conf/busybox/libbb/xregcomp.c32
-rw-r--r--i/pc104/initrd/conf/busybox/libpwdgrp/Kbuild7
-rw-r--r--i/pc104/initrd/conf/busybox/libpwdgrp/pwd_grp.c997
-rw-r--r--i/pc104/initrd/conf/busybox/libpwdgrp/pwd_grp_internal.c62
-rw-r--r--i/pc104/initrd/conf/busybox/libpwdgrp/uidgid_get.c133
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/Config.in193
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/Kbuild17
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/addgroup.c111
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/adduser.c196
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/deluser.c83
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/getty.c856
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/login.c403
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/passwd.c347
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/su.c103
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/sulogin.c126
-rw-r--r--i/pc104/initrd/conf/busybox/loginutils/vlock.c119
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/Config.in387
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/Kbuild31
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/adjtimex.c118
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/bbconfig.c12
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/chrt.c124
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/crond.c1017
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/crontab.c343
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/dc.c232
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/devfsd.c2030
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/eject.c61
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/hdparm.c2048
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/last.c92
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/less.c1296
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/makedevs.c232
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/mountpoint.c66
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/mt.c121
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/nmeter.c849
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/raidautorun.c27
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/readahead.c35
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/runlevel.c43
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/rx.c290
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/setsid.c42
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/strings.c89
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/taskset.c99
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/time.c474
-rw-r--r--i/pc104/initrd/conf/busybox/miscutils/watchdog.c66
-rw-r--r--i/pc104/initrd/conf/busybox/modutils/Config.in158
-rw-r--r--i/pc104/initrd/conf/busybox/modutils/Kbuild11
-rw-r--r--i/pc104/initrd/conf/busybox/modutils/insmod.c4315
-rw-r--r--i/pc104/initrd/conf/busybox/modutils/lsmod.c192
-rw-r--r--i/pc104/initrd/conf/busybox/modutils/modprobe.c896
-rw-r--r--i/pc104/initrd/conf/busybox/modutils/rmmod.c97
-rw-r--r--i/pc104/initrd/conf/busybox/networking/Config.in719
-rw-r--r--i/pc104/initrd/conf/busybox/networking/Kbuild40
-rw-r--r--i/pc104/initrd/conf/busybox/networking/arp.c496
-rw-r--r--i/pc104/initrd/conf/busybox/networking/arping.c417
-rw-r--r--i/pc104/initrd/conf/busybox/networking/dnsd.c426
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ether-wake.c284
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ftpgetput.c359
-rw-r--r--i/pc104/initrd/conf/busybox/networking/hostname.c101
-rw-r--r--i/pc104/initrd/conf/busybox/networking/httpd.c2049
-rw-r--r--i/pc104/initrd/conf/busybox/networking/httpd_index_cgi_example50
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ifconfig.c546
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ifupdown.c1273
-rw-r--r--i/pc104/initrd/conf/busybox/networking/inetd.c1791
-rw-r--r--i/pc104/initrd/conf/busybox/networking/interface.c1195
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ip.c50
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ipaddr.c26
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ipcalc.c195
-rw-r--r--i/pc104/initrd/conf/busybox/networking/iplink.c26
-rw-r--r--i/pc104/initrd/conf/busybox/networking/iproute.c26
-rw-r--r--i/pc104/initrd/conf/busybox/networking/iprule.c26
-rw-r--r--i/pc104/initrd/conf/busybox/networking/iptunnel.c26
-rw-r--r--i/pc104/initrd/conf/busybox/networking/isrv.c352
-rw-r--r--i/pc104/initrd/conf/busybox/networking/isrv.h33
-rw-r--r--i/pc104/initrd/conf/busybox/networking/isrv_identd.c144
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/Kbuild66
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ip_common.h35
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ip_parse_common_args.c79
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ipaddress.c824
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/iplink.c350
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/iproute.c878
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/iprule.c334
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/iptunnel.c547
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/libnetlink.c396
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/libnetlink.h43
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ll_addr.c85
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ll_map.c186
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ll_map.h13
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ll_proto.c121
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/ll_types.c117
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/rt_names.c365
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/rt_names.h28
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/rtm_map.c110
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/rtm_map.h11
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/utils.c330
-rw-r--r--i/pc104/initrd/conf/busybox/networking/libiproute/utils.h91
-rw-r--r--i/pc104/initrd/conf/busybox/networking/nameif.c171
-rw-r--r--i/pc104/initrd/conf/busybox/networking/nc.c197
-rw-r--r--i/pc104/initrd/conf/busybox/networking/netstat.c596
-rw-r--r--i/pc104/initrd/conf/busybox/networking/nslookup.c155
-rw-r--r--i/pc104/initrd/conf/busybox/networking/ping.c752
-rw-r--r--i/pc104/initrd/conf/busybox/networking/route.c697
-rw-r--r--i/pc104/initrd/conf/busybox/networking/telnet.c665
-rw-r--r--i/pc104/initrd/conf/busybox/networking/telnetd.c573
-rw-r--r--i/pc104/initrd/conf/busybox/networking/tftp.c518
-rw-r--r--i/pc104/initrd/conf/busybox/networking/traceroute.c1342
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/Config.in75
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/Kbuild19
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/arpping.c114
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/clientpacket.c224
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/clientsocket.c51
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/common.c61
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/common.h104
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/dhcpc.c509
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/dhcpc.h50
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/dhcpd.c223
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/dhcpd.h190
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/dhcprelay.c338
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/domain_codec.c205
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/dumpleases.c75
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/files.c426
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/leases.c145
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/options.c180
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/options.h44
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/packet.c211
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/pidfile.c60
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/script.c224
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/serverpacket.c261
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/signalpipe.c77
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/socket.c126
-rw-r--r--i/pc104/initrd/conf/busybox/networking/udhcp/static_leases.c99
-rw-r--r--i/pc104/initrd/conf/busybox/networking/vconfig.c165
-rw-r--r--i/pc104/initrd/conf/busybox/networking/wget.c808
-rw-r--r--i/pc104/initrd/conf/busybox/networking/zcip.c548
-rw-r--r--i/pc104/initrd/conf/busybox/procps/Config.in121
-rw-r--r--i/pc104/initrd/conf/busybox/procps/Kbuild16
-rw-r--r--i/pc104/initrd/conf/busybox/procps/free.c69
-rw-r--r--i/pc104/initrd/conf/busybox/procps/fuser.c368
-rw-r--r--i/pc104/initrd/conf/busybox/procps/kill.c156
-rw-r--r--i/pc104/initrd/conf/busybox/procps/pidof.c91
-rw-r--r--i/pc104/initrd/conf/busybox/procps/ps.c388
-rw-r--r--i/pc104/initrd/conf/busybox/procps/ps.posix175
-rw-r--r--i/pc104/initrd/conf/busybox/procps/renice.c127
-rw-r--r--i/pc104/initrd/conf/busybox/procps/sysctl.c327
-rw-r--r--i/pc104/initrd/conf/busybox/procps/top.c570
-rw-r--r--i/pc104/initrd/conf/busybox/procps/uptime.c60
-rw-r--r--i/pc104/initrd/conf/busybox/runit/Config.in66
-rw-r--r--i/pc104/initrd/conf/busybox/runit/Kbuild17
-rw-r--r--i/pc104/initrd/conf/busybox/runit/chpst.c374
-rw-r--r--i/pc104/initrd/conf/busybox/runit/runit_lib.c500
-rw-r--r--i/pc104/initrd/conf/busybox/runit/runit_lib.h160
-rw-r--r--i/pc104/initrd/conf/busybox/runit/runsv.c633
-rw-r--r--i/pc104/initrd/conf/busybox/runit/runsvdir.c334
-rw-r--r--i/pc104/initrd/conf/busybox/runit/sv.c590
-rw-r--r--i/pc104/initrd/conf/busybox/runit/svlogd.c960
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/Kbuild7
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/Kbuild.include154
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/Makefile.IMA134
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/Makefile.build338
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/Makefile.clean102
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/Makefile.host156
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/Makefile.lib165
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/basic/Makefile18
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/basic/docproc.c398
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/basic/fixdep.c404
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/basic/split-include.c226
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/bloat-o-meter65
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/checkhelp.awk40
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/defconfig691
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/gcc-version.sh12
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/individual129
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/Makefile254
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/POTFILES.in5
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/conf.c612
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/confdata.c571
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/expr.c1099
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/expr.h194
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/gconf.c1645
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/gconf.glade648
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/images.c326
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/kconfig_load.c35
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/kxgettext.c227
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lex.zconf.c_shipped2317
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lkc.h147
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lkc_proto.h41
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/BIG.FAT.WARNING4
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/Makefile21
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/check-lxdialog.sh84
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/checklist.c333
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/colors.h154
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/dialog.h177
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/inputbox.c224
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/lxdialog.c204
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/menubox.c426
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/msgbox.c71
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/textbox.c533
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/util.c362
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/lxdialog/yesno.c102
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/mconf.c1098
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/menu.c397
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/qconf.cc1426
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/qconf.h263
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/symbol.c882
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/util.c109
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/zconf.gperf43
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/zconf.hash.c_shipped231
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/zconf.l350
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/zconf.tab.c_shipped2173
-rw-r--r--i/pc104/initrd/conf/busybox/scripts/kconfig/zconf.y681
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/mkconfigs52
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/mkmakefile36
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/objsizes19
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/showasm21
-rwxr-xr-xi/pc104/initrd/conf/busybox/scripts/trylink18
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/Config.in75
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/Kbuild15
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/chcon.c175
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/getenforce.c34
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/getsebool.c66
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/matchpathcon.c86
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/runcon.c137
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/selinuxenabled.c14
-rw-r--r--i/pc104/initrd/conf/busybox/selinux/setenforce.c42
-rw-r--r--i/pc104/initrd/conf/busybox/shell/Config.in243
-rw-r--r--i/pc104/initrd/conf/busybox/shell/Kbuild11
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash.c13003
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/ash-alias/alias.right4
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/ash-alias/alias.tests37
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/ash-arith/README.ash1
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/ash-arith/arith-for.right74
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/ash-arith/arith-for.testsx94
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/ash-arith/arith.right138
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/ash-arith/arith.tests302
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/ash-arith/arith1.sub40
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/ash-arith/arith2.sub57
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/ash-heredoc/heredoc.right21
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/ash-heredoc/heredoc.tests94
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/ash-invert/invert.right10
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/ash-invert/invert.tests19
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/printenv.c67
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/recho.c63
-rwxr-xr-xi/pc104/initrd/conf/busybox/shell/ash_test/run-all62
-rw-r--r--i/pc104/initrd/conf/busybox/shell/ash_test/zecho.c39
-rw-r--r--i/pc104/initrd/conf/busybox/shell/bbsh.c223
-rw-r--r--i/pc104/initrd/conf/busybox/shell/hush.c2928
-rw-r--r--i/pc104/initrd/conf/busybox/shell/lash.c1582
-rw-r--r--i/pc104/initrd/conf/busybox/shell/msh.c5406
-rw-r--r--i/pc104/initrd/conf/busybox/sysklogd/Config.in111
-rw-r--r--i/pc104/initrd/conf/busybox/sysklogd/Kbuild11
-rw-r--r--i/pc104/initrd/conf/busybox/sysklogd/klogd.c123
-rw-r--r--i/pc104/initrd/conf/busybox/sysklogd/logger.c168
-rw-r--r--i/pc104/initrd/conf/busybox/sysklogd/logread.c144
-rw-r--r--i/pc104/initrd/conf/busybox/sysklogd/syslogd.c654
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/README34
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/TODO26
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/all_sourcecode.tests78
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/basename/basename-does-not-remove-identical-extension1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/basename/basename-works2
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/bunzip2.tests84
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/bunzip2/bunzip2-reads-from-standard-input2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/bunzip2/bunzip2-removes-compressed-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/bunzip2/bzcat-does-not-remove-compressed-file3
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/busybox.tests46
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/bzcat.tests49
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cat/cat-prints-a-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cat/cat-prints-a-file-and-standard-input7
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cmp/cmp-detects-difference9
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-a-files-to-dir14
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-a-preserves-links5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-copies-empty-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-copies-large-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-copies-small-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-d-files-to-dir11
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-dir-create-dir4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-dir-existing-dir5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-does-not-copy-unreadable-file6
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-files-to-dir11
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-follows-links4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-preserves-hard-links6
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-preserves-links5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cp/cp-preserves-source-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cut/cut-cuts-a-character1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cut/cut-cuts-a-closed-range1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cut/cut-cuts-a-field1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cut/cut-cuts-an-open-range1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/cut/cut-cuts-an-unclosed-range1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/date/date-R-works2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/date/date-format-works1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/date/date-u-works2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/date/date-works2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dd/dd-accepts-if2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dd/dd-accepts-of2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dd/dd-copies-from-standard-input-to-standard-output1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dd/dd-prints-count-to-standard-error2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dirname/dirname-handles-absolute-path1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dirname/dirname-handles-empty-path1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dirname/dirname-handles-multiple-slashes1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dirname/dirname-handles-relative-path1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dirname/dirname-handles-root1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dirname/dirname-handles-single-component1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/dirname/dirname-works2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/du/du-h-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/du/du-k-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/du/du-l-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/du/du-m-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/du/du-s-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/du/du-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/echo/echo-does-not-print-newline1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/echo/echo-prints-argument1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/echo/echo-prints-arguments1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/echo/echo-prints-newline1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/expr/expr-works59
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/false/false-is-silent1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/false/false-returns-failure1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/find/find-supports-minus-xdev1
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/grep.tests84
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/gunzip.tests3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/gunzip/gunzip-reads-from-standard-input2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/gzip/gzip-accepts-multiple-files3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/gzip/gzip-accepts-single-minus1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/gzip/gzip-removes-original-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/head/head-n-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/head/head-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/hostid/hostid-works2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/hostname/hostname-d-works2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/hostname/hostname-i-works2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/hostname/hostname-s-works1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/hostname/hostname-works1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/id/id-g-works1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/id/id-u-works1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/id/id-un-works1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/id/id-ur-works1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ln/ln-creates-hard-links4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ln/ln-creates-soft-links4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ln/ln-force-creates-hard-links5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ln/ln-force-creates-soft-links5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ln/ln-preserves-hard-links8
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ln/ln-preserves-soft-links9
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ls/ls-1-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ls/ls-h-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ls/ls-l-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/ls/ls-s-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/md5sum/md5sum-verifies-non-binary-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mkdir/mkdir-makes-a-directory2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mkdir/mkdir-makes-parent-directories2
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/mount.testroot183
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/msh/msh-supports-underscores-in-variable-names1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-files-to-dir16
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-follows-links4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-moves-empty-file4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-moves-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-moves-hardlinks4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-moves-large-file4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-moves-small-file4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-moves-symlinks6
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-moves-unreadable-files5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-preserves-hard-links6
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-preserves-links5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-refuses-mv-dir-to-subdir23
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/mv/mv-removes-source-file4
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/pidof.tests29
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/pwd/pwd-prints-working-directory1
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/readlink.tests32
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/rm/rm-removes-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/rmdir/rmdir-removes-parent-directories3
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/runtest150
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/sed.tests203
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/seq.tests36
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/sort.tests113
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/strings/strings-works-like-GNU9
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/sum.tests24
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tail/tail-n-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tail/tail-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-archives-multiple-files6
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-complains-about-missing-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-demands-at-least-one-ctx1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-demands-at-most-one-ctx1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-extracts-all-subdirs12
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-extracts-file5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-extracts-from-standard-input5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-extracts-multiple-files6
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-extracts-to-standard-output3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-handles-cz-options5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list6
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-handles-exclude-and-extract-lists8
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-handles-multiple-X-options10
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tar/tar-handles-nested-exclude9
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/taskset.tests17
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tee/tee-appends-input5
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tee/tee-tees-input3
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/testing.sh154
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/touch/touch-creates-file2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/touch/touch-does-not-create-file2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/touch/touch-touches-files-after-non-existent-file3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tr/tr-d-works4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tr/tr-non-gnu1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/tr/tr-works24
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/true/true-is-silent1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/true/true-returns-success1
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/umlwrapper.sh20
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/uniq.tests70
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/unzip.tests38
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/uptime/uptime-works2
-rwxr-xr-xi/pc104/initrd/conf/busybox/testsuite/uuencode.tests28
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wc/wc-counts-all2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wc/wc-counts-characters1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wc/wc-counts-lines1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wc/wc-counts-words1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wc/wc-prints-longest-line-length1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wget/wget--O-overrides--P3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wget/wget-handles-empty-path1
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wget/wget-retrieves-google-index2
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/wget/wget-supports--P3
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/which/which-uses-default-path4
-rw-r--r--i/pc104/initrd/conf/busybox/testsuite/xargs/xargs-works4
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/Config.in509
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/Kbuild32
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/dmesg.c54
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fbset.c408
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fdformat.c144
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fdisk.c3018
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fdisk_aix.c73
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fdisk_osf.c1063
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fdisk_sgi.c891
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fdisk_sun.c730
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/freeramdisk.c35
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/fsck_minix.c1390
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/getopt.c366
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/hexdump.c102
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/hwclock.c222
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/ipcrm.c218
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/ipcs.c631
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/losetup.c65
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/mdev.c270
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/minix.h76
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/mkfs_minix.c718
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/mkswap.c48
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/more.c173
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/mount.c1742
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/pivot_root.c27
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/rdate.c71
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/readprofile.c237
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/setarch.c53
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/swaponoff.c77
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/switch_root.c123
-rw-r--r--i/pc104/initrd/conf/busybox/util-linux/umount.c152
959 files changed, 231655 insertions, 0 deletions
diff --git a/i/pc104/initrd/conf/busybox.links b/i/pc104/initrd/conf/busybox.links
new file mode 100644
index 0000000..de85a50
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox.links
@@ -0,0 +1,18 @@
+/usr/bin/[
+/usr/bin/[[
+/bin/ash
+/usr/sbin/chroot
+/bin/echo
+/sbin/halt
+/bin/hostname
+/sbin/insmod
+/bin/mount
+/usr/bin/nc
+/sbin/pivot_root
+/sbin/reboot
+/bin/sh
+/bin/sleep
+/bin/sync
+/usr/bin/test
+/sbin/udhcpc
+/bin/umount
diff --git a/i/pc104/initrd/conf/busybox/AUTHORS b/i/pc104/initrd/conf/busybox/AUTHORS
new file mode 100644
index 0000000..8f6498b
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/AUTHORS
@@ -0,0 +1,173 @@
+List of the authors of code contained in BusyBox.
+
+If you have code in BusyBox, you should be listed here. If you should be
+listed, or the description of what you have done needs more detail, or is
+incorrect, _please_ let me know.
+
+ -Erik
+
+-----------
+
+Peter Willis <psyphreak@phreaker.net>
+ eject
+
+Emanuele Aina <emanuele.aina@tiscali.it>
+ run-parts
+
+Erik Andersen <andersen@codepoet.org>
+ Tons of new stuff, major rewrite of most of the
+ core apps, tons of new apps as noted in header files.
+ Lots of tedious effort writing these boring docs that
+ nobody is going to actually read.
+
+Laurence Anderson <l.d.anderson@warwick.ac.uk>
+ rpm2cpio, unzip, get_header_cpio, read_gz interface, rpm
+
+Jeff Angielski <jeff@theptrgroup.com>
+ ftpput, ftpget
+
+Enrik Berkhan <Enrik.Berkhan@inka.de>
+ setconsole
+
+Jim Bauer <jfbauer@nfr.com>
+ modprobe shell dependency
+
+Edward Betts <edward@debian.org>
+ expr, hostid, logname, whoami
+
+John Beppu <beppu@codepoet.org>
+ du, nslookup, sort
+
+David Brownell <dbrownell@users.sourceforge.net>
+ zcip
+
+Brian Candler <B.Candler@pobox.com>
+ tiny-ls(ls)
+
+Randolph Chung <tausq@debian.org>
+ fbset, ping, hostname
+
+Dave Cinege <dcinege@psychosis.com>
+ more(v2), makedevs, dutmp, modularization, auto links file,
+ various fixes, Linux Router Project maintenance
+
+Jordan Crouse <jordan@cosmicpenguin.net>
+ ipcalc
+
+Magnus Damm <damm@opensource.se>
+ tftp client
+ insmod powerpc support
+
+Larry Doolittle <ldoolitt@recycle.lbl.gov>
+ pristine source directory compilation, lots of patches and fixes.
+
+Glenn Engel <glenne@engel.org>
+ httpd
+
+Gennady Feldman <gfeldman@gena01.com>
+ Sysklogd (single threaded syslogd, IPC Circular buffer support,
+ logread), various fixes.
+
+Robert Griebl <sandman@handhelds.org>
+ modprobe, hwclock, suid/sgid handling, tinylogin integration
+ many bugfixes and enhancements
+
+Karl M. Hegbloom <karlheg@debian.org>
+ cp_mv.c, the test suite, various fixes to utility.c, &c.
+
+Daniel Jacobowitz <dan@debian.org>
+ mktemp.c
+
+Matt Kraai <kraai@alumni.cmu.edu>
+ documentation, bugfixes, test suite
+
+Rob Landley <rob@landley.net>
+ Became busybox maintainer in 2006.
+
+ sed (major rewrite in 2003, and I now maintain the thing)
+ bunzip2 (complete from-scratch rewrite, then mjn3 optimized the result)
+ sort (more or less from scratch rewrite in 2004, I now maintain it)
+ mount (rewrite in 2005, I maintain the new one)
+
+Stephan Linz <linz@li-pro.net>
+ ipcalc, Red Hat equivalence
+
+John Lombardo <john@deltanet.com>
+ tr
+
+Glenn McGrath <bug1@iinet.net.au>
+ Common unarchiving code and unarchiving applets, ifupdown, ftpgetput,
+ nameif, sed, patch, fold, install, uudecode.
+ Various bugfixes, review and apply numerous patches.
+
+Manuel Novoa III <mjn3@codepoet.org>
+ cat, head, mkfifo, mknod, rmdir, sleep, tee, tty, uniq, usleep, wc, yes,
+ mesg, vconfig, nice, renice,
+ make_directory, parse_mode, dirname, mode_string,
+ get_last_path_component, simplify_path, and a number trivial libbb routines
+
+ also bug fixes, partial rewrites, and size optimizations in
+ ash, basename, cal, cmp, cp, df, du, echo, env, ln, logname, md5sum, mkdir,
+ mv, realpath, rm, sort, tail, touch, uname, watch, arith, human_readable,
+ interface, dutmp, ifconfig, route
+
+Vladimir Oleynik <dzo@simtreas.ru>
+ cmdedit; bb_mkdep, xargs(current), httpd(current);
+ ports: ash, crond, fdisk (initial, unmaintained now), inetd, stty, traceroute,
+ top;
+ locale, various fixes
+ and irreconcilable critic of everything not perfect.
+
+Bruce Perens <bruce@pixar.com>
+ Original author of BusyBox in 1995, 1996. Some of his code can
+ still be found hiding here and there...
+
+Rodney Radford <rradford@mindspring.com>
+ ipcs, ipcrm
+
+Tim Riker <Tim@Rikers.org>
+ bug fixes, member of fan club
+
+Kent Robotti <robotti@metconnect.com>
+ reset, tons and tons of bug reports and patches.
+
+Chip Rosenthal <chip@unicom.com>, <crosenth@covad.com>
+ wget - Contributed by permission of Covad Communications
+
+Pavel Roskin <proski@gnu.org>
+ Lots of bugs fixes and patches.
+
+Gyepi Sam <gyepi@praxis-sw.com>
+ Remote logging feature for syslogd
+
+Rob Sullivan <cogito.ergo.cogito@gmail.com>
+ comm
+
+Linus Torvalds
+ mkswap, fsck.minix, mkfs.minix
+
+Mark Whitley <markw@codepoet.org>
+ grep, sed, cut, xargs(previous),
+ style-guide, new-applet-HOWTO, bug fixes, etc.
+
+Charles P. Wright <cpwright@villagenet.com>
+ gzip, mini-netcat(nc)
+
+Enrique Zanardi <ezanardi@ull.es>
+ tarcat (since removed), loadkmap, various fixes, Debian maintenance
+
+Tito Ragusa <farmatito@tiscali.it>
+ devfsd and size optimizations in strings, openvt, chvt, deallocvt, hdparm,
+ fdformat, lsattr, chattr, id and eject.
+
+Paul Fox <pgf@foxharp.boston.ma.us>
+ vi editing mode for ash, various other patches/fixes
+
+Roberto A. Foglietta <me@roberto.foglietta.name>
+ port: dnsd
+
+Bernhard Fischer <rep.nop@aon.at>
+ misc
+
+Mike Frysinger <vapier@gentoo.org>
+ initial e2fsprogs, printenv, setarch, sum, misc
diff --git a/i/pc104/initrd/conf/busybox/Config.in b/i/pc104/initrd/conf/busybox/Config.in
new file mode 100644
index 0000000..d15b267
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/Config.in
@@ -0,0 +1,496 @@
+#
+# For a description of the syntax of this configuration file,
+# see scripts/kbuild/config-language.txt.
+#
+
+mainmenu "BusyBox Configuration"
+
+config HAVE_DOT_CONFIG
+ bool
+ default y
+
+menu "Busybox Settings"
+
+menu "General Configuration"
+
+config NITPICK
+ bool "See lots more (probably unnecessary) configuration options."
+ default n
+ help
+ Some BusyBox applets have more configuration options than anyone
+ will ever care about. To avoid drowining people in complexity, most
+ of the applet features that can be set to a sane default value are
+ hidden, unless you hit the above switch.
+
+ This is better than to telling people to edit the busybox source
+ code, but not by much.
+
+ See http://en.wikipedia.org/wiki/Fibber_McGee_and_Molly#The_Closet
+
+ You have been warned.
+
+config DESKTOP
+ bool "Enable options for full-blown desktop systems"
+ default n
+ help
+ Enable options and features which are not essential.
+ Select this only if you plan to use busybox on full-blown
+ desktop machine with common Linux distro, not on an embedded box.
+
+choice
+ prompt "Buffer allocation policy"
+ default FEATURE_BUFFERS_USE_MALLOC
+ depends on NITPICK
+ help
+ There are 3 ways BusyBox can handle buffer allocations:
+ - Use malloc. This costs code size for the call to xmalloc.
+ - Put them on stack. For some very small machines with limited stack
+ space, this can be deadly. For most folks, this works just fine.
+ - Put them in BSS. This works beautifully for computers with a real
+ MMU (and OS support), but wastes runtime RAM for uCLinux. This
+ behavior was the only one available for BusyBox versions 0.48 and
+ earlier.
+
+config FEATURE_BUFFERS_USE_MALLOC
+ bool "Allocate with Malloc"
+
+config FEATURE_BUFFERS_GO_ON_STACK
+ bool "Allocate on the Stack"
+
+config FEATURE_BUFFERS_GO_IN_BSS
+ bool "Allocate in the .bss section"
+
+endchoice
+
+config SHOW_USAGE
+ bool "Show terse applet usage messages"
+ default y
+ help
+ All BusyBox applets will show help messages when invoked with
+ wrong arguments. You can turn off printing these terse usage
+ messages if you say no here.
+ This will save you up to 7k.
+
+config FEATURE_VERBOSE_USAGE
+ bool "Show verbose applet usage messages"
+ default n
+ select SHOW_USAGE
+ help
+ All BusyBox applets will show more verbose help messages when
+ busybox is invoked with --help. This will add a lot of text to the
+ busybox binary. In the default configuration, this will add about
+ 13k, but it can add much more depending on your configuration.
+
+config FEATURE_COMPRESS_USAGE
+ bool "Store applet usage messages in compressed form"
+ default y
+ depends on SHOW_USAGE
+ help
+ Store usage messages in compressed form, uncompress them on-the-fly
+ when <applet> --help is called.
+
+ If you have a really tiny busybox with few applets enabled (and
+ bunzip2 isn't one of them), the overhead of the decompressor might
+ be noticeable. Also, if you run executables directly from ROM
+ and have very little memory, this might not be a win. Otherwise,
+ you probably want this.
+
+config FEATURE_INSTALLER
+ bool "Support --install [-s] to install applet links at runtime"
+ default n
+ help
+ Enable 'busybox --install [-s]' support. This will allow you to use
+ busybox at runtime to create hard links or symlinks for all the
+ applets that are compiled into busybox. This feature requires the
+ /proc filesystem.
+
+config LOCALE_SUPPORT
+ bool "Enable locale support (system needs locale for this to work)"
+ default n
+ help
+ Enable this if your system has locale support and you would like
+ busybox to support locale settings.
+
+config GETOPT_LONG
+ bool "Enable support for --long-options"
+ default y
+ help
+ Enable this if you want busybox applets to use the gnu --long-option
+ style, in addition to single character -a -b -c style options.
+
+config FEATURE_DEVPTS
+ bool "Use the devpts filesystem for Unix98 PTYs"
+ default y
+ help
+ Enable if you want BusyBox to use Unix98 PTY support. If enabled,
+ busybox will use /dev/ptmx for the master side of the pseudoterminal
+ and /dev/pts/<number> for the slave side. Otherwise, BSD style
+ /dev/ttyp<number> will be used. To use this option, you should have
+ devpts mounted.
+
+config FEATURE_CLEAN_UP
+ bool "Clean up all memory before exiting (usually not needed)"
+ default n
+ depends on NITPICK
+ help
+ As a size optimization, busybox normally exits without explicitly
+ freeing dynamically allocated memory or closing files. This saves
+ space since the OS will clean up for us, but it can confuse debuggers
+ like valgrind, which report tons of memory and resource leaks.
+
+ Don't enable this unless you have a really good reason to clean
+ things up manually.
+
+config FEATURE_SUID
+ bool "Support for SUID/SGID handling"
+ default n
+ help
+ With this option you can install the busybox binary belonging
+ to root with the suid bit set, and it'll and it'll automatically drop
+ priviledges for applets that don't need root access.
+
+ If you're really paranoid and don't want to do this, build two
+ busybox binaries with different applets in them (and the appropriate
+ symlinks pointing to each binary), and only set the suid bit on the
+ one that needs it. The applets currently marked to need the suid bit
+ are login, passwd, su, ping, traceroute, crontab, dnsd, ipcrm, ipcs,
+ and vlock.
+
+config FEATURE_SYSLOG
+ bool "Support for syslog"
+ default n
+ help
+ This option is auto-selected when you select any applet which may
+ send its output to syslog. You do not need to select it manually.
+
+config FEATURE_SUID_CONFIG
+ bool "Runtime SUID/SGID configuration via /etc/busybox.conf"
+ default n if FEATURE_SUID
+ depends on FEATURE_SUID
+ help
+ Allow the SUID / SGID state of an applet to be determined at runtime
+ by checking /etc/busybox.conf. (This is sort of a poor man's sudo.)
+ The format of this file is as follows:
+
+ <applet> = [Ssx-][Ssx-][x-] (<username>|<uid>).(<groupname>|<gid>)
+
+ An example might help:
+
+ [SUID]
+ su = ssx root.0 # applet su can be run by anyone and runs with euid=0/egid=0
+ su = ssx # exactly the same
+
+ mount = sx- root.disk # applet mount can be run by root and members of group disk
+ # and runs with euid=0
+
+ cp = --- # disable applet cp for everyone
+
+ The file has to be owned by user root, group root and has to be
+ writeable only by root:
+ (chown 0.0 /etc/busybox.conf; chmod 600 /etc/busybox.conf)
+ The busybox executable has to be owned by user root, group
+ root and has to be setuid root for this to work:
+ (chown 0.0 /bin/busybox; chmod 4755 /bin/busybox)
+
+ Robert 'sandman' Griebl has more information here:
+ <url: http://www.softforge.de/bb/suid.html >.
+
+config FEATURE_SUID_CONFIG_QUIET
+ bool "Suppress warning message if /etc/busybox.conf is not readable"
+ default y
+ depends on FEATURE_SUID_CONFIG
+ help
+ /etc/busybox.conf should be readable by the user needing the SUID, check
+ this option to avoid users to be notified about missing permissions.
+
+config FEATURE_HAVE_RPC
+ bool "RPC support"
+ default y
+ help
+ Select this if you have rpc support.
+ This automatically turns off all configuration options that rely
+ on RPC.
+
+config SELINUX
+ bool "Support NSA Security Enhanced Linux"
+ default n
+ help
+ Enable support for SELinux in applets ls, ps, and id. Also provide
+ the option of compiling in SELinux applets.
+
+ If you do not have a complete SELinux userland installed, this stuff
+ will not compile. Go visit
+ http://www.nsa.gov/selinux/index.html
+ to download the necessary stuff to allow busybox to compile with
+ this option enabled. Specifially, libselinux 1.28 or better is
+ directly required by busybox. If the installation is located in a
+ non-standard directory, provide it by invoking make as follows:
+ CFLAGS=-I<libselinux-include-path> \
+ LDFLAGS=-L<libselinux-lib-path> \
+ make
+
+ Most people will leave this set to 'N'.
+
+config FEATURE_EXEC_PREFER_APPLETS
+ bool "exec prefers applets"
+ default n
+ help
+ This is an experimental option which directs applets about to
+ call 'exec' to try and find an applicable busybox applet before
+ searching the executable path for a binary or symlink to execute.
+
+config BUSYBOX_EXEC_PATH
+ string "Path to BusyBox executable"
+ default "/proc/self/exe"
+ help
+ When Busybox applets need to run other busybox applets, BusyBox
+ sometimes needs to exec() itself. When the /proc filesystem is
+ mounted, /proc/self/exe always points to the currently running
+ executable. If you haven't got /proc, set this to wherever you
+ want to run BusyBox from.
+
+endmenu
+
+menu 'Build Options'
+
+config STATIC
+ bool "Build BusyBox as a static binary (no shared libs)"
+ default n
+ help
+ If you want to build a static BusyBox binary, which does not
+ use or require any shared libraries, then enable this option.
+ This can cause BusyBox to be considerably larger, so you should
+ leave this option false unless you have a good reason (i.e.
+ your target platform does not support shared libraries, or
+ you are building an initrd which doesn't need anything but
+ BusyBox, etc).
+
+ Most people will leave this set to 'N'.
+
+config BUILD_LIBBUSYBOX
+ bool "Build shared libbusybox"
+ default n
+ help
+ Build a shared library libbusybox.so which contains all
+ libraries used inside busybox.
+
+ This is an experimental feature intended to support the upcoming
+ "make standalone" mode. Enabling it against the one big busybox
+ binary serves no purpose (and increases the size). You should
+ almost certainly say "no" to this right now.
+
+config FEATURE_FULL_LIBBUSYBOX
+ bool "Feature-complete libbusybox"
+ default n if !FEATURE_SHARED_BUSYBOX
+ depends on BUILD_LIBBUSYBOX
+ help
+ Build a libbusybox with the complete feature-set, disregarding
+ the actually selected config.
+
+ Normally, libbusybox will only contain the features which are
+ used by busybox itself. If you plan to write a separate
+ standalone application which uses libbusybox say 'Y'.
+
+ Note: libbusybox is GPL, not LGPL, and exports no stable API that
+ might act as a copyright barrier. We can and will modify the
+ exported function set between releases (even minor version number
+ changes), and happily break out-of-tree features.
+
+ Say 'N' if in doubt.
+
+config FEATURE_SHARED_BUSYBOX
+ bool "Use shared libbusybox for busybox"
+ default y if BUILD_LIBBUSYBOX
+ depends on !STATIC && BUILD_LIBBUSYBOX
+ help
+ Use libbusybox.so also for busybox itself.
+ You need to have a working dynamic linker to use this variant.
+
+config LFS
+ bool "Build with Large File Support (for accessing files > 2 GB)"
+ default n
+ select FDISK_SUPPORT_LARGE_DISKS
+ help
+ If you want to build BusyBox with large file support, then enable
+ this option. This will have no effect if your kernel or your C
+ library lacks large file support for large files. Some of the
+ programs that can benefit from large file support include dd, gzip,
+ cp, mount, tar, and many others. If you want to access files larger
+ than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'.
+
+config BUILD_AT_ONCE
+ bool "Compile all sources at once"
+ default n
+ help
+ Normally each source-file is compiled with one invocation of
+ the compiler.
+ If you set this option, all sources are compiled at once.
+ This gives the compiler more opportunities to optimize which can
+ result in smaller and/or faster binaries.
+
+ Setting this option will consume alot of memory, e.g. if you
+ enable all applets with all features, gcc uses more than 300MB
+ RAM during compilation of busybox.
+
+ This option is most likely only beneficial for newer compilers
+ such as gcc-4.1 and above.
+
+ Say 'N' unless you know what you are doing.
+
+endmenu
+
+menu 'Debugging Options'
+
+config DEBUG
+ bool "Build BusyBox with extra Debugging symbols"
+ default n
+ help
+ Say Y here if you wish to examine BusyBox internals while applets are
+ running. This increases the size of the binary considerably, and
+ should only be used when doing development. If you are doing
+ development and want to debug BusyBox, answer Y.
+
+ Most people should answer N.
+
+config WERROR
+ bool "Abort compilation on any warning"
+ default n
+ help
+ Selecting this will add -Werror to gcc command line.
+
+ Most people should answer N.
+
+# Seems to be unused
+#config DEBUG_PESSIMIZE
+# bool "Disable compiler optimizations."
+# default n
+# depends on DEBUG
+# help
+# The compiler's optimization of source code can eliminate and reorder
+# code, resulting in an executable that's hard to understand when
+# stepping through it with a debugger. This switches it off, resulting
+# in a much bigger executable that more closely matches the source
+# code.
+
+choice
+ prompt "Additional debugging library"
+ default NO_DEBUG_LIB
+ depends on DEBUG
+ help
+ Using an additional debugging library will make BusyBox become
+ considerable larger and will cause it to run more slowly. You
+ should always leave this option disabled for production use.
+
+ dmalloc support:
+ ----------------
+ This enables compiling with dmalloc ( http://dmalloc.com/ )
+ which is an excellent public domain mem leak and malloc problem
+ detector. To enable dmalloc, before running busybox you will
+ want to properly set your environment, for example:
+ export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile
+ The 'debug=' value is generated using the following command
+ dmalloc -p log-stats -p log-non-free -p log-bad-space -p log-elapsed-time \
+ -p check-fence -p check-heap -p check-lists -p check-blank \
+ -p check-funcs -p realloc-copy -p allow-free-null
+
+ Electric-fence support:
+ -----------------------
+ This enables compiling with Electric-fence support. Electric
+ fence is another very useful malloc debugging library which uses
+ your computer's virtual memory hardware to detect illegal memory
+ accesses. This support will make BusyBox be considerable larger
+ and run slower, so you should leave this option disabled unless
+ you are hunting a hard to find memory problem.
+
+
+config NO_DEBUG_LIB
+ bool "None"
+
+config DMALLOC
+ bool "Dmalloc"
+
+config EFENCE
+ bool "Electric-fence"
+
+endchoice
+
+config INCLUDE_SUSv2
+ bool "Enable obsolete features removed before SUSv3?"
+ default y
+ help
+ This option will enable backwards compatibility with SuSv2,
+ specifically, old-style numeric options ('command -1 <file>')
+ will be supported in head, tail, and fold. (Note: should
+ affect renice too.)
+
+endmenu
+
+menu 'Installation Options'
+
+config INSTALL_NO_USR
+ bool "Don't use /usr"
+ default n
+ help
+ Disable use of /usr. Don't activate this option if you don't know
+ that you really want this behaviour.
+
+choice
+ prompt "Applets links"
+ default INSTALL_APPLET_SYMLINKS
+ help
+ Choose how you install applets links.
+
+config INSTALL_APPLET_SYMLINKS
+ bool "as soft-links"
+ help
+ Install applets as soft-links to the busybox binary. This needs some
+ free inodes on the filesystem, but might help with filesystem
+ generators that can't cope with hard-links.
+
+config INSTALL_APPLET_HARDLINKS
+ bool "as hard-links"
+ help
+ Install applets as hard-links to the busybox binary. This might count
+ on a filesystem with few inodes.
+
+config INSTALL_APPLET_DONT
+ bool "not installed"
+ depends on FEATURE_INSTALLER || FEATURE_SH_STANDALONE_SHELL || FEATURE_EXEC_PREFER_APPLETS
+ help
+ Do not install applet links. Useful when using the -install feature
+ or a standalone shell for rescue pruposes.
+
+endchoice
+
+config PREFIX
+ string "BusyBox installation prefix"
+ default "./_install"
+ help
+ Define your directory to install BusyBox files/subdirs in.
+
+endmenu
+
+source libbb/Config.in
+
+endmenu
+
+comment "Applets"
+
+source archival/Config.in
+source coreutils/Config.in
+source console-tools/Config.in
+source debianutils/Config.in
+source editors/Config.in
+source findutils/Config.in
+source init/Config.in
+source loginutils/Config.in
+source e2fsprogs/Config.in
+source modutils/Config.in
+source util-linux/Config.in
+source miscutils/Config.in
+source networking/Config.in
+source procps/Config.in
+source shell/Config.in
+source sysklogd/Config.in
+source runit/Config.in
+source selinux/Config.in
diff --git a/i/pc104/initrd/conf/busybox/INSTALL b/i/pc104/initrd/conf/busybox/INSTALL
new file mode 100644
index 0000000..a7902ab
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/INSTALL
@@ -0,0 +1,125 @@
+Building:
+=========
+
+The BusyBox build process is similar to the Linux kernel build:
+
+ make menuconfig # This creates a file called ".config"
+ make # This creates the "busybox" executable
+ make install # or make CONFIG_PREFIX=/path/from/root install
+
+The full list of configuration and install options is available by typing:
+
+ make help
+
+Quick Start:
+============
+
+The easy way to try out BusyBox for the first time, without having to install
+it, is to enable all features and then use "standalone shell" mode with a
+blank command $PATH.
+
+To enable all features, use "make defconfig", which produces the largest
+general-purpose configuration. (It's allyesconfig minus debugging options,
+optional packaging choices, and a few special-purpose features requiring
+extra configuration to use.)
+
+ make defconfig
+ make
+ PATH= ./busybox ash
+
+Standalone shell mode causes busybox's built-in command shell to run
+any built-in busybox applets directly, without looking for external
+programs by that name. Supplying an empty command path (as above) means
+the only commands busybox can find are the built-in ones.
+
+Note that the standalone shell requires CONFIG_BUSYBOX_EXEC_PATH
+to be set appropriately, depending on whether or not /proc/self/exe is
+available or not. If you do not have /proc, then point that config option
+to the location of your busybox binary, usually /bin/busybox.
+
+Configuring Busybox:
+====================
+
+Busybox is optimized for size, but enabling the full set of functionality
+still results in a fairly large executable -- more than 1 megabyte when
+statically linked. To save space, busybox can be configured with only the
+set of applets needed for each environment. The minimal configuration, with
+all applets disabled, produces a 4k executable. (It's useless, but very small.)
+
+The manual configurator "make menuconfig" modifies the existing configuration.
+(For systems without ncurses, try "make config" instead.) The two most
+interesting starting configurations are "make allnoconfig" (to start with
+everything disabled and add just what you need), and "make defconfig" (to
+start with everything enabled and remove what you don't need). If menuconfig
+is run without an existing configuration, make defconfig will run first to
+create a known starting point.
+
+Other starting configurations (mostly used for testing purposes) include
+"make allbareconfig" (enables all applets but disables all optional features),
+"make allyesconfig" (enables absolutely everything including debug features),
+and "make randconfig" (produce a random configuration).
+
+Configuring BusyBox produces a file ".config", which can be saved for future
+use. Run "make oldconfig" to bring a .config file from an older version of
+busybox up to date.
+
+Installing Busybox:
+===================
+
+Busybox is a single executable that can behave like many different commands,
+and BusyBox uses the name it was invoked under to determine the desired
+behavior. (Try "mv busybox ls" and then "./ls -l".)
+
+Installing busybox consists of creating symlinks (or hardlinks) to the busybox
+binary for each applet enabled in busybox, and making sure these symlinks are
+in the shell's command $PATH. Running "make install" creates these symlinks,
+or "make install-hardlinks" creates hardlinks instead (useful on systems with
+a limited number of inodes). This install process uses the file
+"busybox.links" (created by make), which contains the list of enabled applets
+and the path at which to install them.
+
+Installing links to busybox is not always necessary. The special applet name
+"busybox" (or with any optional suffix, such as "busybox-static") uses the
+first argument to determine which applet to behave as, for example
+"./busybox cat LICENSE". (Running the busybox applet with no arguments gives
+a list of all enabled applets.) The standalone shell can also call busybox
+applets without links to busybox under other names in the filesystem. You can
+also configure a standaone install capability into the busybox base applet,
+and then install such links at runtime with one of "busybox --install" (for
+hardlinks) or "busybox --install -s" (for symlinks).
+
+If you enabled the busybox shared library feature (libbusybox.so) and want
+to run tests without installing, set your LD_LIBRARY_PATH accordingly when
+running the executable:
+
+ LD_LIBRARY_PATH=`pwd` ./busybox
+
+Building out-of-tree:
+=====================
+
+By default, the BusyBox build puts its temporary files in the source tree.
+Building from a read-only source tree, or building multiple configurations from
+the same source directory, requires the ability to put the temporary files
+somewhere else.
+
+To build out of tree, cd to an empty directory and configure busybox from there:
+
+ make -f /path/to/source/Makefile defconfig
+ make
+ make install
+
+Alternately, use the O=$BUILDPATH option (with an absolute path) during the
+configuration step, as in:
+
+ make O=/some/empty/directory allyesconfig
+ cd /some/empty/directory
+ make
+ make CONFIG_PREFIX=. install
+
+More Information:
+=================
+
+Se also the busybox FAQ, under the questions "How can I get started using
+BusyBox" and "How do I build a BusyBox-based system?" The BusyBox FAQ is
+available from http://www.busybox.net/FAQ.html or as the file
+docs/busybox.net/FAQ.html in this tarball.
diff --git a/i/pc104/initrd/conf/busybox/LICENSE b/i/pc104/initrd/conf/busybox/LICENSE
new file mode 100644
index 0000000..9d9bdc7
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/LICENSE
@@ -0,0 +1,348 @@
+--- A note on GPL versions
+
+BusyBox is distributed under version 2 of the General Public License (included
+in its entirety, below). Version 2 is the only version of this license which
+this version of BusyBox (or modified versions derived from this one) may be
+distributed under.
+
+------------------------------------------------------------------------
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/i/pc104/initrd/conf/busybox/Makefile b/i/pc104/initrd/conf/busybox/Makefile
new file mode 100644
index 0000000..b42e179
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/Makefile
@@ -0,0 +1,1280 @@
+VERSION = 1
+PATCHLEVEL = 5
+SUBLEVEL = 0
+EXTRAVERSION =
+NAME = Unnamed
+
+# *DOCUMENTATION*
+# To see a list of typical targets execute "make help"
+# More info can be located in ./README
+# Comments in this file are targeted only to the developer, do not
+# expect to learn how to build the kernel reading this file.
+
+# Do not print "Entering directory ..."
+MAKEFLAGS += --no-print-directory
+
+# We are using a recursive build, so we need to do a little thinking
+# to get the ordering right.
+#
+# Most importantly: sub-Makefiles should only ever modify files in
+# their own directory. If in some directory we have a dependency on
+# a file in another dir (which doesn't happen often, but it's often
+# unavoidable when linking the built-in.o targets which finally
+# turn into busybox), we will call a sub make in that other dir, and
+# after that we are sure that everything which is in that other dir
+# is now up to date.
+#
+# The only cases where we need to modify files which have global
+# effects are thus separated out and done before the recursive
+# descending is started. They are now explicitly listed as the
+# prepare rule.
+
+# To put more focus on warnings, be less verbose as default
+# Use 'make V=1' to see the full commands
+
+ifdef V
+ ifeq ("$(origin V)", "command line")
+ KBUILD_VERBOSE = $(V)
+ endif
+endif
+ifndef KBUILD_VERBOSE
+ KBUILD_VERBOSE = 0
+endif
+
+# Call sparse as part of compilation of C files
+# Use 'make C=1' to enable sparse checking
+
+ifdef C
+ ifeq ("$(origin C)", "command line")
+ KBUILD_CHECKSRC = $(C)
+ endif
+endif
+ifndef KBUILD_CHECKSRC
+ KBUILD_CHECKSRC = 0
+endif
+
+# Use make M=dir to specify directory of external module to build
+# Old syntax make ... SUBDIRS=$PWD is still supported
+# Setting the environment variable KBUILD_EXTMOD take precedence
+ifdef SUBDIRS
+ KBUILD_EXTMOD ?= $(SUBDIRS)
+endif
+ifdef M
+ ifeq ("$(origin M)", "command line")
+ KBUILD_EXTMOD := $(M)
+ endif
+endif
+
+
+# kbuild supports saving output files in a separate directory.
+# To locate output files in a separate directory two syntaxes are supported.
+# In both cases the working directory must be the root of the kernel src.
+# 1) O=
+# Use "make O=dir/to/store/output/files/"
+#
+# 2) Set KBUILD_OUTPUT
+# Set the environment variable KBUILD_OUTPUT to point to the directory
+# where the output files shall be placed.
+# export KBUILD_OUTPUT=dir/to/store/output/files/
+# make
+#
+# The O= assignment takes precedence over the KBUILD_OUTPUT environment
+# variable.
+
+
+# KBUILD_SRC is set on invocation of make in OBJ directory
+# KBUILD_SRC is not intended to be used by the regular user (for now)
+ifeq ($(KBUILD_SRC),)
+
+# OK, Make called in directory where kernel src resides
+# Do we want to locate output files in a separate directory?
+ifdef O
+ ifeq ("$(origin O)", "command line")
+ KBUILD_OUTPUT := $(O)
+ endif
+endif
+
+# That's our default target when none is given on the command line
+PHONY := _all
+_all:
+
+ifneq ($(KBUILD_OUTPUT),)
+# Invoke a second make in the output directory, passing relevant variables
+# check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(KBUILD_OUTPUT),, \
+ $(error output directory "$(saved-output)" does not exist))
+
+PHONY += $(MAKECMDGOALS)
+
+$(filter-out _all,$(MAKECMDGOALS)) _all:
+ $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
+ KBUILD_SRC=$(CURDIR) \
+ KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifneq ($(KBUILD_OUTPUT),)
+endif # ifeq ($(KBUILD_SRC),)
+
+# We process the rest of the Makefile if this is the final invocation of make
+ifeq ($(skip-makefile),)
+
+# If building an external module we do not care about the all: rule
+# but instead _all depend on modules
+PHONY += all
+ifeq ($(KBUILD_EXTMOD),)
+_all: all
+else
+_all: modules
+endif
+
+srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
+TOPDIR := $(srctree)
+# FIXME - TOPDIR is obsolete, use srctree/objtree
+objtree := $(CURDIR)
+src := $(srctree)
+obj := $(objtree)
+
+VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
+
+export srctree objtree VPATH TOPDIR
+
+
+# SUBARCH tells the usermode build what the underlying arch is. That is set
+# first, and if a usermode build is happening, the "ARCH=um" on the command
+# line overrides the setting of ARCH below. If a native build is happening,
+# then ARCH is assigned, getting whatever value it gets normally, and
+# SUBARCH is subsequently ignored.
+
+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+ -e s/arm.*/arm/ -e s/sa110/arm/ \
+ -e s/s390x/s390/ -e s/parisc64/parisc/ \
+ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
+
+# Cross compiling and selecting different set of gcc/bin-utils
+# ---------------------------------------------------------------------------
+#
+# When performing cross compilation for other architectures ARCH shall be set
+# to the target architecture. (See arch/* for the possibilities).
+# ARCH can be set during invocation of make:
+# make ARCH=ia64
+# Another way is to have ARCH set in the environment.
+# The default ARCH is the host where make is executed.
+
+# CROSS_COMPILE specify the prefix used for all executables used
+# during compilation. Only gcc and related bin-utils executables
+# are prefixed with $(CROSS_COMPILE).
+# CROSS_COMPILE can be set on the command line
+# make CROSS_COMPILE=ia64-linux-
+# Alternatively CROSS_COMPILE can be set in the environment.
+# Default value for CROSS_COMPILE is not to prefix executables
+# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
+
+ARCH ?= $(SUBARCH)
+CROSS_COMPILE ?=
+
+# Architecture as present in compile.h
+UTS_MACHINE := $(ARCH)
+
+# SHELL used by kbuild
+CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
+ else if [ -x /bin/bash ]; then echo /bin/bash; \
+ else echo sh; fi ; fi)
+
+HOSTCC = gcc
+HOSTCXX = g++
+HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCXXFLAGS = -O2
+
+# Decide whether to build built-in, modular, or both.
+# Normally, just do built-in.
+
+KBUILD_MODULES :=
+KBUILD_BUILTIN := 1
+
+# If we have only "make modules", don't compile built-in objects.
+# When we're building modules with modversions, we need to consider
+# the built-in objects during the descend as well, in order to
+# make sure the checksums are uptodate before we record them.
+
+ifeq ($(MAKECMDGOALS),modules)
+ KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
+endif
+
+# If we have "make <whatever> modules", compile modules
+# in addition to whatever we do anyway.
+# Just "make" or "make all" shall build modules as well
+
+ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
+ KBUILD_MODULES := 1
+endif
+
+ifeq ($(MAKECMDGOALS),)
+ KBUILD_MODULES := 1
+endif
+
+export KBUILD_MODULES KBUILD_BUILTIN
+export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
+
+# Beautify output
+# ---------------------------------------------------------------------------
+#
+# Normally, we echo the whole command before executing it. By making
+# that echo $($(quiet)$(cmd)), we now have the possibility to set
+# $(quiet) to choose other forms of output instead, e.g.
+#
+# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
+# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
+#
+# If $(quiet) is empty, the whole command will be printed.
+# If it is set to "quiet_", only the short version will be printed.
+# If it is set to "silent_", nothing wil be printed at all, since
+# the variable $(silent_cmd_cc_o_c) doesn't exist.
+#
+# A simple variant is to prefix commands with $(Q) - that's useful
+# for commands that shall be hidden in non-verbose mode.
+#
+# $(Q)ln $@ :<
+#
+# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
+# If KBUILD_VERBOSE equals 1 then the above command is displayed.
+
+ifeq ($(KBUILD_VERBOSE),1)
+ quiet =
+ Q =
+else
+ quiet=quiet_
+ Q = @
+endif
+
+# If the user is running make -s (silent mode), suppress echoing of
+# commands
+
+ifneq ($(findstring s,$(MAKEFLAGS)),)
+ quiet=silent_
+endif
+
+export quiet Q KBUILD_VERBOSE
+
+
+# Look for make include files relative to root of kernel src
+MAKEFLAGS += --include-dir=$(srctree)
+
+# We need some generic definitions
+include $(srctree)/scripts/Kbuild.include
+
+# For maximum performance (+ possibly random breakage, uncomment
+# the following)
+
+MAKEFLAGS += -rR
+
+# Make variables (CC, etc...)
+
+AS = $(CROSS_COMPILE)as
+CC = $(CROSS_COMPILE)gcc
+LD = $(CC) -nostdlib
+CPP = $(CC) -E
+AR = $(CROSS_COMPILE)ar
+NM = $(CROSS_COMPILE)nm
+STRIP = $(CROSS_COMPILE)strip
+OBJCOPY = $(CROSS_COMPILE)objcopy
+OBJDUMP = $(CROSS_COMPILE)objdump
+AWK = awk
+GENKSYMS = scripts/genksyms/genksyms
+DEPMOD = /sbin/depmod
+KALLSYMS = scripts/kallsyms
+PERL = perl
+CHECK = sparse
+
+CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
+MODFLAGS = -DMODULE
+CFLAGS_MODULE = $(MODFLAGS)
+AFLAGS_MODULE = $(MODFLAGS)
+LDFLAGS_MODULE = -r
+CFLAGS_KERNEL =
+AFLAGS_KERNEL =
+
+
+# Use LINUXINCLUDE when you must reference the include/ directory.
+# Needed to be compatible with the O= option
+CFLAGS := $(CFLAGS)
+CPPFLAGS := $(CPPFLAGS)
+AFLAGS := $(AFLAGS)
+
+# Read KERNELRELEASE from .kernelrelease (if it exists)
+KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)
+KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+
+export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \
+ ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
+ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
+ HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+
+export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
+export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
+export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
+
+# When compiling out-of-tree modules, put MODVERDIR in the module
+# tree rather than in the kernel tree. The kernel tree might
+# even be read-only.
+export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
+
+# Files to ignore in find ... statements
+
+RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
+export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git
+
+# ===========================================================================
+# Rules shared between *config targets and build targets
+
+# Basic helpers built in scripts/
+PHONY += scripts_basic
+scripts_basic:
+ $(Q)$(MAKE) $(build)=scripts/basic
+
+# To avoid any implicit rule to kick in, define an empty command.
+scripts/basic/%: scripts_basic ;
+
+PHONY += outputmakefile
+# outputmakefile generates a Makefile in the output directory, if using a
+# separate output directory. This allows convenient use of make in the
+# output directory.
+outputmakefile:
+ifneq ($(KBUILD_SRC),)
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
+ $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+endif
+
+# To make sure we do not include .config for any of the *config targets
+# catch them early, and hand them over to scripts/kconfig/Makefile
+# It is allowed to specify more targets when calling make, including
+# mixing *config targets and build targets.
+# For example 'make oldconfig all'.
+# Detect when mixed targets is specified, and make a second invocation
+# of make so .config is not included in this case either (for *config).
+
+no-dot-config-targets := clean mrproper distclean \
+ cscope TAGS tags help %docs check%
+
+config-targets := 0
+mixed-targets := 0
+dot-config := 1
+
+ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
+ ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
+ dot-config := 0
+ endif
+endif
+
+ifeq ($(KBUILD_EXTMOD),)
+ ifneq ($(filter config %config,$(MAKECMDGOALS)),)
+ config-targets := 1
+ ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
+ mixed-targets := 1
+ endif
+ endif
+endif
+
+ifeq ($(mixed-targets),1)
+# ===========================================================================
+# We're called with mixed targets (*config and build targets).
+# Handle them one by one.
+
+%:: FORCE
+ $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
+
+else
+ifeq ($(config-targets),1)
+# ===========================================================================
+# *config targets only - make sure prerequisites are updated, and descend
+# in scripts/kconfig to make the *config target
+
+# Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
+# KBUILD_DEFCONFIG may point out an alternative default configuration
+# used for 'make defconfig'
+-include $(srctree)/arch/$(ARCH)/Makefile
+export KBUILD_DEFCONFIG
+
+config %config: scripts_basic outputmakefile FORCE
+ $(Q)mkdir -p include
+ $(Q)$(MAKE) $(build)=scripts/kconfig $@
+ $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
+
+else
+# ===========================================================================
+# Build targets only - this includes busybox, arch specific targets, clean
+# targets and others. In general all targets except *config targets.
+
+ifeq ($(KBUILD_EXTMOD),)
+# Additional helpers built in scripts/
+# Carefully list dependencies so we do not try to build scripts twice
+# in parrallel
+PHONY += scripts
+scripts: scripts_basic include/config/MARKER
+ $(Q)$(MAKE) $(build)=$(@)
+
+scripts_basic: include/autoconf.h
+
+# Objects we will link into busybox / subdirs we need to visit
+core-y := \
+ applets/ \
+
+libs-y := \
+ archival/ \
+ archival/libunarchive/ \
+ console-tools/ \
+ coreutils/ \
+ coreutils/libcoreutils/ \
+ debianutils/ \
+ e2fsprogs/ \
+ editors/ \
+ findutils/ \
+ init/ \
+ libbb/ \
+ libpwdgrp/ \
+ loginutils/ \
+ miscutils/ \
+ modutils/ \
+ networking/ \
+ networking/libiproute/ \
+ networking/udhcp/ \
+ procps/ \
+ runit/ \
+ selinux/ \
+ shell/ \
+ sysklogd/ \
+ util-linux/ \
+
+endif # KBUILD_EXTMOD
+
+ifeq ($(dot-config),1)
+# In this section, we need .config
+
+# Read in dependencies to all Kconfig* files, make sure to run
+# oldconfig if changes are detected.
+-include .kconfig.d
+
+-include .config
+
+# If .config needs to be updated, it will be done via the dependency
+# that autoconf has on .config.
+# To avoid any implicit rule to kick in, define an empty command
+.config .kconfig.d: ;
+
+# Now we can define CFLAGS etc according to .config
+include $(srctree)/Makefile.flags
+
+# If .config is newer than include/autoconf.h, someone tinkered
+# with it and forgot to run make oldconfig.
+# If kconfig.d is missing then we are probarly in a cleaned tree so
+# we execute the config step to be sure to catch updated Kconfig files
+include/autoconf.h: .kconfig.d .config
+ $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
+
+else
+# Dummy target needed, because used as prerequisite
+include/autoconf.h: ;
+endif
+
+# The all: target is the default when no target is given on the
+# command line.
+# This allow a user to issue only 'make' to build a kernel including modules
+# Defaults busybox but it is usually overridden in the arch makefile
+all: busybox
+
+-include $(srctree)/arch/$(ARCH)/Makefile
+
+# arch Makefile may override CC so keep this after arch Makefile is included
+#bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+CHECKFLAGS += $(NOSTDINC_FLAGS)
+
+# warn about C99 declaration after statement
+CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
+
+# disable pointer signedness warnings in gcc 4.0
+CFLAGS += $(call cc-option,-Wno-pointer-sign,)
+
+# Default kernel image to build when no specific target is given.
+# KBUILD_IMAGE may be overruled on the commandline or
+# set in the environment
+# Also any assignments in arch/$(ARCH)/Makefile take precedence over
+# this default value
+export KBUILD_IMAGE ?= busybox
+
+#
+# INSTALL_PATH specifies where to place the updated kernel and system map
+# images. Default is /boot, but you can set it to other values
+export INSTALL_PATH ?= /boot
+
+#
+# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
+# relocations required by build roots. This is not defined in the
+# makefile but the arguement can be passed to make if needed.
+#
+
+MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
+export MODLIB
+
+
+ifeq ($(KBUILD_EXTMOD),)
+busybox-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(core-m) $(libs-y) $(libs-m)))
+
+busybox-alldirs := $(sort $(busybox-dirs) $(patsubst %/,%,$(filter %/, \
+ $(core-n) $(core-) $(libs-n) $(libs-) \
+ )))
+
+core-y := $(patsubst %/, %/built-in.o, $(core-y))
+libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
+libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
+libs-y := $(libs-y1) $(libs-y2)
+
+# Build busybox
+# ---------------------------------------------------------------------------
+# busybox is build from the objects selected by $(busybox-init) and
+# $(busybox-main). Most are built-in.o files from top-level directories
+# in the kernel tree, others are specified in arch/$(ARCH)Makefile.
+# Ordering when linking is important, and $(busybox-init) must be first.
+#
+# busybox
+# ^
+# |
+# +-< $(busybox-init)
+# | +--< init/version.o + more
+# |
+# +--< $(busybox-main)
+# | +--< driver/built-in.o mm/built-in.o + more
+# |
+# +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
+#
+# busybox version (uname -v) cannot be updated during normal
+# descending-into-subdirs phase since we do not yet know if we need to
+# update busybox.
+# Therefore this step is delayed until just before final link of busybox -
+# except in the kallsyms case where it is done just before adding the
+# symbols to the kernel.
+#
+# System.map is generated to document addresses of all kernel symbols
+
+busybox-all := $(core-y) $(libs-y)
+
+# Rule to link busybox - also used during CONFIG_KALLSYMS
+# May be overridden by arch/$(ARCH)/Makefile
+quiet_cmd_busybox__ ?= LINK $@
+ cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) $(LDFLAGS) \
+ -o $@ -Wl,-M \
+ -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
+ -Wl,--start-group $(busybox-all) -Wl,--end-group
+
+# Generate System.map
+quiet_cmd_sysmap = SYSMAP
+ cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
+
+# Link of busybox
+# If CONFIG_KALLSYMS is set .version is already updated
+# Generate System.map and verify that the content is consistent
+# Use + in front of the busybox_version rule to silent warning with make -j2
+# First command is ':' to allow us to use + in front of the rule
+define rule_busybox__
+ :
+ $(call cmd,busybox__)
+ $(Q)echo 'cmd_$@ := $(cmd_busybox__)' > $(@D)/.$(@F).cmd
+endef
+
+
+ifdef CONFIG_KALLSYMS
+# Generate section listing all symbols and add it into busybox $(kallsyms.o)
+# It's a three stage process:
+# o .tmp_busybox1 has all symbols and sections, but __kallsyms is
+# empty
+# Running kallsyms on that gives us .tmp_kallsyms1.o with
+# the right size - busybox version (uname -v) is updated during this step
+# o .tmp_busybox2 now has a __kallsyms section of the right size,
+# but due to the added section, some addresses have shifted.
+# From here, we generate a correct .tmp_kallsyms2.o
+# o The correct .tmp_kallsyms2.o is linked into the final busybox.
+# o Verify that the System.map from busybox matches the map from
+# .tmp_busybox2, just in case we did not generate kallsyms correctly.
+# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
+# .tmp_busybox3 and .tmp_kallsyms3.o. This is only meant as a
+# temporary bypass to allow the kernel to be built while the
+# maintainers work out what went wrong with kallsyms.
+
+ifdef CONFIG_KALLSYMS_EXTRA_PASS
+last_kallsyms := 3
+else
+last_kallsyms := 2
+endif
+
+kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
+
+define verify_kallsyms
+ $(Q)$(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \
+ $(cmd_sysmap) .tmp_busybox$(last_kallsyms) .tmp_System.map
+ $(Q)cmp -s System.map .tmp_System.map || \
+ (echo Inconsistent kallsyms data; \
+ echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \
+ rm .tmp_kallsyms* ; /bin/false )
+endef
+
+# Update busybox version before link
+# Use + in front of this rule to silent warning about make -j1
+# First command is ':' to allow us to use + in front of this rule
+cmd_ksym_ld = $(cmd_busybox__)
+define rule_ksym_ld
+ :
+ +$(call cmd,busybox_version)
+ $(call cmd,busybox__)
+ $(Q)echo 'cmd_$@ := $(cmd_busybox__)' > $(@D)/.$(@F).cmd
+endef
+
+# Generate .S file with all kernel symbols
+quiet_cmd_kallsyms = KSYM $@
+ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \
+ $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
+
+.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
+ $(call if_changed_dep,as_o_S)
+
+.tmp_kallsyms%.S: .tmp_busybox% $(KALLSYMS)
+ $(call cmd,kallsyms)
+
+# .tmp_busybox1 must be complete except kallsyms, so update busybox version
+.tmp_busybox1: $(busybox-lds) $(busybox-all) FORCE
+ $(call if_changed_rule,ksym_ld)
+
+.tmp_busybox2: $(busybox-lds) $(busybox-all) .tmp_kallsyms1.o FORCE
+ $(call if_changed,busybox__)
+
+.tmp_busybox3: $(busybox-lds) $(busybox-all) .tmp_kallsyms2.o FORCE
+ $(call if_changed,busybox__)
+
+# Needs to visit scripts/ before $(KALLSYMS) can be used.
+$(KALLSYMS): scripts ;
+
+# Generate some data for debugging strange kallsyms problems
+debug_kallsyms: .tmp_map$(last_kallsyms)
+
+.tmp_map%: .tmp_busybox% FORCE
+ ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@
+
+.tmp_map3: .tmp_map2
+
+.tmp_map2: .tmp_map1
+
+endif # ifdef CONFIG_KALLSYMS
+
+# busybox image - including updated kernel symbols
+busybox_unstripped: $(busybox-all) FORCE
+ $(call if_changed_rule,busybox__)
+ $(Q)rm -f .old_version
+
+busybox: busybox_unstripped
+ $(Q)$(STRIP) -s --remove-section=.note --remove-section=.comment \
+ busybox_unstripped -o $@
+
+# The actual objects are generated when descending,
+# make sure no implicit rule kicks in
+$(sort $(busybox-all)): $(busybox-dirs) ;
+
+# Handle descending into subdirectories listed in $(busybox-dirs)
+# Preset locale variables to speed up the build process. Limit locale
+# tweaks to this spot to avoid wrong language settings when running
+# make menuconfig etc.
+# Error messages still appears in the original language
+
+PHONY += $(busybox-dirs)
+$(busybox-dirs): prepare scripts
+ $(Q)$(MAKE) $(build)=$@
+
+# Build the kernel release string
+# The KERNELRELEASE is stored in a file named .kernelrelease
+# to be used when executing for example make install or make modules_install
+#
+# Take the contents of any files called localversion* and the config
+# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE.
+# LOCALVERSION from the command line override all of this
+
+nullstring :=
+space := $(nullstring) # end of line
+
+___localver = $(objtree)/localversion* $(srctree)/localversion*
+__localver = $(sort $(wildcard $(___localver)))
+# skip backup files (containing '~')
+_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f)))
+
+localver = $(subst $(space),, \
+ $(shell cat /dev/null $(_localver)) \
+ $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
+
+# If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called
+# and if the SCM is know a tag from the SCM is appended.
+# The appended tag is determinded by the SCM used.
+#
+# Currently, only git is supported.
+# Other SCMs can edit scripts/setlocalversion and add the appropriate
+# checks as needed.
+ifdef CONFIG_LOCALVERSION_AUTO
+ _localver-auto = $(shell $(CONFIG_SHELL) \
+ $(srctree)/scripts/setlocalversion $(srctree))
+ localver-auto = $(LOCALVERSION)$(_localver-auto)
+endif
+
+localver-full = $(localver)$(localver-auto)
+
+# Store (new) KERNELRELASE string in .kernelrelease
+kernelrelease = $(KERNELVERSION)$(localver-full)
+.kernelrelease: FORCE
+ $(Q)rm -f $@
+ $(Q)echo $(kernelrelease) > $@
+
+
+# Things we need to do before we recursively start building the kernel
+# or the modules are listed in "prepare".
+# A multi level approach is used. prepareN is processed before prepareN-1.
+# archprepare is used in arch Makefiles and when processed asm symlink,
+# version.h and scripts_basic is processed / created.
+
+# Listed in dependency order
+PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
+
+# prepare-all is deprecated, use prepare as valid replacement
+PHONY += prepare-all
+
+# prepare3 is used to check if we are building in a separate output directory,
+# and if so do:
+# 1) Check that make has not been executed in the kernel src $(srctree)
+# 2) Create the include2 directory, used for the second asm symlink
+prepare3: .kernelrelease
+ifneq ($(KBUILD_SRC),)
+ @echo ' Using $(srctree) as source for kernel'
+ $(Q)if [ -f $(srctree)/.config ]; then \
+ echo " $(srctree) is not clean, please run 'make mrproper'";\
+ echo " in the '$(srctree)' directory.";\
+ /bin/false; \
+ fi;
+ $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
+ $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
+endif
+
+# prepare2 creates a makefile if using a separate output directory
+prepare2: prepare3 outputmakefile
+
+prepare1: prepare2 include/config/MARKER
+ifneq ($(KBUILD_MODULES),)
+ $(Q)mkdir -p $(MODVERDIR)
+ $(Q)rm -f $(MODVERDIR)/*
+endif
+
+archprepare: prepare1 scripts_basic
+
+prepare0: archprepare FORCE
+ $(Q)$(MAKE) $(build)=.
+
+# All the preparing..
+prepare prepare-all: prepare0
+
+# Leave this as default for preprocessing busybox.lds.S, which is now
+# done in arch/$(ARCH)/kernel/Makefile
+
+export CPPFLAGS_busybox.lds += -P -C -U$(ARCH)
+
+# FIXME: The asm symlink changes when $(ARCH) changes. That's
+# hard to detect, but I suppose "make mrproper" is a good idea
+# before switching between archs anyway.
+
+#bbox# include/asm:
+#bbox# @echo ' SYMLINK $@ -> include/asm-$(ARCH)'
+#bbox# $(Q)if [ ! -d include ]; then mkdir -p include; fi;
+#bbox# @ln -fsn asm-$(ARCH) $@
+
+# Split autoconf.h into include/linux/config/*
+quiet_cmd_gen_bbconfigopts = GEN include/bbconfigopts.h
+ cmd_gen_bbconfigopts = $(srctree)/scripts/mkconfigs > include/bbconfigopts.h
+quiet_cmd_split_autoconf = SPLIT include/autoconf.h -> include/config/*
+ cmd_split_autoconf = scripts/basic/split-include include/autoconf.h include/config
+#bbox# piggybacked generation of few .h files
+include/config/MARKER: scripts/basic/split-include include/autoconf.h
+ $(call cmd,split_autoconf)
+ $(call cmd,gen_bbconfigopts)
+ @touch $@
+
+# Generate some files
+# ---------------------------------------------------------------------------
+
+# KERNELRELEASE can change from a few different places, meaning version.h
+# needs to be updated, so this check is forced on all builds
+
+uts_len := 64
+
+define filechk_version.h
+ if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
+ echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
+ exit 1; \
+ fi; \
+ (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
+ echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
+ echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
+ )
+endef
+
+# ---------------------------------------------------------------------------
+
+PHONY += depend dep
+depend dep:
+ @echo '*** Warning: make $@ is unnecessary now.'
+
+# ---------------------------------------------------------------------------
+# Modules
+
+ifdef CONFIG_MODULES
+
+# By default, build modules as well
+
+all: modules
+
+# Build modules
+
+PHONY += modules
+modules: $(busybox-dirs) $(if $(KBUILD_BUILTIN),busybox)
+ @echo ' Building modules, stage 2.';
+ $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
+
+
+# Target to prepare building external modules
+PHONY += modules_prepare
+modules_prepare: prepare scripts
+
+# Target to install modules
+PHONY += modules_install
+modules_install: _modinst_ _modinst_post
+
+PHONY += _modinst_
+_modinst_:
+ @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
+ echo "Warning: you may need to install module-init-tools"; \
+ echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
+ sleep 1; \
+ fi
+ @rm -rf $(MODLIB)/kernel
+ @rm -f $(MODLIB)/source
+ @mkdir -p $(MODLIB)/kernel
+ @ln -s $(srctree) $(MODLIB)/source
+ @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
+ rm -f $(MODLIB)/build ; \
+ ln -s $(objtree) $(MODLIB)/build ; \
+ fi
+ $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
+
+# If System.map exists, run depmod. This deliberately does not have a
+# dependency on System.map since that would run the dependency tree on
+# busybox. This depmod is only for convenience to give the initial
+# boot a modules.dep even before / is mounted read-write. However the
+# boot script depmod is the master version.
+ifeq "$(strip $(INSTALL_MOD_PATH))" ""
+depmod_opts :=
+else
+depmod_opts := -b $(INSTALL_MOD_PATH) -r
+endif
+PHONY += _modinst_post
+_modinst_post: _modinst_
+ if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
+
+else # CONFIG_MODULES
+
+# Modules not configured
+# ---------------------------------------------------------------------------
+
+modules modules_install: FORCE
+ @echo
+ @echo "The present busybox configuration has modules disabled."
+ @echo "Type 'make config' and enable loadable module support."
+ @echo "Then build a kernel with module support enabled."
+ @echo
+ @exit 1
+
+endif # CONFIG_MODULES
+
+###
+# Cleaning is done on three levels.
+# make clean Delete most generated files
+# Leave enough to build external modules
+# make mrproper Delete the current configuration, and all generated files
+# make distclean Remove editor backup files, patch leftover files and the like
+
+# Directories & files removed with 'make clean'
+CLEAN_DIRS += $(MODVERDIR)
+CLEAN_FILES += busybox* System.map .kernelrelease \
+ .tmp_kallsyms* .tmp_version .tmp_busybox* .tmp_System.map
+
+# Directories & files removed with 'make mrproper'
+MRPROPER_DIRS += include/config include2
+MRPROPER_FILES += .config .config.old include/asm .version .old_version \
+ include/autoconf.h \
+ include/bbconfigopts.h \
+ include/usage_compressed.h \
+ .kernelrelease Module.symvers tags TAGS cscope*
+
+# clean - Delete most, but leave enough to build external modules
+#
+clean: rm-dirs := $(CLEAN_DIRS)
+clean: rm-files := $(CLEAN_FILES)
+clean-dirs := $(addprefix _clean_,$(srctree) $(busybox-alldirs))
+
+PHONY += $(clean-dirs) clean archclean
+$(clean-dirs):
+ $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
+
+clean: archclean $(clean-dirs)
+ $(call cmd,rmdirs)
+ $(call cmd,rmfiles)
+ @find . $(RCS_FIND_IGNORE) \
+ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
+ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
+ -type f -print | xargs rm -f
+
+# mrproper - Delete all generated files, including .config
+#
+mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
+mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
+mrproper-dirs := $(addprefix _mrproper_,scripts)
+
+PHONY += $(mrproper-dirs) mrproper archmrproper
+$(mrproper-dirs):
+ $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
+
+mrproper: clean archmrproper $(mrproper-dirs)
+ $(call cmd,rmdirs)
+ $(call cmd,rmfiles)
+
+# distclean
+#
+PHONY += distclean
+
+distclean: mrproper
+ @find $(srctree) $(RCS_FIND_IGNORE) \
+ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
+ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
+ -o -name '.*.rej' -o -size 0 \
+ -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
+ -type f -print | xargs rm -f
+
+
+# Packaging of the kernel to various formats
+# ---------------------------------------------------------------------------
+# rpm target kept for backward compatibility
+package-dir := $(srctree)/scripts/package
+
+%pkg: FORCE
+ $(Q)$(MAKE) $(build)=$(package-dir) $@
+rpm: FORCE
+ $(Q)$(MAKE) $(build)=$(package-dir) $@
+
+
+# Brief documentation of the typical targets used
+# ---------------------------------------------------------------------------
+
+boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig)
+boards := $(notdir $(boards))
+
+-include $(srctree)/Makefile.help
+
+# Documentation targets
+# ---------------------------------------------------------------------------
+%docs: scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=Documentation/DocBook $@
+
+else # KBUILD_EXTMOD
+
+###
+# External module support.
+# When building external modules the kernel used as basis is considered
+# read-only, and no consistency checks are made and the make
+# system is not used on the basis kernel. If updates are required
+# in the basis kernel ordinary make commands (without M=...) must
+# be used.
+#
+# The following are the only valid targets when building external
+# modules.
+# make M=dir clean Delete all automatically generated files
+# make M=dir modules Make all modules in specified dir
+# make M=dir Same as 'make M=dir modules'
+# make M=dir modules_install
+# Install the modules build in the module directory
+# Assumes install directory is already created
+
+# We are always building modules
+KBUILD_MODULES := 1
+PHONY += crmodverdir
+crmodverdir:
+ $(Q)mkdir -p $(MODVERDIR)
+ $(Q)rm -f $(MODVERDIR)/*
+
+PHONY += $(objtree)/Module.symvers
+$(objtree)/Module.symvers:
+ @test -e $(objtree)/Module.symvers || ( \
+ echo; \
+ echo " WARNING: Symbol version dump $(objtree)/Module.symvers"; \
+ echo " is missing; modules will have no dependencies and modversions."; \
+ echo )
+
+module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
+PHONY += $(module-dirs) modules
+$(module-dirs): crmodverdir $(objtree)/Module.symvers
+ $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
+
+modules: $(module-dirs)
+ @echo ' Building modules, stage 2.';
+ $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
+
+PHONY += modules_install
+modules_install: _emodinst_ _emodinst_post
+
+install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
+PHONY += _emodinst_
+_emodinst_:
+ $(Q)mkdir -p $(MODLIB)/$(install-dir)
+ $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
+
+# Run depmod only is we have System.map and depmod is executable
+quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
+ cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
+ $(DEPMOD) -ae -F System.map \
+ $(if $(strip $(INSTALL_MOD_PATH)), \
+ -b $(INSTALL_MOD_PATH) -r) \
+ $(KERNELRELEASE); \
+ fi
+
+PHONY += _emodinst_post
+_emodinst_post: _emodinst_
+ $(call cmd,depmod)
+
+clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
+
+PHONY += $(clean-dirs) clean
+$(clean-dirs):
+ $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
+
+clean: rm-dirs := $(MODVERDIR)
+clean: $(clean-dirs)
+ $(call cmd,rmdirs)
+ @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
+ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
+ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
+ -type f -print | xargs rm -f
+
+help:
+ @echo ' Building external modules.'
+ @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target'
+ @echo ''
+ @echo ' modules - default target, build the module(s)'
+ @echo ' modules_install - install the module'
+ @echo ' clean - remove generated files in module directory only'
+ @echo ''
+
+# Dummies...
+PHONY += prepare scripts
+prepare: ;
+scripts: ;
+endif # KBUILD_EXTMOD
+
+# Generate tags for editors
+# ---------------------------------------------------------------------------
+
+#We want __srctree to totally vanish out when KBUILD_OUTPUT is not set
+#(which is the most common case IMHO) to avoid unneeded clutter in the big tags file.
+#Adding $(srctree) adds about 20M on i386 to the size of the output file!
+
+ifeq ($(src),$(obj))
+__srctree =
+else
+__srctree = $(srctree)/
+endif
+
+ifeq ($(ALLSOURCE_ARCHS),)
+ifeq ($(ARCH),um)
+ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH)
+else
+ALLINCLUDE_ARCHS := $(ARCH)
+endif
+else
+#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
+ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
+endif
+
+ALLSOURCE_ARCHS := $(ARCH)
+
+define all-sources
+ ( find $(__srctree) $(RCS_FIND_IGNORE) \
+ \( -name include -o -name arch \) -prune -o \
+ -name '*.[chS]' -print; \
+ for ARCH in $(ALLSOURCE_ARCHS) ; do \
+ find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \
+ -name '*.[chS]' -print; \
+ done ; \
+ find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
+ -name '*.[chS]' -print; \
+ find $(__srctree)include $(RCS_FIND_IGNORE) \
+ \( -name config -o -name 'asm-*' \) -prune \
+ -o -name '*.[chS]' -print; \
+ for ARCH in $(ALLINCLUDE_ARCHS) ; do \
+ find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \
+ -name '*.[chS]' -print; \
+ done ; \
+ find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
+ -name '*.[chS]' -print )
+endef
+
+quiet_cmd_cscope-file = FILELST cscope.files
+ cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
+
+quiet_cmd_cscope = MAKE cscope.out
+ cmd_cscope = cscope -b
+
+cscope: FORCE
+ $(call cmd,cscope-file)
+ $(call cmd,cscope)
+
+quiet_cmd_TAGS = MAKE $@
+define cmd_TAGS
+ rm -f $@; \
+ ETAGSF=`etags --version | grep -i exuberant >/dev/null && \
+ echo "-I __initdata,__exitdata,__acquires,__releases \
+ -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
+ --extra=+f --c-kinds=+px"`; \
+ $(all-sources) | xargs etags $$ETAGSF -a
+endef
+
+TAGS: FORCE
+ $(call cmd,TAGS)
+
+
+quiet_cmd_tags = MAKE $@
+define cmd_tags
+ rm -f $@; \
+ CTAGSF=`ctags --version | grep -i exuberant >/dev/null && \
+ echo "-I __initdata,__exitdata,__acquires,__releases \
+ -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
+ --extra=+f --c-kinds=+px"`; \
+ $(all-sources) | xargs ctags $$CTAGSF -a
+endef
+
+tags: FORCE
+ $(call cmd,tags)
+
+
+# Scripts to check various things for consistency
+# ---------------------------------------------------------------------------
+
+includecheck:
+ find * $(RCS_FIND_IGNORE) \
+ -name '*.[hcS]' -type f -print | sort \
+ | xargs $(PERL) -w scripts/checkincludes.pl
+
+versioncheck:
+ find * $(RCS_FIND_IGNORE) \
+ -name '*.[hcS]' -type f -print | sort \
+ | xargs $(PERL) -w scripts/checkversion.pl
+
+namespacecheck:
+ $(PERL) $(srctree)/scripts/namespace.pl
+
+endif #ifeq ($(config-targets),1)
+endif #ifeq ($(mixed-targets),1)
+
+PHONY += checkstack
+checkstack:
+ $(OBJDUMP) -d busybox $$(find . -name '*.ko') | \
+ $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
+
+kernelrelease:
+ $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \
+ $(error kernelrelease not valid - run 'make *config' to update it))
+kernelversion:
+ @echo $(KERNELVERSION)
+
+# Single targets
+# ---------------------------------------------------------------------------
+# Single targets are compatible with:
+# - build whith mixed source and output
+# - build with separate output dir 'make O=...'
+# - external modules
+#
+# target-dir => where to store outputfile
+# build-dir => directory in kernel source tree to use
+
+ifeq ($(KBUILD_EXTMOD),)
+ build-dir = $(patsubst %/,%,$(dir $@))
+ target-dir = $(dir $@)
+else
+ zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
+ build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
+ target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
+endif
+
+%.s: %.c prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.i: %.c prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.o: %.c prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.lst: %.c prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.s: %.S prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+%.o: %.S prepare scripts FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+
+# Modules
+/ %/: prepare scripts FORCE
+ $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
+ $(build)=$(build-dir)
+%.ko: prepare scripts FORCE
+ $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
+ $(build)=$(build-dir) $(@:.ko=.o)
+ $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
+
+# FIXME Should go into a make.lib or something
+# ===========================================================================
+
+quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
+ cmd_rmdirs = rm -rf $(rm-dirs)
+
+quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
+ cmd_rmfiles = rm -f $(rm-files)
+
+
+a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \
+ $(NOSTDINC_FLAGS) $(CPPFLAGS) \
+ $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
+
+quiet_cmd_as_o_S = AS $@
+cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
+
+# read all saved command lines
+
+targets := $(wildcard $(sort $(targets)))
+cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
+
+ifneq ($(cmd_files),)
+ $(cmd_files): ; # Do not try to update included dependency files
+ include $(cmd_files)
+endif
+
+# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
+# Usage:
+# $(Q)$(MAKE) $(clean)=dir
+clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
+
+endif # skip-makefile
+
+PHONY += FORCE
+FORCE:
+
+-include $(srctree)/Makefile.custom
+
+# Declare the contents of the .PHONY variable as phony. We keep that
+# information in a variable se we can use it in if_changed and friends.
+.PHONY: $(PHONY)
diff --git a/i/pc104/initrd/conf/busybox/Makefile.custom b/i/pc104/initrd/conf/busybox/Makefile.custom
new file mode 100644
index 0000000..0cc40a6
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/Makefile.custom
@@ -0,0 +1,145 @@
+# ==========================================================================
+# Build system
+# ==========================================================================
+
+%.bflt: %_unstripped
+ $(CROSS_COMPILE)elf2flt $(ELF2FLTFLAGS) $< -o $@
+
+busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h $(srctree)/include/applets.h
+ $(Q)-$(SHELL) $^ >$@
+
+.PHONY: install
+ifeq ($(CONFIG_INSTALL_APPLET_SYMLINKS),y)
+INSTALL_OPTS:= --symlinks
+endif
+ifeq ($(CONFIG_INSTALL_APPLET_HARDLINKS),y)
+INSTALL_OPTS:= --hardlinks
+endif
+install: $(srctree)/applets/install.sh busybox busybox.links
+ $(Q)DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
+ $(SHELL) $< $(CONFIG_PREFIX) $(INSTALL_OPTS)
+ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
+ @echo
+ @echo
+ @echo --------------------------------------------------
+ @echo You will probably need to make your busybox binary
+ @echo setuid root to ensure all configured applets will
+ @echo work properly.
+ @echo --------------------------------------------------
+ @echo
+endif
+
+uninstall: busybox.links
+ rm -f $(CONFIG_PREFIX)/bin/busybox
+ for i in `cat busybox.links` ; do rm -f $(CONFIG_PREFIX)$$i; done
+ifneq ($(strip $(DO_INSTALL_LIBS)),n)
+ for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
+ rm -f $(CONFIG_PREFIX)$$i; \
+ done
+endif
+
+check test: busybox busybox.links
+ bindir=$(objtree) srcdir=$(srctree)/testsuite SED="$(SED)" \
+ $(SHELL) $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)
+
+.PHONY: release
+release: distclean
+ cd ..; \
+ rm -r -f busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION); \
+ cp -a busybox busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) && { \
+ find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type d \
+ -name .svn \
+ -print \
+ -exec rm -r -f {} \; ; \
+ find busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ -type f \
+ -name .\#* \
+ -print \
+ -exec rm -f {} \; ; \
+ tar -czf busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION).tar.gz \
+ busybox-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)/ ; }
+
+.PHONY: checkhelp
+checkhelp:
+ $(Q)$(srctree)/scripts/checkhelp.awk \
+ $(patsubst %,$(srctree)/%,$(wildcard $(patsubst %,%/Config.in,$(busybox-dirs) ./)))
+
+.PHONY: sizes
+sizes: busybox_unstripped
+ $(NM) --size-sort $(<)
+
+.PHONY: bloatcheck
+bloatcheck: busybox_old busybox_unstripped
+ @$(srctree)/scripts/bloat-o-meter busybox_old busybox_unstripped
+
+.PHONY: baseline
+baseline: busybox_unstripped
+ @mv busybox_unstripped busybox_old
+
+.PHONY: objsizes
+objsizes: busybox_unstripped
+ $(srctree)/scripts/objsizes
+
+.PHONY: bigdata
+bigdata: busybox_unstripped
+ nm --size-sort busybox_unstripped | grep -vi ' [tr] ' | tail -20
+
+# Documentation Targets
+.PHONY: doc
+doc: docs/busybox.pod docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html
+
+docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
+ $(srctree)/include/usage.h \
+ $(srctree)/docs/busybox_footer.pod \
+ $(srctree)/docs/autodocifier.pl
+ $(disp_doc)
+ $(Q)-mkdir -p docs
+ $(Q)-( cat $(srctree)/docs/busybox_header.pod ; \
+ $(srctree)/docs/autodocifier.pl $(srctree)/include/usage.h ; \
+ cat $(srctree)/docs/busybox_footer.pod ; ) > docs/busybox.pod
+
+docs/BusyBox.txt: docs/busybox.pod
+ $(disp_doc)
+ $(Q)-mkdir -p docs
+ $(Q)-pod2text $< > $@
+
+docs/BusyBox.1: docs/busybox.pod
+ $(disp_doc)
+ $(Q)-mkdir -p docs
+ $(Q)-pod2man --center=BusyBox --release="version $(VERSION)" \
+ $< > $@
+
+docs/BusyBox.html: docs/busybox.net/BusyBox.html
+ $(disp_doc)
+ $(Q)-mkdir -p docs
+ $(Q)-rm -f docs/BusyBox.html
+ $(Q)-cp docs/busybox.net/BusyBox.html docs/BusyBox.html
+
+docs/busybox.net/BusyBox.html: docs/busybox.pod
+ $(Q)-mkdir -p docs/busybox.net
+ $(Q)-pod2html --noindex $< > \
+ docs/busybox.net/BusyBox.html
+ $(Q)-rm -f pod2htm*
+
+# documentation, cross-reference
+# Modern distributions already ship synopsis packages (e.g. debian)
+# If you have an old distribution go to http://synopsis.fresco.org/
+syn_tgt = $(wildcard $(patsubst %,%/*.c,$(busybox-alldirs)))
+syn = $(patsubst %.c, %.syn, $(syn_tgt))
+
+comma:= ,
+brace_open:= (
+brace_close:= )
+
+SYN_CPPFLAGS := $(strip $(CPPFLAGS) $(EXTRA_CPPFLAGS))
+SYN_CPPFLAGS := $(subst $(brace_open),\$(brace_open),$(SYN_CPPFLAGS))
+SYN_CPPFLAGS := $(subst $(brace_close),\$(brace_close),$(SYN_CPPFLAGS))
+#SYN_CPPFLAGS := $(subst ",\",$(SYN_CPPFLAGS))
+#")
+#SYN_CPPFLAGS := [$(patsubst %,'%'$(comma),$(SYN_CPPFLAGS))'']
+
+%.syn: %.c
+ synopsis -p C -l Comments.SSDFilter,Comments.Previous -Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<
+
+.PHONY: html
+html: $(syn)
+ synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
diff --git a/i/pc104/initrd/conf/busybox/Makefile.flags b/i/pc104/initrd/conf/busybox/Makefile.flags
new file mode 100644
index 0000000..b7711f6
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/Makefile.flags
@@ -0,0 +1,61 @@
+# ==========================================================================
+# Build system
+# ==========================================================================
+
+BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+
+# -std=gnu99 needed for [U]LLONG_MAX on some systems
+CPPFLAGS += $(call cc-option,-std=gnu99,)
+
+CPPFLAGS += \
+ -Iinclude -Ilibbb \
+ $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) -I$(srctree)/libbb \
+ -include include/autoconf.h \
+ -D_GNU_SOURCE -DNDEBUG \
+ $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \
+ -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP
+
+# flag checks are grouped together to speed the checks up a bit..
+CFLAGS += $(call cc-option,-Wall -Wshadow -Wwrite-strings,)
+CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,)
+# If you want to add "-Wmissing-prototypes -Wmissing-declarations" above
+# (or anything else for that matter) make sure that it is still possible
+# to build bbox without warnings. Current offender: find.c:alloc_action().
+# Looks more like gcc bug: gcc will warn on it with or without prototype.
+# But still, warning-free compile is a must, or else we will drown
+# in warnings pretty soon.
+
+ifeq ($(CONFIG_WERROR),y)
+CFLAGS += $(call cc-option,-Werror,)
+endif
+# gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
+CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
+
+# gcc emits bogus "no prev proto" warning on find.c:alloc_action()
+ifneq ($(CONFIG_WERROR),y)
+CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
+endif
+
+CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,)
+# -fno-guess-branch-probability: prohibit pseudo-random guessing
+# of branch probabilities (hopefully makes bloatcheck more stable):
+CFLAGS += $(call cc-option,-fno-guess-branch-probability,)
+CFLAGS += $(call cc-option,-funsigned-char -static-libgcc,)
+CFLAGS += $(call cc-option,-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1,)
+
+# FIXME: These warnings are at least partially to be concerned about and should
+# be fixed..
+#CFLAGS+=$(call cc-option,-Wconversion,)
+
+ifeq ($(CONFIG_DEBUG),y)
+CFLAGS += $(call cc-option,-g)
+endif
+
+ifeq ($(CONFIG_STATIC),y)
+LDFLAGS += -static
+endif
+
+ifeq ($(CONFIG_SELINUX),y)
+LDFLAGS += -lselinux -lsepol
+endif
+#LDFLAGS += -nostdlib
diff --git a/i/pc104/initrd/conf/busybox/Makefile.help b/i/pc104/initrd/conf/busybox/Makefile.help
new file mode 100644
index 0000000..fc661b1
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/Makefile.help
@@ -0,0 +1,42 @@
+# ==========================================================================
+# Build system
+# ==========================================================================
+
+help:
+ @echo 'Cleaning:'
+ @echo ' clean - delete temporary files created by build'
+ @echo ' distclean - delete all non-source files (including .config)'
+ @echo
+ @echo 'Build:'
+ @echo ' all - Executable and documentation'
+ @echo ' busybox - the swiss-army executable'
+ @echo ' doc - docs/BusyBox.{txt,html,1}'
+ @echo ' html - create html-based cross-reference'
+ @echo
+ @echo 'Configuration:'
+ @echo ' allnoconfig - disable all symbols in .config'
+ @echo ' allyesconfig - enable all symbols in .config (see defconfig)'
+ @echo ' allbareconfig - enable all applets without any sub-features'
+ @echo ' config - text based configurator (of last resort)'
+ @echo ' defconfig - set .config to largest generic configuration'
+ @echo ' menuconfig - interactive curses-based configurator'
+ @echo ' oldconfig - resolve any unresolved symbols in .config'
+ @echo ' hosttools - build sed for the host.'
+ @echo ' You can use these commands if the commands on the host'
+ @echo ' is unusable. Afterwards use it like:'
+ @echo ' make SED="$(objtree)/sed"'
+ @echo
+ @echo 'Installation:'
+ @echo ' install - install busybox into $(CONFIG_PREFIX)'
+ @echo ' uninstall'
+ @echo
+ @echo 'Development:'
+ @echo ' baseline - create busybox_old for bloatcheck.'
+ @echo ' bloatcheck - show size difference between old and new versions'
+ @echo ' check - run the test suite for all applets'
+ @echo ' checkhelp - check for missing help-entries in Config.in'
+ @echo ' randconfig - generate a random configuration'
+ @echo ' release - create a distribution tarball'
+ @echo ' sizes - show size of all enabled busybox symbols'
+ @echo ' objsizes - show size of each .o object built'
+ @echo
diff --git a/i/pc104/initrd/conf/busybox/README b/i/pc104/initrd/conf/busybox/README
new file mode 100644
index 0000000..96ca0bb
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/README
@@ -0,0 +1,198 @@
+Please see the LICENSE file for details on copying and usage.
+Please refer to the INSTALL file for instructions on how to build.
+
+What is busybox:
+
+ BusyBox combines tiny versions of many common UNIX utilities into a single
+ small executable. It provides minimalist replacements for most of the
+ utilities you usually find in bzip2, coreutils, dhcp, diffutils, e2fsprogs,
+ file, findutils, gawk, grep, inetutils, less, modutils, net-tools, procps,
+ sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The utilities
+ in BusyBox often have fewer options than their full-featured cousins;
+ however, the options that are included provide the expected functionality
+ and behave very much like their larger counterparts.
+
+ BusyBox has been written with size-optimization and limited resources in
+ mind, both to produce small binaries and to reduce run-time memory usage.
+ Busybox is also extremely modular so you can easily include or exclude
+ commands (or features) at compile time. This makes it easy to customize
+ embedded systems; to create a working system, just add /dev, /etc, and a
+ Linux kernel. Busybox (usually together with uClibc) has also been used as
+ a component of "thin client" desktop systems, live-CD distributions, rescue
+ disks, installers, and so on.
+
+ BusyBox provides a fairly complete POSIX environment for any small system,
+ both embedded environments and more full featured systems concerned about
+ space. Busybox is slowly working towards implementing the full Single Unix
+ Specification V3 (http://www.opengroup.org/onlinepubs/009695399/), but isn't
+ there yet (and for size reasons will probably support at most UTF-8 for
+ internationalization). We are also interested in passing the Linux Test
+ Project (http://ltp.sourceforge.net).
+
+----------------
+
+Using busybox:
+
+ BusyBox is extremely configurable. This allows you to include only the
+ components and options you need, thereby reducing binary size. Run 'make
+ config' or 'make menuconfig' to select the functionality that you wish to
+ enable. (See 'make help' for more commands.)
+
+ The behavior of busybox is determined by the name it's called under: as
+ "cp" it behaves like cp, as "sed" it behaves like sed, and so on. Called
+ as "busybox" it takes the second argument as the name of the applet to
+ run (I.E. "./busybox ls -l /proc").
+
+ The "standalone shell" mode is an easy way to try out busybox; this is a
+ command shell that calls the builtin applets without needing them to be
+ installed in the path. (Note that this requires /proc to be mounted, if
+ testing from a boot floppy or in a chroot environment.)
+
+ The build automatically generates a file "busybox.links", which is used by
+ 'make install' to create symlinks to the BusyBox binary for all compiled in
+ commands. This uses the CONFIG_PREFIX environment variable to specify
+ where to install, and installs hardlinks or symlinks depending
+ on the configuration preferences. (You can also manually run
+ the install script at "applets/install.sh").
+
+----------------
+
+Downloading the current source code:
+
+ Source for the latest released version, as well as daily snapshots, can always
+ be downloaded from
+
+ http://busybox.net/downloads/
+
+ You can browse the up to the minute source code and change history online.
+
+ http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/
+
+ Anonymous SVN access is available. For instructions, check out:
+
+ http://busybox.net/subversion.html
+
+ For those that are actively contributing and would like to check files in,
+ see:
+
+ http://busybox.net/developer.html
+
+ The developers also have a bug and patch tracking system
+ (http://bugs.busybox.net) although posting a bug/patch to the mailing list
+ is generally a faster way of getting it fixed, and the complete archive of
+ what happened is the subversion changelog.
+
+----------------
+
+getting help:
+
+ when you find you need help, you can check out the busybox mailing list
+ archives at http://busybox.net/lists/busybox/ or even join
+ the mailing list if you are interested.
+
+----------------
+
+bugs:
+
+ if you find bugs, please submit a detailed bug report to the busybox mailing
+ list at busybox@busybox.net. a well-written bug report should include a
+ transcript of a shell session that demonstrates the bad behavior and enables
+ anyone else to duplicate the bug on their own machine. the following is such
+ an example:
+
+ to: busybox@busybox.net
+ from: diligent@testing.linux.org
+ subject: /bin/date doesn't work
+
+ package: busybox
+ version: 1.00
+
+ when i execute busybox 'date' it produces unexpected results.
+ with gnu date i get the following output:
+
+ $ date
+ fri oct 8 14:19:41 mdt 2004
+
+ but when i use busybox date i get this instead:
+
+ $ date
+ illegal instruction
+
+ i am using debian unstable, kernel version 2.4.25-vrs2 on a netwinder,
+ and the latest uclibc from cvs. thanks for the wonderful program!
+
+ -diligent
+
+ note the careful description and use of examples showing not only what
+ busybox does, but also a counter example showing what an equivalent app
+ does (or pointing to the text of a relevant standard). Bug reports lacking
+ such detail may never be fixed... Thanks for understanding.
+
+----------------
+
+Portability:
+
+ Busybox is developed and tested on Linux 2.4 and 2.6 kernels, compiled
+ with gcc (the unit-at-a-time optimizations in version 3.4 and later are
+ worth upgrading to get, but older versions should work), and linked against
+ uClibc (0.9.27 or greater) or glibc (2.2 or greater). In such an
+ environment, the full set of busybox features should work, and if
+ anything doesn't we want to know about it so we can fix it.
+
+ There are many other environments out there, in which busybox may build
+ and run just fine. We just don't test them. Since busybox consists of a
+ large number of more or less independent applets, portability is a question
+ of which features work where. Some busybox applets (such as cat and rm) are
+ highly portable and likely to work just about anywhere, while others (such as
+ insmod and losetup) require recent Linux kernels with recent C libraries.
+
+ Earlier versions of Linux and glibc may or may not work, for any given
+ configuration. Linux 2.2 or earlier should mostly work (there's still
+ some support code in things like mount.c) but this is no longer regularly
+ tested, and inherently won't support certain features (such as long files
+ and --bind mounts). The same is true for glibc 2.0 and 2.1: expect a higher
+ testing and debugging burden using such old infrastructure. (The busybox
+ developers are not very interested in supporting these older versions, but
+ will probably accept small self-contained patches to fix simple problems.)
+
+ Some environments are not recommended. Early versions of uClibc were buggy
+ and missing many features: upgrade. Linking against libc5 or dietlibc is
+ not supported and not interesting to the busybox developers. (The first is
+ obsolete and has no known size or feature advantages over uClibc, the second
+ has known bugs that its developers have actively refused to fix.) Ancient
+ Linux kernels (2.0.x and earlier) are similarly uninteresting.
+
+ In theory it's possible to use Busybox under other operating systems (such as
+ MacOS X, Solaris, Cygwin, or the BSD Fork Du Jour). This generally involves
+ a different kernel and a different C library at the same time. While it
+ should be possible to port the majority of the code to work in one of
+ these environments, don't be suprised if it doesn't work out of the box. If
+ you're into that sort of thing, start small (selecting just a few applets)
+ and work your way up.
+
+ Shaun Jackman has recently (2005) ported busybox to a combination of newlib
+ and libgloss, and some of his patches have been integrated. This platform
+ may join glibc/uclibc and Linux as a supported combination with the 1.1
+ release, but is not supported in 1.0.
+
+Supported hardware:
+
+ BusyBox in general will build on any architecture supported by gcc. We
+ support both 32 and 64 bit platforms, and both big and little endian
+ systems.
+
+ Under 2.4 Linux kernels, kernel module loading was implemented in a
+ platform-specific manner. Busybox's insmod utility has been reported to
+ work under ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC, S390,
+ SH3/4/5, Sparc, v850e, and x86_64. Anything else probably won't work.
+
+ The module loading mechanism for the 2.6 kernel is much more generic, and
+ we believe 2.6.x kernel module loading support should work on all
+ architectures supported by the kernel.
+
+----------------
+
+Please feed suggestions, bug reports, insults, and bribes back to the busybox
+maintainer:
+ Denis Vlasenko
+ <vda.linux@googlemail.com>
diff --git a/i/pc104/initrd/conf/busybox/TODO b/i/pc104/initrd/conf/busybox/TODO
new file mode 100644
index 0000000..1896928
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/TODO
@@ -0,0 +1,320 @@
+Busybox TODO
+
+Stuff that needs to be done. This is organized by who plans to get around to
+doing it eventually, but that doesn't mean they "own" the item. If you want to
+do one of these bounce an email off the person it's listed under to see if they
+have any suggestions how they plan to go about it, and to minimize conflicts
+between your work and theirs. But otherwise, all of these are fair game.
+
+Rob Landley <rob@landley.net>:
+ Add BB_NOMMU to platform.h and migrate __uClinux__ tests to that.
+ #if defined __UCLIBC__ && !defined __ARCH_USE_MMU__
+ Add a libbb/platform.c
+ Implement fdprintf() for platforms that haven't got one.
+ Implement bb_realpath() that can handle NULL on non-glibc.
+ Cleanup bb_asprintf()
+
+ Migrate calloc() and bb_calloc() occurrences to bb_xzalloc().
+ Remove obsolete _() wrapper crud for internationalization we don't do.
+ Figure out where we need utf8 support, and add it.
+
+ sh
+ The command shell situation is a big mess. We have three or four different
+ shells that don't really share any code, and the "standalone shell" doesn't
+ work all that well (especially not in a chroot environment), due to apps not
+ being reentrant. I'm writing a new shell (bbsh) to unify the various
+ shells and configurably add the minimal set of bash features people
+ actually use. The hardest part is it has to configure down as small as
+ lash while providing lash's features. The rest is easy in comparison.
+ bzip2
+ Compression-side support.
+ init
+ General cleanup (should use ENABLE_FEATURE_INIT_SYSLOG and ENABLE_FEATURE_INIT_DEBUG).
+ depmod
+ busybox lacks a way to update module deps when running from firmware without the
+ use of the depmod.pl (perl is to bloated for most embedded setups) and or orig
+ modutils. The orig depmod is rather pointless to have to add to a firmware image
+ in when we already have a insmod/rmmod and friends.
+ Unify base64 handling.
+ There's base64 encoding and decoding going on in:
+ networking/wget.c:base64enc()
+ coreutils/uudecode.c:read_base64()
+ coreutils/uuencode.c:tbl_base64[]
+ networking/httpd.c:decodeBase64()
+ And probably elsewhere. That needs to be unified into libbb functions.
+ Do a SUSv3 audit
+ Look at the full Single Unix Specification version 3 (available online at
+ "http://www.opengroup.org/onlinepubs/009695399/nfindex.html") and
+ figure out which of our apps are compliant, and what we're missing that
+ we might actually care about.
+
+ Even better would be some kind of automated compliance test harness that
+ exercises each command line option and the various corner cases.
+ Internationalization
+ How much internationalization should we do?
+
+ The low hanging fruit is UTF-8 character set support. We should do this.
+ (Vodz pointed out the shell's cmdedit as needing work here. What else?)
+
+ We also have lots of hardwired english text messages. Consolidating this
+ into some kind of message table not only makes translation easier, but
+ also allows us to consolidate redundant (or close) strings.
+
+ We probably don't want to be bloated with locale support. (Not unless we
+ can cleanly export it from our underlying C library without having to
+ concern ourselves with it directly. Perhaps a few specific things like a
+ config option for "date" are low hanging fruit here?)
+
+ What level should things happen at? How much do we care about
+ internationalizing the text console when X11 and xterms are so much better
+ at it? (There's some infrastructure here we don't implement: The
+ "unicode_start" and "unicode_stop" shell scripts need "vt-is-UTF8" and a
+ --unicode option to loadkeys. That implies a real loadkeys/dumpkeys
+ implementation to replace loadkmap/dumpkmap. Plus messing with console font
+ loading. Is it worth it, or do we just say "use X"?)
+
+ Individual compilation of applets.
+ It would be nice if busybox had the option to compile to individual applets,
+ for people who want an alternate implementation less bloated than the gnu
+ utils (or simply with less political baggage), but without it being one big
+ executable.
+
+ Turning libbb into a real dll is another possibility, especially if libbb
+ could export some of the other library interfaces we've already more or less
+ got the code for (like zlib).
+ buildroot - Make a "dogfood" option
+ Busybox 1.1 will be capable of replacing most gnu packages for real world
+ use, such as developing software or in a live CD. It needs wider testing.
+
+ Busybox should now be able to replace bzip2, coreutils, e2fsprogs, file,
+ findutils, gawk, grep, inetutils, less, modutils, net-tools, patch, procps,
+ sed, shadow, sysklogd, sysvinit, tar, util-linux, and vim. The resulting
+ system should be self-hosting (I.E. able to rebuild itself from source
+ code). This means it would need (at least) binutils, gcc, and make, or
+ equivalents.
+
+ It would be a good "eating our own dogfood" test if buildroot had the option
+ of using a "make allyesconfig" busybox instead of the all of the above
+ packages. Anything that's wrong with the resulting system, we can fix. (It
+ would be nice to be able to upgrade busybox to be able to replace bash and
+ diffutils as well, but we're not there yet.)
+
+ One example of an existing system that does this already is Firmware Linux:
+ http://www.landley.net/code/firmware
+ initramfs
+ Busybox should have a sample initramfs build script. This depends on
+ bbsh, mdev, and switch_root.
+ mkdep
+ Write a mkdep that doesn't segfault if there's a directory it doesn't
+ have permission to read, isn't based on manually editing the output of
+ lexx and yacc, doesn't make such a mess under include/config, etc.
+ Group globals into unions of structures.
+ Go through and turn all the global and static variables into structures,
+ and have all those structures be in a big union shared between processes,
+ so busybox uses less bss. (This is a big win on nommu machines.) See
+ sed.c and mdev.c for examples.
+ Go through bugs.busybox.net and close out all of that somehow.
+ This one's open to everybody, but I'll wind up doing it...
+
+
+Bernhard Fischer <busybox@busybox.net> suggests to look at these:
+ New debug options:
+ -Wlarger-than-127
+ Cleanup any big users
+ -Wunused-parameter
+ Facilitate applet PROTOTYPES to provide means for having applets that
+ do a) not take any arguments b) need only one of argc or argv c) need
+ both argc and argv. All of these three options should go for the most
+ feature complete denominator.
+ Collate BUFSIZ IOBUF_SIZE MY_BUF_SIZE PIPE_PROGRESS_SIZE BUFSIZE PIPESIZE
+ make bb_common_bufsiz1 configurable, size wise.
+ make pipesize configurable, size wise.
+ Use bb_common_bufsiz1 throughout applets!
+
+As yet unclaimed:
+
+----
+find
+ doesn't understand (), lots of susv3 stuff.
+----
+diff
+ Make sure we handle empty files properly:
+ From the patch man page:
+
+ you can remove a file by sending out a context diff that compares
+ the file to be deleted with an empty file dated the Epoch. The
+ file will be removed unless patch is conforming to POSIX and the
+ -E or --remove-empty-files option is not given.
+---
+patch
+ Should have simple fuzz factor support to apply patches at an offset which
+ shouldn't take up too much space.
+
+ And while we're at it, a new patch filename quoting format is apparently
+ coming soon: http://marc.theaimsgroup.com/?l=git&m=112927316408690&w=2
+---
+ps / top
+ Add support for both RSS and VSIZE rather than just one or the other.
+ Or make it a build option.
+---
+man
+ It would be nice to have a man command. Not one that handles troff or
+ anything, just one that can handle preformatted ascii man pages, possibly
+ compressed. This could probably be a script in the extras directory that
+ calls cat/zcat/bzcat | less
+
+ (How doclifter might work into this is anybody's guess.)
+---
+ar
+ Write support?
+----
+stty / catv
+ stty's visible() function and catv's guts are identical. Merge them into
+ an appropriate libbb function.
+----
+struct suffix_mult
+ Several duplicate users of: grep -r "1024\*1024" * -B2 -A1
+ Merge to a single size_suffixes[] in libbb.
+ Users: head tail od_bloaty hexdump and (partially as it wouldn't hurt) svlogd
+
+Architectural issues:
+
+bb_close() with fsync()
+ We should have a bb_close() in place of normal close, with a CONFIG_ option
+ to not just check the return value of close() for an error, but fsync().
+ Close can't reliably report anything useful because if write() accepted the
+ data then it either went out to the network or it's in cache or a pipe
+ buffer. Either way, there's no guarantee it'll make it to its final
+ destination before close() gets called, so there's no guarantee that any
+ error will be reported.
+
+ You need to call fsync() if you care about errors that occur after write(),
+ but that can have a big performance impact. So make it a config option.
+---
+Unify archivers
+ Lots of archivers have the same general infrastructure. The directory
+ traversal code should be factored out, and the guts of each archiver could
+ be some setup code and a series of callbacks for "add this file",
+ "add this directory", "add this symlink" and so on.
+
+ This could clean up tar and zip, and make it cheaper to add cpio and ar
+ write support, and possibly even cheaply add things like mkisofs or
+ mksquashfs someday, if they become relevant.
+---
+Text buffer support.
+ Several existing applets (sort, vi, less...) read
+ a whole file into memory and act on it. There might be an opportunity
+ for shared code in there that could be moved into libbb...
+---
+Memory Allocation
+ We have a CONFIG_BUFFER mechanism that lets us select whether to do memory
+ allocation on the stack or the heap. Unfortunately, we're not using it much.
+ We need to audit our memory allocations and turn a lot of malloc/free calls
+ into RESERVE_CONFIG_BUFFER/RELEASE_CONFIG_BUFFER.
+ For a start, see e.g. make EXTRA_CFLAGS=-Wlarger-than-64
+
+ And while we're at it, many of the CONFIG_FEATURE_CLEAN_UP #ifdefs will be
+ optimized out by the compiler in the stack allocation case (since there's no
+ free for an alloca()), and this means that various cleanup loops that just
+ call free might also be optimized out by the compiler if written right, so
+ we can yank those #ifdefs too, and generally clean up the code.
+---
+Switch CONFIG_SYMBOLS to ENABLE_SYMBOLS
+
+ In busybox 1.0 and earlier, configuration was done by CONFIG_SYMBOLS
+ that were either defined or undefined to indicate whether the symbol was
+ selected in the .config file. They were used with #ifdefs, ala:
+
+ #ifdef CONFIG_SYMBOL
+ if (other_test) {
+ do_code();
+ }
+ #endif
+
+ In 1.1, we have new ENABLE_SYMBOLS which are always defined (as 0 or 1),
+ meaning you can still use them for preprocessor tests by replacing
+ "#ifdef CONFIG_SYMBOL" with "#if ENABLE_SYMBOL". But more importantly, we
+ can use them as a true or false test in normal C code:
+
+ if (ENABLE_SYMBOL && other_test) {
+ do_code();
+ }
+
+ (Optimizing away if() statements that resolve to a constant value
+ is known as "dead code elimination", an optimization so old and simple that
+ Turbo Pascal for DOS did it twenty years ago. Even modern mini-compilers
+ like the Tiny C Compiler (tcc) and the Small Device C Compiler (SDCC)
+ perform dead code elimination.)
+
+ Right now, busybox.h is #including both "config.h" (defining the
+ CONFIG_SYMBOLS) and "bb_config.h" (defining the ENABLE_SYMBOLS). At some
+ point in the future, it would be nice to wean ourselves off of the
+ CONFIG versions. (Among other things, some defective build environments
+ leak the Linux kernel's CONFIG_SYMBOLS into the system's standard #include
+ files. We've experienced collisions before.)
+---
+FEATURE_CLEAN_UP
+ This is more an unresolved issue than a to-do item. More thought is needed.
+
+ Normally we rely on exit() to free memory, close files, and unmap segments
+ for us. This makes most calls to free(), close(), and unmap() optional in
+ busybox applets that don't intend to run for very long, and optional stuff
+ can be omitted to save size.
+
+ The idea was raised that we could simulate fork/exit with setjmp/longjmp
+ for _really_ brainless embedded systems, or speed up the standalone shell
+ by not forking. Doing so would require a reliable FEATURE_CLEAN_UP.
+ Unfortunately, this isn't as easy as it sounds.
+
+ The problem is, lots of things exit(), sometimes unexpectedly (xmalloc())
+ and sometimes reliably (bb_perror_msg_and_die() or show_usage()). This
+ jumps out of the normal flow control and bypasses any cleanup code we
+ put at the end of our applets.
+
+ It's possible to add hooks to libbb functions like xmalloc() and xopen()
+ to add their entries to a linked list, which could be traversed and
+ freed/closed automatically. (This would need to be able to free just the
+ entries after a checkpoint to be usable for a forkless standalone shell.
+ You don't want to free the shell's own resources.)
+
+ Right now, FEATURE_CLEAN_UP is more or less a debugging aid, to make things
+ like valgrind happy. It's also documentation of _what_ we're trusting
+ exit() to clean up for us. But new infrastructure to auto-free stuff would
+ render the existing FEATURE_CLEAN_UP code redundant.
+
+ For right now, exit() handles it just fine.
+
+
+
+Minor stuff:
+ watchdog.c could autodetect the timer duration via:
+ if(!ioctl (fd, WDIOC_GETTIMEOUT, &tmo)) timer_duration = 1 + (tmo / 2);
+ Unfortunately, that needs linux/watchdog.h and that contains unfiltered
+ kernel types on some distros, which breaks the build.
+---
+ use bb_error_msg where appropriate: See
+ egrep "(printf.*\([[:space:]]*(stderr|2)|[^_]write.*\([[:space:]]*(stderr|2))"
+---
+ use bb_perror_msg where appropriate: See
+ egrep "[^_]perror"
+---
+ Remove superfluous fmt occurances: e.g.
+ fprintf(stderr, "%s: %s not found\n", "unalias", *argptr);
+ -> fprintf(stderr, "unalias: %s not found\n", *argptr);
+---
+ possible code duplication ingroup() and is_a_group_member()
+---
+ Move __get_hz() to a better place and (re)use it in route.c, ash.c, msh.c
+---
+
+
+Code cleanup:
+
+Replace deprecated functions.
+
+bzero() -> memset()
+---
+sigblock(), siggetmask(), sigsetmask(), sigmask() -> sigprocmask et al
+---
+vdprintf() -> similar sized functionality
+---
diff --git a/i/pc104/initrd/conf/busybox/applets/Kbuild b/i/pc104/initrd/conf/busybox/applets/Kbuild
new file mode 100644
index 0000000..4323e85
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/Kbuild
@@ -0,0 +1,22 @@
+# Makefile for busybox
+#
+# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
+#
+# Licensed under the GPL v2, see the file LICENSE in this tarball.
+
+obj-y:=
+obj-y += applets.o
+obj-y += busybox.o
+
+# Generated file needs additional love
+
+applets/applets.o: .config include/usage_compressed.h
+
+hostprogs-y += usage
+always := $(hostprogs-y)
+HOSTCFLAGS_usage.o = -I$(srctree)/include
+
+quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
+ cmd_gen_usage_compressed = $(srctree)/applets/usage_compressed include/usage_compressed.h applets
+include/usage_compressed.h: .config $(srctree)/include/usage.h applets/usage
+ $(call cmd,gen_usage_compressed)
diff --git a/i/pc104/initrd/conf/busybox/applets/applets.c b/i/pc104/initrd/conf/busybox/applets/applets.c
new file mode 100644
index 0000000..7245ece
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/applets.c
@@ -0,0 +1,495 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) tons of folks. Tracking down who wrote what
+ * isn't something I'm going to worry about... If you wrote something
+ * here, please feel free to acknowledge your work.
+ *
+ * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
+ * Permission has been granted to redistribute this code under the GPL.
+ *
+ * Licensed under GPLv2 or later, see file License in this tarball for details.
+ */
+
+#include <assert.h>
+#include "busybox.h"
+
+#define PROTOTYPES
+#include "applets.h"
+#undef PROTOTYPES
+
+
+/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */
+#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)
+#warning Static linking against glibc produces buggy executables
+#warning (glibc does not cope well with ld --gc-sections).
+#warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
+#warning Note that glibc is unsuitable for static linking anyway.
+#warning If you still want to do it, remove -Wl,--gc-sections
+#warning from top-level Makefile and remove this warning.
+#endif
+
+#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
+static const char usage_messages[] =
+#define MAKE_USAGE
+#include "usage.h"
+#include "applets.h"
+;
+#undef MAKE_USAGE
+#else
+#define usage_messages 0
+#endif /* ENABLE_SHOW_USAGE */
+
+#undef APPLET
+#undef APPLET_NOUSAGE
+#undef PROTOTYPES
+#include "applets.h"
+
+static struct BB_applet *applet_using;
+
+/* The -1 arises because of the {0,NULL,0,-1} entry above. */
+const unsigned short NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
+
+
+#ifdef CONFIG_FEATURE_SUID_CONFIG
+
+#include <ctype.h>
+
+#define CONFIG_FILE "/etc/busybox.conf"
+
+/* applets [] is const, so we have to define this "override" structure */
+static struct BB_suid_config
+{
+ struct BB_applet *m_applet;
+
+ uid_t m_uid;
+ gid_t m_gid;
+ mode_t m_mode;
+
+ struct BB_suid_config *m_next;
+} *suid_config;
+
+static int suid_cfg_readable;
+
+/* check if u is member of group g */
+static int ingroup(uid_t u, gid_t g)
+{
+ struct group *grp = getgrgid(g);
+
+ if (grp) {
+ char **mem;
+
+ for (mem = grp->gr_mem; *mem; mem++) {
+ struct passwd *pwd = getpwnam(*mem);
+
+ if (pwd && (pwd->pw_uid == u))
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* This should probably be a libbb routine. In that case,
+ * I'd probably rename it to something like bb_trimmed_slice.
+ */
+static char *get_trimmed_slice(char *s, char *e)
+{
+ /* First, consider the value at e to be nul and back up until we
+ * reach a non-space char. Set the char after that (possibly at
+ * the original e) to nul. */
+ while (e-- > s) {
+ if (!isspace(*e)) {
+ break;
+ }
+ }
+ e[1] = 0;
+
+ /* Next, advance past all leading space and return a ptr to the
+ * first non-space char; possibly the terminating nul. */
+ return skip_whitespace(s);
+}
+
+
+#define parse_error(x) do { errmsg = x; goto pe_label; } while(0)
+
+/* Don't depend on the tools to combine strings. */
+static const char config_file[] = CONFIG_FILE;
+
+/* There are 4 chars + 1 nul for each of user/group/other. */
+static const char mode_chars[] = "Ssx-\0Ssx-\0Ttx-";
+
+/* We don't supply a value for the nul, so an index adjustment is
+ * necessary below. Also, we use unsigned short here to save some
+ * space even though these are really mode_t values. */
+static const unsigned short mode_mask[] = {
+ /* SST sst xxx --- */
+ S_ISUID, S_ISUID|S_IXUSR, S_IXUSR, 0, /* user */
+ S_ISGID, S_ISGID|S_IXGRP, S_IXGRP, 0, /* group */
+ 0, S_IXOTH, S_IXOTH, 0 /* other */
+};
+
+static void parse_config_file(void)
+{
+ struct BB_suid_config *sct_head;
+ struct BB_suid_config *sct;
+ struct BB_applet *applet;
+ FILE *f;
+ const char *errmsg;
+ char *s;
+ char *e;
+ int i, lc, section;
+ char buffer[256];
+ struct stat st;
+
+ assert(!suid_config); /* Should be set to NULL by bss init. */
+
+ if ((stat(config_file, &st) != 0) /* No config file? */
+ || !S_ISREG(st.st_mode) /* Not a regular file? */
+ || (st.st_uid != 0) /* Not owned by root? */
+ || (st.st_mode & (S_IWGRP | S_IWOTH)) /* Writable by non-root? */
+ || !(f = fopen(config_file, "r")) /* Cannot open? */
+ ) {
+ return;
+ }
+
+ suid_cfg_readable = 1;
+ sct_head = NULL;
+ section = lc = 0;
+
+ do {
+ s = buffer;
+
+ if (!fgets(s, sizeof(buffer), f)) { /* Are we done? */
+ if (ferror(f)) { /* Make sure it wasn't a read error. */
+ parse_error("reading");
+ }
+ fclose(f);
+ suid_config = sct_head; /* Success, so set the pointer. */
+ return;
+ }
+
+ lc++; /* Got a (partial) line. */
+
+ /* If a line is too long for our buffer, we consider it an error.
+ * The following test does mistreat one corner case though.
+ * If the final line of the file does not end with a newline and
+ * yet exactly fills the buffer, it will be treated as too long
+ * even though there isn't really a problem. But it isn't really
+ * worth adding code to deal with such an unlikely situation, and
+ * we do err on the side of caution. Besides, the line would be
+ * too long if it did end with a newline. */
+ if (!strchr(s, '\n') && !feof(f)) {
+ parse_error("line too long");
+ }
+
+ /* Trim leading and trailing whitespace, ignoring comments, and
+ * check if the resulting string is empty. */
+ if (!*(s = get_trimmed_slice(s, strchrnul(s, '#')))) {
+ continue;
+ }
+
+ /* Check for a section header. */
+
+ if (*s == '[') {
+ /* Unlike the old code, we ignore leading and trailing
+ * whitespace for the section name. We also require that
+ * there are no stray characters after the closing bracket. */
+ if (!(e = strchr(s, ']')) /* Missing right bracket? */
+ || e[1] /* Trailing characters? */
+ || !*(s = get_trimmed_slice(s+1, e)) /* Missing name? */
+ ) {
+ parse_error("section header");
+ }
+ /* Right now we only have one section so just check it.
+ * If more sections are added in the future, please don't
+ * resort to cascading ifs with multiple strcasecmp calls.
+ * That kind of bloated code is all too common. A loop
+ * and a string table would be a better choice unless the
+ * number of sections is very small. */
+ if (strcasecmp(s, "SUID") == 0) {
+ section = 1;
+ continue;
+ }
+ section = -1; /* Unknown section so set to skip. */
+ continue;
+ }
+
+ /* Process sections. */
+
+ if (section == 1) { /* SUID */
+ /* Since we trimmed leading and trailing space above, we're
+ * now looking for strings of the form
+ * <key>[::space::]*=[::space::]*<value>
+ * where both key and value could contain inner whitespace. */
+
+ /* First get the key (an applet name in our case). */
+ if (!!(e = strchr(s, '='))) {
+ s = get_trimmed_slice(s, e);
+ }
+ if (!e || !*s) { /* Missing '=' or empty key. */
+ parse_error("keyword");
+ }
+
+ /* Ok, we have an applet name. Process the rhs if this
+ * applet is currently built in and ignore it otherwise.
+ * Note: This can hide config file bugs which only pop
+ * up when the busybox configuration is changed. */
+ if ((applet = find_applet_by_name(s))) {
+ /* Note: We currently don't check for duplicates!
+ * The last config line for each applet will be the
+ * one used since we insert at the head of the list.
+ * I suppose this could be considered a feature. */
+ sct = xmalloc(sizeof(struct BB_suid_config));
+ sct->m_applet = applet;
+ sct->m_mode = 0;
+ sct->m_next = sct_head;
+ sct_head = sct;
+
+ /* Get the specified mode. */
+
+ e = skip_whitespace(e+1);
+
+ for (i=0 ; i < 3 ; i++) {
+ const char *q;
+ if (!*(q = strchrnul(mode_chars + 5*i, *e++))) {
+ parse_error("mode");
+ }
+ /* Adjust by -i to account for nul. */
+ sct->m_mode |= mode_mask[(q - mode_chars) - i];
+ }
+
+ /* Now get the the user/group info. */
+
+ s = skip_whitespace(e);
+
+ /* Note: We require whitespace between the mode and the
+ * user/group info. */
+ if ((s == e) || !(e = strchr(s, '.'))) {
+ parse_error("<uid>.<gid>");
+ }
+ *e++ = 0;
+
+ /* We can't use get_ug_id here since it would exit()
+ * if a uid or gid was not found. Oh well... */
+ {
+ char *e2;
+
+ sct->m_uid = strtoul(s, &e2, 10);
+ if (*e2 || (s == e2)) {
+ struct passwd *pwd = getpwnam(s);
+ if (!pwd) {
+ parse_error("user");
+ }
+ sct->m_uid = pwd->pw_uid;
+ }
+
+ sct->m_gid = strtoul(e, &e2, 10);
+ if (*e2 || (e == e2)) {
+ struct group *grp;
+ if (!(grp = getgrnam(e))) {
+ parse_error("group");
+ }
+ sct->m_gid = grp->gr_gid;
+ }
+ }
+ }
+ continue;
+ }
+
+ /* Unknown sections are ignored. */
+
+ /* Encountering configuration lines prior to seeing a
+ * section header is treated as an error. This is how
+ * the old code worked, but it may not be desirable.
+ * We may want to simply ignore such lines in case they
+ * are used in some future version of busybox. */
+ if (!section) {
+ parse_error("keyword outside section");
+ }
+
+ } while (1);
+
+ pe_label:
+ fprintf(stderr, "Parse error in %s, line %d: %s\n",
+ config_file, lc, errmsg);
+
+ fclose(f);
+ /* Release any allocated memory before returning. */
+ while (sct_head) {
+ sct = sct_head->m_next;
+ free(sct_head);
+ sct_head = sct;
+ }
+}
+
+#else
+#define parse_config_file() ((void)0)
+#endif /* CONFIG_FEATURE_SUID_CONFIG */
+
+#ifdef CONFIG_FEATURE_SUID
+static void check_suid(struct BB_applet *applet)
+{
+ uid_t ruid = getuid(); /* real [ug]id */
+ uid_t rgid = getgid();
+
+#ifdef CONFIG_FEATURE_SUID_CONFIG
+ if (suid_cfg_readable) {
+ struct BB_suid_config *sct;
+
+ for (sct = suid_config; sct; sct = sct->m_next) {
+ if (sct->m_applet == applet)
+ break;
+ }
+ if (sct) {
+ mode_t m = sct->m_mode;
+
+ if (sct->m_uid == ruid)
+ /* same uid */
+ m >>= 6;
+ else if ((sct->m_gid == rgid) || ingroup(ruid, sct->m_gid))
+ /* same group / in group */
+ m >>= 3;
+
+ if (!(m & S_IXOTH)) /* is x bit not set ? */
+ bb_error_msg_and_die("you have no permission to run this applet!");
+
+ if (sct->m_gid != 0) {
+ /* _both_ have to be set for sgid */
+ if ((sct->m_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
+ xsetgid(sct->m_gid);
+ } else xsetgid(rgid); /* no sgid -> drop */
+ }
+ if (sct->m_uid != 0) {
+ if (sct->m_mode & S_ISUID) xsetuid(sct->m_uid);
+ else xsetuid(ruid); /* no suid -> drop */
+ }
+ } else {
+ /* default: drop all privileges */
+ xsetgid(rgid);
+ xsetuid(ruid);
+ }
+ return;
+ } else {
+#ifndef CONFIG_FEATURE_SUID_CONFIG_QUIET
+ static int onetime = 0;
+
+ if (!onetime) {
+ onetime = 1;
+ fprintf(stderr, "Using fallback suid method\n");
+ }
+#endif
+ }
+#endif
+
+ if (applet->need_suid == _BB_SUID_ALWAYS) {
+ if (geteuid()) bb_error_msg_and_die("applet requires root privileges!");
+ } else if (applet->need_suid == _BB_SUID_NEVER) {
+ xsetgid(rgid); /* drop all privileges */
+ xsetuid(ruid);
+ }
+}
+#else
+#define check_suid(x)
+#endif /* CONFIG_FEATURE_SUID */
+
+
+
+#ifdef CONFIG_FEATURE_COMPRESS_USAGE
+
+#include "usage_compressed.h"
+#include "unarchive.h"
+
+static const char *unpack_usage_messages(void)
+{
+ int input[2], output[2], pid;
+ char *buf;
+
+ if(pipe(input) < 0 || pipe(output) < 0)
+ exit(1);
+
+ pid = fork();
+ switch (pid) {
+ case -1: /* error */
+ exit(1);
+ case 0: /* child */
+ close(input[1]);
+ close(output[0]);
+ uncompressStream(input[0], output[1]);
+ exit(0);
+ }
+ /* parent */
+
+ close(input[0]);
+ close(output[1]);
+ pid = fork();
+ switch (pid) {
+ case -1: /* error */
+ exit(1);
+ case 0: /* child */
+ full_write(input[1], packed_usage, sizeof(packed_usage));
+ exit(0);
+ }
+ /* parent */
+ close(input[1]);
+
+ buf = xmalloc(SIZEOF_usage_messages);
+ full_read(output[0], buf, SIZEOF_usage_messages);
+ return buf;
+}
+
+#else
+#define unpack_usage_messages() usage_messages
+#endif /* ENABLE_FEATURE_COMPRESS_USAGE */
+
+void bb_show_usage(void)
+{
+ if (ENABLE_SHOW_USAGE) {
+ const char *format_string;
+ const char *usage_string = unpack_usage_messages();
+ int i;
+
+ for (i = applet_using - applets; i > 0;)
+ if (!*usage_string++) --i;
+
+ format_string = "%s\n\nUsage: %s %s\n\n";
+ if (*usage_string == '\b')
+ format_string = "%s\n\nNo help available.\n\n";
+ fprintf(stderr, format_string, bb_msg_full_version,
+ applet_using->name, usage_string);
+ }
+
+ exit(xfunc_error_retval);
+}
+
+static int applet_name_compare(const void *name, const void *vapplet)
+{
+ const struct BB_applet *applet = vapplet;
+
+ return strcmp(name, applet->name);
+}
+
+struct BB_applet *find_applet_by_name(const char *name)
+{
+ return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet),
+ applet_name_compare);
+}
+
+void run_applet_by_name(const char *name, int argc, char **argv)
+{
+ if (ENABLE_FEATURE_SUID_CONFIG)
+ parse_config_file();
+
+ if (!strncmp(name, "busybox", 7))
+ exit(busybox_main(argc, argv));
+ /* Do a binary search to find the applet entry given the name. */
+ applet_using = find_applet_by_name(name);
+ if (applet_using) {
+ applet_name = applet_using->name;
+ if (argc == 2 && !strcmp(argv[1], "--help"))
+ bb_show_usage();
+ if (ENABLE_FEATURE_SUID)
+ check_suid(applet_using);
+ exit(applet_using->main(argc, argv));
+ }
+}
diff --git a/i/pc104/initrd/conf/busybox/applets/busybox.c b/i/pc104/initrd/conf/busybox/applets/busybox.c
new file mode 100644
index 0000000..0387d79
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/busybox.c
@@ -0,0 +1,147 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * BusyBox' main applet dispatcher.
+ *
+ * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ */
+#include "busybox.h"
+
+const char *applet_name ATTRIBUTE_EXTERNALLY_VISIBLE;
+
+#ifdef CONFIG_FEATURE_INSTALLER
+/*
+ * directory table
+ * this should be consistent w/ the enum, busybox.h::Location,
+ * or else...
+ */
+static const char usr_bin [] = "/usr/bin";
+static const char usr_sbin[] = "/usr/sbin";
+
+static const char* const install_dir[] = {
+ &usr_bin [8], /* "", equivalent to "/" for concat_path_file() */
+ &usr_bin [4], /* "/bin" */
+ &usr_sbin[4], /* "/sbin" */
+ usr_bin,
+ usr_sbin
+};
+
+/* abstract link() */
+typedef int (*link_func)(const char *, const char *);
+
+/* create (sym)links for each applet */
+static void install_links(const char *busybox, int use_symbolic_links)
+{
+ link_func lf = link;
+ char *fpc;
+ int i;
+ int rc;
+
+ if (use_symbolic_links)
+ lf = symlink;
+
+ for (i = 0; applets[i].name != NULL; i++) {
+ fpc = concat_path_file(
+ install_dir[applets[i].location],
+ applets[i].name);
+ rc = lf(busybox, fpc);
+ if (rc != 0 && errno != EEXIST) {
+ bb_perror_msg("%s", fpc);
+ }
+ free(fpc);
+ }
+}
+
+#else
+#define install_links(x,y)
+#endif /* CONFIG_FEATURE_INSTALLER */
+
+int main(int argc, char **argv)
+{
+ const char *s;
+
+ applet_name = argv[0];
+ if (*applet_name == '-')
+ applet_name++;
+ while ((s = strchr(applet_name, '/')))
+ applet_name = s + 1;
+
+ /* Set locale for everybody except 'init' */
+ if (ENABLE_LOCALE_SUPPORT && getpid() != 1)
+ setlocale(LC_ALL, "");
+
+ run_applet_by_name(applet_name, argc, argv);
+ bb_error_msg_and_die("applet not found");
+}
+
+int busybox_main(int argc, char **argv);
+int busybox_main(int argc, char **argv)
+{
+ /*
+ * This style of argument parsing doesn't scale well
+ * in the event that busybox starts wanting more --options.
+ * If someone has a cleaner approach, by all means implement it.
+ */
+ if (ENABLE_FEATURE_INSTALLER && argc > 1 && !strcmp(argv[1], "--install")) {
+ int use_symbolic_links = 0;
+ char *busybox;
+
+ /* to use symlinks, or not to use symlinks... */
+ if (argc > 2)
+ if (strcmp(argv[2], "-s") == 0)
+ use_symbolic_links = 1;
+
+ /* link */
+// XXX: FIXME: this is broken. Why not just use argv[0] ?
+ busybox = xmalloc_readlink_or_warn("/proc/self/exe");
+ if (!busybox)
+ return 1;
+ install_links(busybox, use_symbolic_links);
+ if (ENABLE_FEATURE_CLEAN_UP)
+ free(busybox);
+ return 0;
+ }
+
+ /* Deal with --help. (Also print help when called with no arguments) */
+
+ if (argc == 1 || !strcmp(argv[1], "--help") ) {
+ if (argc > 2) {
+ applet_name = argv[2];
+ run_applet_by_name(applet_name, 2, argv);
+ } else {
+ const struct BB_applet *a;
+ int col, output_width;
+
+ output_width = 80 - sizeof("start-stop-daemon, ") - 8;
+ if (ENABLE_FEATURE_AUTOWIDTH) {
+ /* Obtain the terminal width. */
+ get_terminal_width_height(0, &output_width, NULL);
+ /* leading tab and room to wrap */
+ output_width -= sizeof("start-stop-daemon, ") + 8;
+ }
+
+ printf("%s\n"
+ "Copyright (C) 1998-2006  Erik Andersen, Rob Landley, and others.\n"
+ "Licensed under GPLv2.  See source distribution for full notice.\n\n"
+ "Usage: busybox [function] [arguments]...\n"
+ " or: [function] [arguments]...\n\n"
+ "\tBusyBox is a multi-call binary that combines many common Unix\n"
+ "\tutilities into a single executable. Most people will create a\n"
+ "\tlink to busybox for each function they wish to use and BusyBox\n"
+ "\twill act like whatever it was invoked as!\n"
+ "\nCurrently defined functions:\n", bb_msg_full_version);
+ col = 0;
+ for (a = applets; a->name;) {
+ col += printf("%s%s", (col ? ", " : "\t"), a->name);
+ a++;
+ if (col > output_width && a->name) {
+ puts(",");
+ col = 0;
+ }
+ }
+ puts("\n");
+ return 0;
+ }
+ } else run_applet_by_name(argv[1], argc - 1, argv + 1);
+
+ bb_error_msg_and_die("applet not found");
+}
diff --git a/i/pc104/initrd/conf/busybox/applets/busybox.mkll b/i/pc104/initrd/conf/busybox/applets/busybox.mkll
new file mode 100755
index 0000000..6d61f7e
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/busybox.mkll
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Make busybox links list file.
+
+# input $1: full path to Config.h
+# input $2: full path to applets.h
+# output (stdout): list of pathnames that should be linked to busybox
+
+# Maintainer: Larry Doolittle <ldoolitt@recycle.lbl.gov>
+
+export LC_ALL=POSIX
+export LC_CTYPE=POSIX
+
+CONFIG_H=${1:-include/autoconf.h}
+APPLETS_H=${2:-include/applets.h}
+$HOSTCC -E -DMAKE_LINKS -include $CONFIG_H $APPLETS_H |
+ awk '/^[ \t]*LINK/{
+ dir=substr($2,8)
+ gsub("_","/",dir)
+ if(dir=="/ROOT") dir=""
+ file=$3
+ gsub("\"","",file)
+ if (file=="busybox") next
+ print tolower(dir) "/" file
+ }'
diff --git a/i/pc104/initrd/conf/busybox/applets/individual.c b/i/pc104/initrd/conf/busybox/applets/individual.c
new file mode 100644
index 0000000..0721683
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/individual.c
@@ -0,0 +1,27 @@
+/* Minimal wrapper to build an individual busybox applet.
+ *
+ * Copyright 2005 Rob Landley <rob@landley.net
+ *
+ * Licensed under GPL version 2, see file LICENSE in this tarball for details
+ */
+
+const char *applet_name;
+
+#include <stdio.h>
+#include <stdlib.h>
+//Ok to remove? #include "bb_config.h"
+#include "usage.h"
+
+int main(int argc, char *argv[])
+{
+ applet_name=argv[0];
+
+ return APPLET_main(argc,argv);
+}
+
+void bb_show_usage(void)
+{
+ printf(APPLET_full_usage "\n");
+
+ exit(1);
+}
diff --git a/i/pc104/initrd/conf/busybox/applets/install.sh b/i/pc104/initrd/conf/busybox/applets/install.sh
new file mode 100755
index 0000000..4ec96c2
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/install.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+
+export LC_ALL=POSIX
+export LC_CTYPE=POSIX
+
+prefix=${1}
+if [ -z "$prefix" ]; then
+ echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks]"
+ exit 1;
+fi
+h=`sort busybox.links | uniq`
+cleanup="0"
+noclobber="0"
+case "$2" in
+ --hardlinks) linkopts="-f";;
+ --symlinks) linkopts="-fs";;
+ --cleanup) cleanup="1";;
+ --noclobber) noclobber="1";;
+ "") h="";;
+ *) echo "Unknown install option: $2"; exit 1;;
+esac
+
+if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
+ # get the target dir for the libs
+ # assume it starts with lib
+ libdir=$($CC -print-file-name=libc.so | \
+ sed -n 's%^.*\(/lib[^\/]*\)/libc.so%\1%p')
+ if test -z "$libdir"; then
+ libdir=/lib
+ fi
+
+ mkdir -p $prefix/$libdir || exit 1
+ for i in $DO_INSTALL_LIBS; do
+ rm -f $prefix/$libdir/$i || exit 1
+ if [ -f $i ]; then
+ cp -a $i $prefix/$libdir/ || exit 1
+ chmod 0644 $prefix/$libdir/$i || exit 1
+ fi
+ done
+fi
+
+if [ "$cleanup" = "1" ] && [ -e "$prefix/bin/busybox" ]; then
+ inode=`ls -i "$prefix/bin/busybox" | awk '{print $1}'`
+ sub_shell_it=`
+ cd "$prefix"
+ for d in usr/sbin usr/bin sbin bin ; do
+ pd=$PWD
+ if [ -d "$d" ]; then
+ cd $d
+ ls -iL . | grep "^ *$inode" | awk '{print $2}' | env -i xargs rm -f
+ fi
+ cd "$pd"
+ done
+ `
+fi
+
+rm -f $prefix/bin/busybox || exit 1
+mkdir -p $prefix/bin || exit 1
+install -m 755 busybox $prefix/bin/busybox || exit 1
+
+for i in $h ; do
+ appdir=`dirname $i`
+ mkdir -p $prefix/$appdir || exit 1
+ if [ "$2" = "--hardlinks" ]; then
+ bb_path="$prefix/bin/busybox"
+ else
+ case "$appdir" in
+ /)
+ bb_path="bin/busybox"
+ ;;
+ /bin)
+ bb_path="busybox"
+ ;;
+ /sbin)
+ bb_path="../bin/busybox"
+ ;;
+ /usr/bin|/usr/sbin)
+ bb_path="../../bin/busybox"
+ ;;
+ *)
+ echo "Unknown installation directory: $appdir"
+ exit 1
+ ;;
+ esac
+ fi
+ if [ "$noclobber" = "0" ] || [ ! -e "$prefix$i" ]; then
+ echo " $prefix$i -> $bb_path"
+ ln $linkopts $bb_path $prefix$i || exit 1
+ else
+ echo " $prefix$i already exists"
+ fi
+done
+
+exit 0
diff --git a/i/pc104/initrd/conf/busybox/applets/usage.c b/i/pc104/initrd/conf/busybox/applets/usage.c
new file mode 100644
index 0000000..bb7ca82
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/usage.c
@@ -0,0 +1,17 @@
+/* vi: set sw=4 ts=4: */
+#include <unistd.h>
+
+#include "../include/autoconf.h"
+#include "../include/busybox.h"
+
+static const char usage_messages[] = ""
+#define MAKE_USAGE
+#include "usage.h"
+#include "applets.h"
+;
+
+int main(void)
+{
+ write(1, usage_messages, sizeof(usage_messages));
+ return 0;
+}
diff --git a/i/pc104/initrd/conf/busybox/applets/usage_compressed b/i/pc104/initrd/conf/busybox/applets/usage_compressed
new file mode 100755
index 0000000..fd581cc
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/applets/usage_compressed
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+target="$1"
+loc="$2"
+
+test "$target" || exit 1
+test "$loc" || loc=.
+test -x "$loc/usage" || exit 1
+test "$SED" || SED=sed
+
+sz=`"$loc/usage" | wc -c` || exit 1
+
+exec >"$target"
+
+echo 'static const char packed_usage[] = '
+"$loc/usage" | bzip2 -1 | od -v -t x1 \
+| $SED -e 's/^[^ ]*//' -e 's/ *\(..\)/\\x\1/g' -e 's/^\(.*\)$/"\1"/'
+echo ';'
+echo '#define SIZEOF_usage_messages' `expr 0 + $sz`
diff --git a/i/pc104/initrd/conf/busybox/arch/i386/Makefile b/i/pc104/initrd/conf/busybox/arch/i386/Makefile
new file mode 100644
index 0000000..385dd52
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/arch/i386/Makefile
@@ -0,0 +1,5 @@
+# ==========================================================================
+# Build system
+# ==========================================================================
+
+CFLAGS += $(call cc-option,-march=i386 -mpreferred-stack-boundary=2,)
diff --git a/i/pc104/initrd/conf/busybox/archival/Config.in b/i/pc104/initrd/conf/busybox/archival/Config.in
new file mode 100644
index 0000000..2741982
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/Config.in
@@ -0,0 +1,300 @@
+#
+# For a description of the syntax of this configuration file,
+# see scripts/kbuild/config-language.txt.
+#
+
+menu "Archival Utilities"
+
+config AR
+ bool "ar"
+ default n
+ help
+ ar is an archival utility program used to create, modify, and
+ extract contents from archives. An archive is a single file holding
+ a collection of other files in a structure that makes it possible to
+ retrieve the original individual files (called archive members).
+ The original files' contents, mode (permissions), timestamp, owner,
+ and group are preserved in the archive, and can be restored on
+ extraction.
+
+ The stored filename is limited to 15 characters. (for more information
+ see long filename support).
+ ar has 60 bytes of overheads for every stored file.
+
+ This implementation of ar can extract archives, it cannot create or
+ modify them.
+ On an x86 system, the ar applet adds about 1K.
+
+ Unless you have a specific application which requires ar, you should
+ probably say N here.
+
+config FEATURE_AR_LONG_FILENAMES
+ bool "Enable support for long filenames (not need for debs)"
+ default n
+ depends on AR
+ help
+ By default the ar format can only store the first 15 characters of the
+ filename, this option removes that limitation.
+ It supports the GNU ar long filename method which moves multiple long
+ filenames into a the data section of a new ar entry.
+
+config BUNZIP2
+ bool "bunzip2"
+ default n
+ help
+ bunzip2 is a compression utility using the Burrows-Wheeler block
+ sorting text compression algorithm, and Huffman coding. Compression
+ is generally considerably better than that achieved by more
+ conventional LZ77/LZ78-based compressors, and approaches the
+ performance of the PPM family of statistical compressors.
+
+ The BusyBox bunzip2 applet is limited to de-compression only.
+ On an x86 system, this applet adds about 11K.
+
+ Unless you have a specific application which requires bunzip2, you
+ should probably say N here.
+
+config CPIO
+ bool "cpio"
+ default n
+ help
+ cpio is an archival utility program used to create, modify, and extract
+ contents from archives.
+ cpio has 110 bytes of overheads for every stored file.
+
+ This implementation of cpio can extract cpio archives created in the
+ "newc" or "crc" format, it cannot create or modify them.
+
+ Unless you have a specific application which requires cpio, you should
+ probably say N here.
+
+config DPKG
+ bool "dpkg"
+ default n
+ help
+ dpkg is a medium-level tool to install, build, remove and manage Debian packages.
+
+ This implementation of dpkg has a number of limitations, you should use the
+ official dpkg if possible.
+
+config DPKG_DEB
+ bool "dpkg_deb"
+ default n
+ help
+ dpkg-deb packs, unpacks and provides information about Debian archives.
+
+ This implementation of dpkg-deb cannot pack archives.
+
+ Unless you have a specific application which requires dpkg-deb, you should
+ probably say N here.
+
+config FEATURE_DPKG_DEB_EXTRACT_ONLY
+ bool "extract only (-x)"
+ default n
+ depends on DPKG_DEB
+ help
+ This reduces dpkg-deb to the equivalent of "ar -p <deb> data.tar.gz | tar -zx".
+ However it saves space as none of the extra dpkg-deb, ar or tar options are
+ needed, they are linked to internally.
+
+config GUNZIP
+ bool "gunzip"
+ default n
+ help
+ gunzip is used to decompress archives created by gzip.
+ You can use the `-t' option to test the integrity of
+ an archive, without decompressing it.
+
+config FEATURE_GUNZIP_UNCOMPRESS
+ bool "Uncompress support"
+ default n
+ depends on GUNZIP
+ help
+ Enable if you want gunzip to have the ability to decompress
+ archives created by the program compress (not much
+ used anymore).
+
+config GZIP
+ bool "gzip"
+ default n
+ help
+ gzip is used to compress files.
+ It's probably the most widely used UNIX compression program.
+
+config RPM2CPIO
+ bool "rpm2cpio"
+ default n
+ help
+ Converts an RPM file into a CPIO archive.
+
+config RPM
+ bool "rpm"
+ default n
+ help
+ Mini RPM applet - queries and extracts RPM packages.
+
+config TAR
+ bool "tar"
+ default n
+ help
+ tar is an archiving program. It's commonly used with gzip to
+ create compressed archives. It's probably the most widely used
+ UNIX archive program.
+
+config FEATURE_TAR_CREATE
+ bool "Enable archive creation"
+ default y
+ depends on TAR
+ help
+ If you enable this option you'll be able to create
+ tar archives using the `-c' option.
+
+config FEATURE_TAR_BZIP2
+ bool "Enable -j option to handle .tar.bz2 files"
+ default n
+ depends on TAR
+ help
+ If you enable this option you'll be able to extract
+ archives compressed with bzip2.
+
+config FEATURE_TAR_LZMA
+ bool "Enable -a option to handle .tar.lzma files"
+ default n
+ depends on TAR
+ help
+ If you enable this option you'll be able to extract
+ archives compressed with lzma.
+
+config FEATURE_TAR_FROM
+ bool "Enable -X (exclude from) and -T (include from) options)"
+ default n
+ depends on TAR
+ help
+ If you enable this option you'll be able to specify
+ a list of files to include or exclude from an archive.
+
+config FEATURE_TAR_GZIP
+ bool "Enable -z option"
+ default y
+ depends on TAR
+ help
+ If you enable this option tar will be able to call gzip,
+ when creating or extracting tar gziped archives.
+
+config FEATURE_TAR_COMPRESS
+ bool "Enable -Z option"
+ default n
+ depends on TAR
+ help
+ If you enable this option tar will be able to call uncompress,
+ when extracting .tar.Z archives.
+
+config FEATURE_TAR_OLDGNU_COMPATIBILITY
+ bool "Enable support for old tar header format"
+ default N
+ depends on TAR
+ help
+ This option is required to unpack archives created in
+ the old GNU format; help to kill this old format by
+ repacking your ancient archives with the new format.
+
+config FEATURE_TAR_GNU_EXTENSIONS
+ bool "Enable support for some GNU tar extensions"
+ default y
+ depends on TAR
+ help
+ With this option busybox supports GNU long filenames and
+ linknames.
+
+config FEATURE_TAR_LONG_OPTIONS
+ bool "Enable long options"
+ default n
+ depends on TAR && GETOPT_LONG
+ help
+ Enable use of long options, increases size by about 400 Bytes
+
+config UNCOMPRESS
+ bool "uncompress"
+ default n
+ help
+ uncompress is used to decompress archives created by compress.
+ Not much used anymore, replaced by gzip/gunzip.
+
+config UNLZMA
+ bool "unlzma"
+ default n
+ help
+ unlzma is a compression utility using the Lempel-Ziv-Markov chain
+ compression algorithm, and range coding. Compression
+ is generally considerably better than that achieved by the bzip2
+ compressors.
+
+ The BusyBox unlzma applet is limited to de-compression only.
+ On an x86 system, this applet adds about 4K.
+
+ Unless you have a specific application which requires unlzma, you
+ should probably say N here.
+
+config FEATURE_LZMA_FAST
+ bool "Optimze unlzma for speed"
+ default n
+ depends on UNLZMA
+ help
+ This option reduces decompression time by about 33% at the cost of
+ a 2K bigger binary.
+
+config UNZIP
+ bool "unzip"
+ default n
+ help
+ unzip will list or extract files from a ZIP archive,
+ commonly found on DOS/WIN systems. The default behavior
+ (with no options) is to extract the archive into the
+ current directory. Use the `-d' option to extract to a
+ directory of your choice.
+
+comment "Common options for cpio and tar"
+ depends on CPIO || TAR
+
+config FEATURE_UNARCHIVE_TAPE
+ bool "Enable tape drive support"
+ default n
+ depends on CPIO || TAR
+ help
+ I don't think this is needed anymore.
+
+comment "Common options for dpkg and dpkg_deb"
+ depends on DPKG || DPKG_DEB
+
+config FEATURE_DEB_TAR_GZ
+ bool "gzip debian packages (normal)"
+ default y if DPKG || DPKG_DEB
+ depends on DPKG || DPKG_DEB
+ help
+ This is the default compression method inside the debian ar file.
+
+ If you want compatibility with standard .deb's you should say yes here.
+
+config FEATURE_DEB_TAR_BZ2
+ bool "bzip2 debian packages"
+ default n
+ depends on DPKG || DPKG_DEB
+ help
+ This allows dpkg and dpkg-deb to extract deb's that are compressed internally
+ with bzip2 instead of gzip.
+
+ You only want this if you are creating your own custom debian packages that
+ use an internal control.tar.bz2 or data.tar.bz2.
+
+config FEATURE_DEB_TAR_LZMA
+ bool "lzma debian packages"
+ default n
+ depends on DPKG || DPKG_DEB
+ help
+ This allows dpkg and dpkg-deb to extract deb's that are compressed
+ internally with lzma instead of gzip.
+
+ You only want this if you are creating your own custom debian
+ packages that use an internal control.tar.lzma or data.tar.lzma.
+
+endmenu
diff --git a/i/pc104/initrd/conf/busybox/archival/Kbuild b/i/pc104/initrd/conf/busybox/archival/Kbuild
new file mode 100644
index 0000000..07b442f
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/Kbuild
@@ -0,0 +1,22 @@
+# Makefile for busybox
+#
+# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
+#
+# Licensed under the GPL v2, see the file LICENSE in this tarball.
+
+libs-y += libunarchive/
+
+lib-y:=
+lib-$(CONFIG_AR) += ar.o
+lib-$(CONFIG_BUNZIP2) += bbunzip.o
+lib-$(CONFIG_UNLZMA) += bbunzip.o
+lib-$(CONFIG_CPIO) += cpio.o
+lib-$(CONFIG_DPKG) += dpkg.o
+lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o
+lib-$(CONFIG_GUNZIP) += bbunzip.o
+lib-$(CONFIG_GZIP) += gzip.o bbunzip.o
+lib-$(CONFIG_RPM2CPIO) += rpm2cpio.o
+lib-$(CONFIG_RPM) += rpm.o
+lib-$(CONFIG_TAR) += tar.o
+lib-$(CONFIG_UNCOMPRESS) += bbunzip.o
+lib-$(CONFIG_UNZIP) += unzip.o
diff --git a/i/pc104/initrd/conf/busybox/archival/ar.c b/i/pc104/initrd/conf/busybox/archival/ar.c
new file mode 100644
index 0000000..23d9b49
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/ar.c
@@ -0,0 +1,94 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Mini ar implementation for busybox
+ *
+ * Copyright (C) 2000 by Glenn McGrath
+ * Written by Glenn McGrath <bug1@iinet.net.au> 1 June 2000
+ *
+ * Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ *
+ * There is no single standard to adhere to so ar may not portable
+ * between different systems
+ * http://www.unix-systems.org/single_unix_specification_v2/xcu/ar.html
+ */
+
+#include "busybox.h"
+#include "unarchive.h"
+
+static void header_verbose_list_ar(const file_header_t *file_header)
+{
+ const char *mode = bb_mode_string(file_header->mode);
+ char *mtime;
+
+ mtime = ctime(&file_header->mtime);
+ mtime[16] = ' ';
+ memmove(&mtime[17], &mtime[20], 4);
+ mtime[21] = '\0';
+ printf("%s %d/%d%7d %s %s\n", &mode[1], file_header->uid, file_header->gid,
+ (int) file_header->size, &mtime[4], file_header->name);
+}
+
+#define AR_CTX_PRINT 0x01
+#define AR_CTX_LIST 0x02
+#define AR_CTX_EXTRACT 0x04
+#define AR_OPT_PRESERVE_DATE 0x08
+#define AR_OPT_VERBOSE 0x10
+#define AR_OPT_CREATE 0x20
+#define AR_OPT_INSERT 0x40
+
+int ar_main(int argc, char **argv);
+int ar_main(int argc, char **argv)
+{
+ archive_handle_t *archive_handle;
+ unsigned opt;
+ static const char msg_unsupported_err[] =
+ "Archive %s not supported. Install binutils 'ar'.";
+ char magic[8];
+
+ archive_handle = init_handle();
+
+ /* Prepend '-' to the first argument if required */
+ opt_complementary = "--:p:t:x:-1:?:p--tx:t--px:x--pt";
+ opt = getopt32(argc, argv, "ptxovcr");
+
+ if (opt & AR_CTX_PRINT) {
+ archive_handle->action_data = data_extract_to_stdout;
+ }
+ if (opt & AR_CTX_LIST) {
+ archive_handle->action_header = header_list;
+ }
+ if (opt & AR_CTX_EXTRACT) {
+ archive_handle->action_data = data_extract_all;
+ }
+ if (opt & AR_OPT_PRESERVE_DATE) {
+ archive_handle->flags |= ARCHIVE_PRESERVE_DATE;
+ }
+ if (opt & AR_OPT_VERBOSE) {
+ archive_handle->action_header = header_verbose_list_ar;
+ }
+ if (opt & AR_OPT_CREATE) {
+ bb_error_msg_and_die(msg_unsupported_err, "creation");
+ }
+ if (opt & AR_OPT_INSERT) {
+ bb_error_msg_and_die(msg_unsupported_err, "insertion");
+ }
+
+ archive_handle->src_fd = xopen(argv[optind++], O_RDONLY);
+
+ while (optind < argc) {
+ archive_handle->filter = filter_accept_list;
+ llist_add_to(&(archive_handle->accept), argv[optind++]);
+ }
+
+ xread(archive_handle->src_fd, magic, 7);
+ if (strncmp(magic, "!<arch>", 7) != 0) {
+ bb_error_msg_and_die("invalid ar magic");
+ }
+ archive_handle->offset += 7;
+
+ while (get_header_ar(archive_handle) == EXIT_SUCCESS) /* repeat */;
+
+ return EXIT_SUCCESS;
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/bbunzip.c b/i/pc104/initrd/conf/busybox/archival/bbunzip.c
new file mode 100644
index 0000000..e16e6b0
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/bbunzip.c
@@ -0,0 +1,355 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Common code for gunzip-like applets
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include "busybox.h"
+#include "unarchive.h"
+
+enum {
+ OPT_STDOUT = 0x1,
+ OPT_FORCE = 0x2,
+/* gunzip only: */
+ OPT_VERBOSE = 0x4,
+ OPT_DECOMPRESS = 0x8,
+ OPT_TEST = 0x10,
+};
+
+static
+int open_to_or_warn(int to_fd, const char *filename, int flags, int mode)
+{
+ int fd = open(filename, flags, mode);
+ if (fd < 0) {
+ bb_perror_msg("%s", filename);
+ return 1;
+ }
+ if (fd != to_fd) {
+ if (dup2(fd, to_fd) < 0)
+ bb_perror_msg_and_die("cannot dup");
+ close(fd);
+ }
+ return 0;
+}
+
+int bbunpack(char **argv,
+ char* (*make_new_name)(char *filename),
+ USE_DESKTOP(long long) int (*unpacker)(void)
+)
+{
+ struct stat stat_buf;
+ USE_DESKTOP(long long) int status;
+ char *filename, *new_name;
+ smallint exitcode = 0;
+
+ do {
+ /* NB: new_name is *maybe* malloc'ed! */
+ new_name = NULL;
+ filename = *argv; /* can be NULL - 'streaming' bunzip2 */
+
+ if (filename && LONE_DASH(filename))
+ filename = NULL;
+
+ /* Open src */
+ if (filename) {
+ if (stat(filename, &stat_buf) != 0) {
+ bb_perror_msg("%s", filename);
+ err:
+ exitcode = 1;
+ goto free_name;
+ }
+ if (open_to_or_warn(STDIN_FILENO, filename, O_RDONLY, 0))
+ goto err;
+ }
+
+ /* Special cases: test, stdout */
+ if (option_mask32 & (OPT_STDOUT|OPT_TEST)) {
+ if (option_mask32 & OPT_TEST)
+ if (open_to_or_warn(STDOUT_FILENO, bb_dev_null, O_WRONLY, 0))
+ goto err;
+ filename = NULL;
+ }
+
+ /* Open dst if we are going to unpack to file */
+ if (filename) {
+ new_name = make_new_name(filename);
+ if (!new_name) {
+ bb_error_msg("%s: unknown suffix - ignored", filename);
+ goto err;
+ }
+ /* O_EXCL: "real" bunzip2 doesn't overwrite files */
+ /* GNU gunzip goes not bail out, but goes to next file */
+ if (open_to_or_warn(STDOUT_FILENO, new_name, O_WRONLY | O_CREAT | O_EXCL,
+ stat_buf.st_mode))
+ goto err;
+ }
+
+ /* Check that the input is sane */
+ if (isatty(STDIN_FILENO) && (option_mask32 & OPT_FORCE) == 0) {
+ bb_error_msg_and_die("compressed data not read from terminal, "
+ "use -f to force it");
+ }
+
+ status = unpacker();
+ if (status < 0)
+ exitcode = 1;
+
+ if (filename) {
+ char *del = new_name;
+ if (status >= 0) {
+ /* TODO: restore user/group/times here? */
+ /* Delete _compressed_ file */
+ del = filename;
+ /* restore extension (unless tgz -> tar case) */
+ if (new_name == filename)
+ filename[strlen(filename)] = '.';
+ }
+ if (unlink(del) < 0)
+ bb_perror_msg_and_die("cannot remove %s", del);
+
+#if 0 /* Currently buggy - wrong name: "a.gz: 261% - replaced with a.gz" */
+ /* Extreme bloat for gunzip compat */
+ if (ENABLE_DESKTOP && (option_mask32 & OPT_VERBOSE) && status >= 0) {
+ fprintf(stderr, "%s: %u%% - replaced with %s\n",
+ filename, (unsigned)(stat_buf.st_size*100 / (status+1)), new_name);
+ }
+#endif
+
+ free_name:
+ if (new_name != filename)
+ free(new_name);
+ }
+ } while (*argv && *++argv);
+
+ return exitcode;
+}
+
+#if ENABLE_BUNZIP2 || ENABLE_UNLZMA || ENABLE_UNCOMPRESS
+
+static
+char* make_new_name_generic(char *filename, const char *expected_ext)
+{
+ char *extension = strrchr(filename, '.');
+ if (!extension || strcmp(extension + 1, expected_ext) != 0) {
+ /* Mimic GNU gunzip - "real" bunzip2 tries to */
+ /* unpack file anyway, to file.out */
+ return NULL;
+ }
+ *extension = '\0';
+ return filename;
+}
+
+#endif
+
+
+/*
+ * Modified for busybox by Glenn McGrath <bug1@iinet.net.au>
+ * Added support output to stdout by Thomas Lundquist <thomasez@zelow.no>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#if ENABLE_BUNZIP2
+
+static
+char* make_new_name_bunzip2(char *filename)
+{
+ return make_new_name_generic(filename, "bz2");
+}
+
+static
+USE_DESKTOP(long long) int unpack_bunzip2(void)
+{
+ return uncompressStream(STDIN_FILENO, STDOUT_FILENO);
+}
+
+int bunzip2_main(int argc, char **argv);
+int bunzip2_main(int argc, char **argv)
+{
+ getopt32(argc, argv, "cf");
+ argv += optind;
+ if (applet_name[2] == 'c')
+ option_mask32 |= OPT_STDOUT;
+
+ return bbunpack(argv, make_new_name_bunzip2, unpack_bunzip2);
+}
+
+#endif
+
+
+/*
+ * Gzip implementation for busybox
+ *
+ * Based on GNU gzip v1.2.4 Copyright (C) 1992-1993 Jean-loup Gailly.
+ *
+ * Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
+ * based on gzip sources
+ *
+ * Adjusted further by Erik Andersen <andersen@codepoet.org> to support files as
+ * well as stdin/stdout, and to generally behave itself wrt command line
+ * handling.
+ *
+ * General cleanup to better adhere to the style guide and make use of standard
+ * busybox functions by Glenn McGrath <bug1@iinet.net.au>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ *
+ * gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
+ * Copyright (C) 1992-1993 Jean-loup Gailly
+ * The unzip code was written and put in the public domain by Mark Adler.
+ * Portions of the lzw code are derived from the public domain 'compress'
+ * written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies,
+ * Ken Turkowski, Dave Mack and Peter Jannesen.
+ *
+ * See the license_msg below and the file COPYING for the software license.
+ * See the file algorithm.doc for the compression algorithms and file formats.
+ */
+
+#if ENABLE_GUNZIP
+
+static
+char* make_new_name_gunzip(char *filename)
+{
+ char *extension = strrchr(filename, '.');
+
+ if (!extension)
+ return NULL;
+
+ extension++;
+ if (strcmp(extension, "tgz" + 1) == 0
+#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
+ || strcmp(extension, "Z") == 0
+#endif
+ ) {
+ extension[-1] = '\0';
+ } else if(strcmp(extension, "tgz") == 0) {
+ filename = xstrdup(filename);
+ extension = strrchr(filename, '.');
+ extension[2] = 'a';
+ extension[3] = 'r';
+ } else {
+ return NULL;
+ }
+ return filename;
+}
+
+static
+USE_DESKTOP(long long) int unpack_gunzip(void)
+{
+ USE_DESKTOP(long long) int status = -1;
+
+ /* do the decompression, and cleanup */
+ if (xread_char(STDIN_FILENO) == 0x1f) {
+ unsigned char magic2;
+
+ magic2 = xread_char(STDIN_FILENO);
+ if (ENABLE_FEATURE_GUNZIP_UNCOMPRESS && magic2 == 0x9d) {
+ status = uncompress(STDIN_FILENO, STDOUT_FILENO);
+ } else if (magic2 == 0x8b) {
+ check_header_gzip_or_die(STDIN_FILENO);
+ status = inflate_gunzip(STDIN_FILENO, STDOUT_FILENO);
+ } else {
+ goto bad_magic;
+ }
+ if (status < 0) {
+ bb_error_msg("error inflating");
+ }
+ } else {
+ bad_magic:
+ bb_error_msg("invalid magic");
+ /* status is still == -1 */
+ }
+ return status;
+}
+
+int gunzip_main(int argc, char **argv);
+int gunzip_main(int argc, char **argv)
+{
+ getopt32(argc, argv, "cfvdt");
+ argv += optind;
+ /* if called as zcat */
+ if (applet_name[1] == 'c')
+ option_mask32 |= OPT_STDOUT;
+
+ return bbunpack(argv, make_new_name_gunzip, unpack_gunzip);
+}
+
+#endif
+
+
+/*
+ * Small lzma deflate implementation.
+ * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
+ *
+ * Based on bunzip.c from busybox
+ *
+ * Licensed under GPL v2, see file LICENSE in this tarball for details.
+ */
+
+#if ENABLE_UNLZMA
+
+static
+char* make_new_name_unlzma(char *filename)
+{
+ return make_new_name_generic(filename, "lzma");
+}
+
+static
+USE_DESKTOP(long long) int unpack_unlzma(void)
+{
+ return unlzma(STDIN_FILENO, STDOUT_FILENO);
+}
+
+int unlzma_main(int argc, char **argv);
+int unlzma_main(int argc, char **argv)
+{
+ getopt32(argc, argv, "c");
+ argv += optind;
+ /* lzmacat? */
+ if (applet_name[4] == 'c')
+ option_mask32 |= OPT_STDOUT;
+
+ return bbunpack(argv, make_new_name_unlzma, unpack_unlzma);
+}
+
+#endif
+
+
+/*
+ * Uncompress applet for busybox (c) 2002 Glenn McGrath
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#if ENABLE_UNCOMPRESS
+
+static
+char* make_new_name_uncompress(char *filename)
+{
+ return make_new_name_generic(filename, "Z");
+}
+
+static
+USE_DESKTOP(long long) int unpack_uncompress(void)
+{
+ USE_DESKTOP(long long) int status = -1;
+
+ if ((xread_char(STDIN_FILENO) != 0x1f) || (xread_char(STDIN_FILENO) != 0x9d)) {
+ bb_error_msg("invalid magic");
+ } else {
+ status = uncompress(STDIN_FILENO, STDOUT_FILENO);
+ }
+ return status;
+}
+
+int uncompress_main(int argc, char **argv);
+int uncompress_main(int argc, char **argv)
+{
+ getopt32(argc, argv, "cf");
+ argv += optind;
+
+ return bbunpack(argv, make_new_name_uncompress, unpack_uncompress);
+}
+
+#endif
diff --git a/i/pc104/initrd/conf/busybox/archival/cpio.c b/i/pc104/initrd/conf/busybox/archival/cpio.c
new file mode 100644
index 0000000..0113867
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/cpio.c
@@ -0,0 +1,87 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Mini cpio implementation for busybox
+ *
+ * Copyright (C) 2001 by Glenn McGrath
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ *
+ * Limitations:
+ * Doesn't check CRC's
+ * Only supports new ASCII and CRC formats
+ *
+ */
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "unarchive.h"
+#include "busybox.h"
+
+#define CPIO_OPT_EXTRACT 0x01
+#define CPIO_OPT_TEST 0x02
+#define CPIO_OPT_UNCONDITIONAL 0x04
+#define CPIO_OPT_VERBOSE 0x08
+#define CPIO_OPT_FILE 0x10
+#define CPIO_OPT_CREATE_LEADING_DIR 0x20
+#define CPIO_OPT_PRESERVE_MTIME 0x40
+
+int cpio_main(int argc, char **argv);
+int cpio_main(int argc, char **argv)
+{
+ archive_handle_t *archive_handle;
+ char *cpio_filename = NULL;
+ unsigned opt;
+
+ /* Initialise */
+ archive_handle = init_handle();
+ archive_handle->src_fd = STDIN_FILENO;
+ archive_handle->seek = seek_by_read;
+ archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE;
+
+ opt = getopt32(argc, argv, "ituvF:dm", &cpio_filename);
+
+ /* One of either extract or test options must be given */
+ if ((opt & (CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) {
+ bb_show_usage();
+ }
+
+ if (opt & CPIO_OPT_TEST) {
+ /* if both extract and test options are given, ignore extract option */
+ if (opt & CPIO_OPT_EXTRACT) {
+ opt &= ~CPIO_OPT_EXTRACT;
+ }
+ archive_handle->action_header = header_list;
+ }
+ if (opt & CPIO_OPT_EXTRACT) {
+ archive_handle->action_data = data_extract_all;
+ }
+ if (opt & CPIO_OPT_UNCONDITIONAL) {
+ archive_handle->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
+ archive_handle->flags &= ~ARCHIVE_EXTRACT_NEWER;
+ }
+ if (opt & CPIO_OPT_VERBOSE) {
+ if (archive_handle->action_header == header_list) {
+ archive_handle->action_header = header_verbose_list;
+ } else {
+ archive_handle->action_header = header_list;
+ }
+ }
+ if (cpio_filename) { /* CPIO_OPT_FILE */
+ archive_handle->src_fd = xopen(cpio_filename, O_RDONLY);
+ archive_handle->seek = seek_by_jump;
+ }
+ if (opt & CPIO_OPT_CREATE_LEADING_DIR) {
+ archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
+ }
+
+ while (optind < argc) {
+ archive_handle->filter = filter_accept_list;
+ llist_add_to(&(archive_handle->accept), argv[optind]);
+ optind++;
+ }
+
+ while (get_header_cpio(archive_handle) == EXIT_SUCCESS);
+
+ return EXIT_SUCCESS;
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/dpkg.c b/i/pc104/initrd/conf/busybox/archival/dpkg.c
new file mode 100644
index 0000000..0a42deb
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/dpkg.c
@@ -0,0 +1,1754 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * mini dpkg implementation for busybox.
+ * this is not meant as a replacement for dpkg
+ *
+ * written by glenn mcgrath with the help of others
+ * copyright (c) 2001 by glenn mcgrath
+ *
+ * started life as a busybox implementation of udpkg
+ *
+ * licensed under gplv2 or later, see file license in this tarball for details.
+ */
+
+/*
+ * known difference between busybox dpkg and the official dpkg that i don't
+ * consider important, its worth keeping a note of differences anyway, just to
+ * make it easier to maintain.
+ * - the first value for the confflile: field isnt placed on a new line.
+ * - when installing a package the status: field is placed at the end of the
+ * section, rather than just after the package: field.
+ *
+ * bugs that need to be fixed
+ * - (unknown, please let me know when you find any)
+ *
+ */
+
+#include "busybox.h"
+#include "unarchive.h"
+
+/* note: if you vary hash_prime sizes be aware,
+ * 1) tweaking these will have a big effect on how much memory this program uses.
+ * 2) for computational efficiency these hash tables should be at least 20%
+ * larger than the maximum number of elements stored in it.
+ * 3) all _hash_prime's must be a prime number or chaos is assured, if your looking
+ * for a prime, try http://www.utm.edu/research/primes/lists/small/10000.txt
+ * 4) if you go bigger than 15 bits you may get into trouble (untested) as its
+ * sometimes cast to an unsigned, if you go to 16 bit you will overlap
+ * int's and chaos is assured, 16381 is the max prime for 14 bit field
+ */
+
+/* NAME_HASH_PRIME, Stores package names and versions,
+ * I estimate it should be at least 50% bigger than PACKAGE_HASH_PRIME,
+ * as there a lot of duplicate version numbers */
+#define NAME_HASH_PRIME 16381
+
+/* PACKAGE_HASH_PRIME, Maximum number of unique packages,
+ * It must not be smaller than STATUS_HASH_PRIME,
+ * Currently only packages from status_hashtable are stored in here, but in
+ * future this may be used to store packages not only from a status file,
+ * but an available_hashtable, and even multiple packages files.
+ * Package can be stored more than once if they have different versions.
+ * e.g. The same package may have different versions in the status file
+ * and available file */
+#define PACKAGE_HASH_PRIME 10007
+typedef struct edge_s {
+ unsigned operator:3;
+ unsigned type:4;
+ unsigned name:14;
+ unsigned version:14;
+} edge_t;
+
+typedef struct common_node_s {
+ unsigned name:14;
+ unsigned version:14;
+ unsigned num_of_edges:14;
+ edge_t **edge;
+} common_node_t;
+
+/* Currently it doesnt store packages that have state-status of not-installed
+ * So it only really has to be the size of the maximum number of packages
+ * likely to be installed at any one time, so there is a bit of leeway here */
+#define STATUS_HASH_PRIME 8191
+typedef struct status_node_s {
+ unsigned package:14; /* has to fit PACKAGE_HASH_PRIME */
+ unsigned status:14; /* has to fit STATUS_HASH_PRIME */
+} status_node_t;
+
+/* Were statically declared here, but such a big bss is nommu-unfriendly */
+static char **name_hashtable; /* [NAME_HASH_PRIME + 1] */
+static common_node_t **package_hashtable; /* [PACKAGE_HASH_PRIME + 1] */
+static status_node_t **status_hashtable; /* [STATUS_HASH_PRIME + 1] */
+
+/* Even numbers are for 'extras', like ored dependencies or null */
+enum edge_type_e {
+ EDGE_NULL = 0,
+ EDGE_PRE_DEPENDS = 1,
+ EDGE_OR_PRE_DEPENDS = 2,
+ EDGE_DEPENDS = 3,
+ EDGE_OR_DEPENDS = 4,
+ EDGE_REPLACES = 5,
+ EDGE_PROVIDES = 7,
+ EDGE_CONFLICTS = 9,
+ EDGE_SUGGESTS = 11,
+ EDGE_RECOMMENDS = 13,
+ EDGE_ENHANCES = 15
+};
+enum operator_e {
+ VER_NULL = 0,
+ VER_EQUAL = 1,
+ VER_LESS = 2,
+ VER_LESS_EQUAL = 3,
+ VER_MORE = 4,
+ VER_MORE_EQUAL = 5,
+ VER_ANY = 6
+};
+
+typedef struct deb_file_s {
+ char *control_file;
+ char *filename;
+ unsigned package:14;
+} deb_file_t;
+
+
+static void make_hash(const char *key, unsigned *start, unsigned *decrement, const int hash_prime)
+{
+ unsigned long int hash_num = key[0];
+ int len = strlen(key);
+ int i;
+
+ /* Maybe i should have uses a "proper" hashing algorithm here instead
+ * of making one up myself, seems to be working ok though. */
+ for (i = 1; i < len; i++) {
+ /* shifts the ascii based value and adds it to previous value
+ * shift amount is mod 24 because long int is 32 bit and data
+ * to be shifted is 8, don't want to shift data to where it has
+ * no effect*/
+ hash_num += ((key[i] + key[i-1]) << ((key[i] * i) % 24));
+ }
+ *start = (unsigned) hash_num % hash_prime;
+ *decrement = (unsigned) 1 + (hash_num % (hash_prime - 1));
+}
+
+/* this adds the key to the hash table */
+static int search_name_hashtable(const char *key)
+{
+ unsigned probe_address = 0;
+ unsigned probe_decrement = 0;
+
+ make_hash(key, &probe_address, &probe_decrement, NAME_HASH_PRIME);
+ while (name_hashtable[probe_address] != NULL) {
+ if (strcmp(name_hashtable[probe_address], key) == 0) {
+ return probe_address;
+ }
+ probe_address -= probe_decrement;
+ if ((int)probe_address < 0) {
+ probe_address += NAME_HASH_PRIME;
+ }
+ }
+ name_hashtable[probe_address] = xstrdup(key);
+ return probe_address;
+}
+
+/* this DOESNT add the key to the hashtable
+ * TODO make it consistent with search_name_hashtable
+ */
+static unsigned search_status_hashtable(const char *key)
+{
+ unsigned probe_address = 0;
+ unsigned probe_decrement = 0;
+
+ make_hash(key, &probe_address, &probe_decrement, STATUS_HASH_PRIME);
+ while (status_hashtable[probe_address] != NULL) {
+ if (strcmp(key, name_hashtable[package_hashtable[status_hashtable[probe_address]->package]->name]) == 0) {
+ break;
+ }
+ probe_address -= probe_decrement;
+ if ((int)probe_address < 0) {
+ probe_address += STATUS_HASH_PRIME;
+ }
+ }
+ return probe_address;
+}
+
+/* Need to rethink version comparison, maybe the official dpkg has something i can use ? */
+static int version_compare_part(const char *version1, const char *version2)
+{
+ int upstream_len1 = 0;
+ int upstream_len2 = 0;
+ char *name1_char;
+ char *name2_char;
+ int len1 = 0;
+ int len2 = 0;
+ int tmp_int;
+ int ver_num1;
+ int ver_num2;
+
+ if (version1 == NULL) {
+ version1 = xstrdup("");
+ }
+ if (version2 == NULL) {
+ version2 = xstrdup("");
+ }
+ upstream_len1 = strlen(version1);
+ upstream_len2 = strlen(version2);
+
+ while ((len1 < upstream_len1) || (len2 < upstream_len2)) {
+ /* Compare non-digit section */
+ tmp_int = strcspn(&version1[len1], "0123456789");
+ name1_char = xstrndup(&version1[len1], tmp_int);
+ len1 += tmp_int;
+ tmp_int = strcspn(&version2[len2], "0123456789");
+ name2_char = xstrndup(&version2[len2], tmp_int);
+ len2 += tmp_int;
+ tmp_int = strcmp(name1_char, name2_char);
+ free(name1_char);
+ free(name2_char);
+ if (tmp_int != 0) {
+ return tmp_int;
+ }
+
+ /* Compare digits */
+ tmp_int = strspn(&version1[len1], "0123456789");
+ name1_char = xstrndup(&version1[len1], tmp_int);
+ len1 += tmp_int;
+ tmp_int = strspn(&version2[len2], "0123456789");
+ name2_char = xstrndup(&version2[len2], tmp_int);
+ len2 += tmp_int;
+ ver_num1 = atoi(name1_char);
+ ver_num2 = atoi(name2_char);
+ free(name1_char);
+ free(name2_char);
+ if (ver_num1 < ver_num2) {
+ return -1;
+ }
+ if (ver_num1 > ver_num2) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/* if ver1 < ver2 return -1,
+ * if ver1 = ver2 return 0,
+ * if ver1 > ver2 return 1,
+ */
+static int version_compare(const unsigned ver1, const unsigned ver2)
+{
+ char *ch_ver1 = name_hashtable[ver1];
+ char *ch_ver2 = name_hashtable[ver2];
+
+ char epoch1, epoch2;
+ char *deb_ver1, *deb_ver2;
+ char *ver1_ptr, *ver2_ptr;
+ char *upstream_ver1;
+ char *upstream_ver2;
+ int result;
+
+ /* Compare epoch */
+ if (ch_ver1[1] == ':') {
+ epoch1 = ch_ver1[0];
+ ver1_ptr = strchr(ch_ver1, ':') + 1;
+ } else {
+ epoch1 = '0';
+ ver1_ptr = ch_ver1;
+ }
+ if (ch_ver2[1] == ':') {
+ epoch2 = ch_ver2[0];
+ ver2_ptr = strchr(ch_ver2, ':') + 1;
+ } else {
+ epoch2 = '0';
+ ver2_ptr = ch_ver2;
+ }
+ if (epoch1 < epoch2) {
+ return -1;
+ }
+ else if (epoch1 > epoch2) {
+ return 1;
+ }
+
+ /* Compare upstream version */
+ upstream_ver1 = xstrdup(ver1_ptr);
+ upstream_ver2 = xstrdup(ver2_ptr);
+
+ /* Chop off debian version, and store for later use */
+ deb_ver1 = strrchr(upstream_ver1, '-');
+ deb_ver2 = strrchr(upstream_ver2, '-');
+ if (deb_ver1) {
+ deb_ver1[0] = '\0';
+ deb_ver1++;
+ }
+ if (deb_ver2) {
+ deb_ver2[0] = '\0';
+ deb_ver2++;
+ }
+ result = version_compare_part(upstream_ver1, upstream_ver2);
+ if (!result)
+ /* Compare debian versions */
+ result = version_compare_part(deb_ver1, deb_ver2);
+
+ free(upstream_ver1);
+ free(upstream_ver2);
+ return result;
+}
+
+static int test_version(const unsigned version1, const unsigned version2, const unsigned operator)
+{
+ const int version_result = version_compare(version1, version2);
+ switch (operator) {
+ case VER_ANY:
+ return TRUE;
+ case VER_EQUAL:
+ return (version_result == 0);
+ case VER_LESS:
+ return (version_result < 0);
+ case VER_LESS_EQUAL:
+ return (version_result <= 0);
+ case VER_MORE:
+ return (version_result > 0);
+ case VER_MORE_EQUAL:
+ return (version_result >= 0);
+ }
+ return FALSE;
+}
+
+
+static int search_package_hashtable(const unsigned name, const unsigned version, const unsigned operator)
+{
+ unsigned probe_address = 0;
+ unsigned probe_decrement = 0;
+
+ make_hash(name_hashtable[name], &probe_address, &probe_decrement, PACKAGE_HASH_PRIME);
+ while (package_hashtable[probe_address] != NULL) {
+ if (package_hashtable[probe_address]->name == name) {
+ if (operator == VER_ANY) {
+ return probe_address;
+ }
+ if (test_version(package_hashtable[probe_address]->version, version, operator)) {
+ return probe_address;
+ }
+ }
+ probe_address -= probe_decrement;
+ if ((int)probe_address < 0) {
+ probe_address += PACKAGE_HASH_PRIME;
+ }
+ }
+ return probe_address;
+}
+
+/*
+ * This function searches through the entire package_hashtable looking
+ * for a package which provides "needle". It returns the index into
+ * the package_hashtable for the providing package.
+ *
+ * needle is the index into name_hashtable of the package we are
+ * looking for.
+ *
+ * start_at is the index in the package_hashtable to start looking
+ * at. If start_at is -1 then start at the beginning. This is to allow
+ * for repeated searches since more than one package might provide
+ * needle.
+ *
+ * FIXME: I don't think this is very efficient, but I thought I'd keep
+ * it simple for now until it proves to be a problem.
+ */
+static int search_for_provides(int needle, int start_at) {
+ int i, j;
+ common_node_t *p;
+ for (i = start_at + 1; i < PACKAGE_HASH_PRIME; i++) {
+ p = package_hashtable[i];
+ if (p == NULL)
+ continue;
+ for (j = 0; j < p->num_of_edges; j++)
+ if (p->edge[j]->type == EDGE_PROVIDES && p->edge[j]->name == needle)
+ return i;
+ }
+ return -1;
+}
+
+/*
+ * Add an edge to a node
+ */
+static void add_edge_to_node(common_node_t *node, edge_t *edge)
+{
+ node->num_of_edges++;
+ node->edge = xrealloc(node->edge, sizeof(edge_t) * (node->num_of_edges + 1));
+ node->edge[node->num_of_edges - 1] = edge;
+}
+
+/*
+ * Create one new node and one new edge for every dependency.
+ *
+ * Dependencies which contain multiple alternatives are represented as
+ * an EDGE_OR_PRE_DEPENDS or EDGE_OR_DEPENDS node, followed by a
+ * number of EDGE_PRE_DEPENDS or EDGE_DEPENDS nodes. The name field of
+ * the OR edge contains the full dependency string while the version
+ * field contains the number of EDGE nodes which follow as part of
+ * this alternative.
+ */
+static void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned edge_type)
+{
+ char *line = xstrdup(whole_line);
+ char *line2;
+ char *line_ptr1 = NULL;
+ char *line_ptr2 = NULL;
+ char *field;
+ char *field2;
+ char *version;
+ edge_t *edge;
+ edge_t *or_edge;
+ int offset_ch;
+
+ field = strtok_r(line, ",", &line_ptr1);
+ do {
+ /* skip leading spaces */
+ field += strspn(field, " ");
+ line2 = xstrdup(field);
+ field2 = strtok_r(line2, "|", &line_ptr2);
+ or_edge = NULL;
+ if ((edge_type == EDGE_DEPENDS || edge_type == EDGE_PRE_DEPENDS)
+ && (strcmp(field, field2) != 0)
+ ) {
+ or_edge = xmalloc(sizeof(edge_t));
+ or_edge->type = edge_type + 1;
+ or_edge->name = search_name_hashtable(field);
+ or_edge->version = 0; // tracks the number of altenatives
+ add_edge_to_node(parent_node, or_edge);
+ }
+
+ do {
+ edge = xmalloc(sizeof(edge_t));
+ edge->type = edge_type;
+
+ /* Skip any extra leading spaces */
+ field2 += strspn(field2, " ");
+
+ /* Get dependency version info */
+ version = strchr(field2, '(');
+ if (version == NULL) {
+ edge->operator = VER_ANY;
+ /* Get the versions hash number, adding it if the number isnt already in there */
+ edge->version = search_name_hashtable("ANY");
+ } else {
+ /* Skip leading ' ' or '(' */
+ version += strspn(field2, " (");
+ /* Calculate length of any operator characters */
+ offset_ch = strspn(version, "<=>");
+ /* Determine operator */
+ if (offset_ch > 0) {
+ if (strncmp(version, "=", offset_ch) == 0) {
+ edge->operator = VER_EQUAL;
+ }
+ else if (strncmp(version, "<<", offset_ch) == 0) {
+ edge->operator = VER_LESS;
+ }
+ else if (strncmp(version, "<=", offset_ch) == 0) {
+ edge->operator = VER_LESS_EQUAL;
+ }
+ else if (strncmp(version, ">>", offset_ch) == 0) {
+ edge->operator = VER_MORE;
+ }
+ else if (strncmp(version, ">=", offset_ch) == 0) {
+ edge->operator = VER_MORE_EQUAL;
+ } else {
+ bb_error_msg_and_die("illegal operator");
+ }
+ }
+ /* skip to start of version numbers */
+ version += offset_ch;
+ version += strspn(version, " ");
+
+ /* Truncate version at trailing ' ' or ')' */
+ version[strcspn(version, " )")] = '\0';
+ /* Get the versions hash number, adding it if the number isnt already in there */
+ edge->version = search_name_hashtable(version);
+ }
+
+ /* Get the dependency name */
+ field2[strcspn(field2, " (")] = '\0';
+ edge->name = search_name_hashtable(field2);
+
+ if (or_edge)
+ or_edge->version++;
+
+ add_edge_to_node(parent_node, edge);
+ } while ((field2 = strtok_r(NULL, "|", &line_ptr2)) != NULL);
+ free(line2);
+ } while ((field = strtok_r(NULL, ",", &line_ptr1)) != NULL);
+ free(line);
+}
+
+static void free_package(common_node_t *node)
+{
+ unsigned i;
+ if (node) {
+ for (i = 0; i < node->num_of_edges; i++) {
+ free(node->edge[i]);
+ }
+ free(node->edge);
+ free(node);
+ }
+}
+
+/*
+ * Gets the next package field from package_buffer, seperated into the field name
+ * and field value, it returns the int offset to the first character of the next field
+ */
+static int read_package_field(const char *package_buffer, char **field_name, char **field_value)
+{
+ int offset_name_start = 0;
+ int offset_name_end = 0;
+ int offset_value_start = 0;
+ int offset_value_end = 0;
+ int offset = 0;
+ int next_offset;
+ int name_length;
+ int value_length;
+ int exit_flag = FALSE;
+
+ if (package_buffer == NULL) {
+ *field_name = NULL;
+ *field_value = NULL;
+ return -1;
+ }
+ while (1) {
+ next_offset = offset + 1;
+ switch (package_buffer[offset]) {
+ case '\0':
+ exit_flag = TRUE;
+ break;
+ case ':':
+ if (offset_name_end == 0) {
+ offset_name_end = offset;
+ offset_value_start = next_offset;
+ }
+ /* TODO: Name might still have trailing spaces if ':' isnt
+ * immediately after name */
+ break;
+ case '\n':
+ /* TODO: The char next_offset may be out of bounds */
+ if (package_buffer[next_offset] != ' ') {
+ exit_flag = TRUE;
+ break;
+ }
+ case '\t':
+ case ' ':
+ /* increment the value start point if its a just filler */
+ if (offset_name_start == offset) {
+ offset_name_start++;
+ }
+ if (offset_value_start == offset) {
+ offset_value_start++;
+ }
+ break;
+ }
+ if (exit_flag) {
+ /* Check that the names are valid */
+ offset_value_end = offset;
+ name_length = offset_name_end - offset_name_start;
+ value_length = offset_value_end - offset_value_start;
+ if (name_length == 0) {
+ break;
+ }
+ if ((name_length > 0) && (value_length > 0)) {
+ break;
+ }
+
+ /* If not valid, start fresh with next field */
+ exit_flag = FALSE;
+ offset_name_start = offset + 1;
+ offset_name_end = 0;
+ offset_value_start = offset + 1;
+ offset_value_end = offset + 1;
+ offset++;
+ }
+ offset++;
+ }
+ *field_name = NULL;
+ if (name_length) {
+ *field_name = xstrndup(&package_buffer[offset_name_start], name_length);
+ }
+ *field_value = NULL;
+ if (value_length > 0) {
+ *field_value = xstrndup(&package_buffer[offset_value_start], value_length);
+ }
+ return next_offset;
+}
+
+static unsigned fill_package_struct(char *control_buffer)
+{
+ static const char *const field_names[] = { "Package", "Version",
+ "Pre-Depends", "Depends","Replaces", "Provides",
+ "Conflicts", "Suggests", "Recommends", "Enhances", 0
+ };
+
+ common_node_t *new_node = xzalloc(sizeof(common_node_t));
+ char *field_name;
+ char *field_value;
+ int field_start = 0;
+ int num = -1;
+ int buffer_length = strlen(control_buffer);
+
+ new_node->version = search_name_hashtable("unknown");
+ while (field_start < buffer_length) {
+ unsigned field_num;
+
+ field_start += read_package_field(&control_buffer[field_start],
+ &field_name, &field_value);
+
+ if (field_name == NULL) {
+ goto fill_package_struct_cleanup; /* Oh no, the dreaded goto statement ! */
+ }
+
+ field_num = index_in_str_array(field_names, field_name);
+ switch (field_num) {
+ case 0: /* Package */
+ new_node->name = search_name_hashtable(field_value);
+ break;
+ case 1: /* Version */
+ new_node->version = search_name_hashtable(field_value);
+ break;
+ case 2: /* Pre-Depends */
+ add_split_dependencies(new_node, field_value, EDGE_PRE_DEPENDS);
+ break;
+ case 3: /* Depends */
+ add_split_dependencies(new_node, field_value, EDGE_DEPENDS);
+ break;
+ case 4: /* Replaces */
+ add_split_dependencies(new_node, field_value, EDGE_REPLACES);
+ break;
+ case 5: /* Provides */
+ add_split_dependencies(new_node, field_value, EDGE_PROVIDES);
+ break;
+ case 6: /* Conflicts */
+ add_split_dependencies(new_node, field_value, EDGE_CONFLICTS);
+ break;
+ case 7: /* Suggests */
+ add_split_dependencies(new_node, field_value, EDGE_SUGGESTS);
+ break;
+ case 8: /* Recommends */
+ add_split_dependencies(new_node, field_value, EDGE_RECOMMENDS);
+ break;
+ case 9: /* Enhances */
+ add_split_dependencies(new_node, field_value, EDGE_ENHANCES);
+ break;
+ }
+ fill_package_struct_cleanup:
+ free(field_name);
+ free(field_value);
+ }
+
+ if (new_node->version == search_name_hashtable("unknown")) {
+ free_package(new_node);
+ return -1;
+ }
+ num = search_package_hashtable(new_node->name, new_node->version, VER_EQUAL);
+ free_package(package_hashtable[num]);
+ package_hashtable[num] = new_node;
+ return num;
+}
+
+/* if num = 1, it returns the want status, 2 returns flag, 3 returns status */
+static unsigned get_status(const unsigned status_node, const int num)
+{
+ char *status_string = name_hashtable[status_hashtable[status_node]->status];
+ char *state_sub_string;
+ unsigned state_sub_num;
+ int len;
+ int i;
+
+ /* set tmp_string to point to the start of the word number */
+ for (i = 1; i < num; i++) {
+ /* skip past a word */
+ status_string += strcspn(status_string, " ");
+ /* skip past the separating spaces */
+ status_string += strspn(status_string, " ");
+ }
+ len = strcspn(status_string, " \n");
+ state_sub_string = xstrndup(status_string, len);
+ state_sub_num = search_name_hashtable(state_sub_string);
+ free(state_sub_string);
+ return state_sub_num;
+}
+
+static void set_status(const unsigned status_node_num, const char *new_value, const int position)
+{
+ const unsigned new_value_len = strlen(new_value);
+ const unsigned new_value_num = search_name_hashtable(new_value);
+ unsigned want = get_status(status_node_num, 1);
+ unsigned flag = get_status(status_node_num, 2);
+ unsigned status = get_status(status_node_num, 3);
+ int want_len = strlen(name_hashtable[want]);
+ int flag_len = strlen(name_hashtable[flag]);
+ int status_len = strlen(name_hashtable[status]);
+ char *new_status;
+
+ switch (position) {
+ case 1:
+ want = new_value_num;
+ want_len = new_value_len;
+ break;
+ case 2:
+ flag = new_value_num;
+ flag_len = new_value_len;
+ break;
+ case 3:
+ status = new_value_num;
+ status_len = new_value_len;
+ break;
+ default:
+ bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen");
+ }
+
+ new_status = xasprintf("%s %s %s", name_hashtable[want], name_hashtable[flag], name_hashtable[status]);
+ status_hashtable[status_node_num]->status = search_name_hashtable(new_status);
+ free(new_status);
+}
+
+static const char *describe_status(int status_num) {
+ int status_want, status_state ;
+ if (status_hashtable[status_num] == NULL || status_hashtable[status_num]->status == 0)
+ return "is not installed or flagged to be installed\n";
+
+ status_want = get_status(status_num, 1);
+ status_state = get_status(status_num, 3);
+
+ if (status_state == search_name_hashtable("installed")) {
+ if (status_want == search_name_hashtable("install"))
+ return "is installed";
+ if (status_want == search_name_hashtable("deinstall"))
+ return "is marked to be removed";
+ if (status_want == search_name_hashtable("purge"))
+ return "is marked to be purged";
+ }
+ if (status_want == search_name_hashtable("unknown"))
+ return "is in an indeterminate state";
+ if (status_want == search_name_hashtable("install"))
+ return "is marked to be installed";
+
+ return "is not installed or flagged to be installed";
+}
+
+
+static void index_status_file(const char *filename)
+{
+ FILE *status_file;
+ char *control_buffer;
+ char *status_line;
+ status_node_t *status_node = NULL;
+ unsigned status_num;
+
+ status_file = xfopen(filename, "r");
+ while ((control_buffer = xmalloc_fgets_str(status_file, "\n\n")) != NULL) {
+ const unsigned package_num = fill_package_struct(control_buffer);
+ if (package_num != -1) {
+ status_node = xmalloc(sizeof(status_node_t));
+ /* fill_package_struct doesnt handle the status field */
+ status_line = strstr(control_buffer, "Status:");
+ if (status_line != NULL) {
+ status_line += 7;
+ status_line += strspn(status_line, " \n\t");
+ status_line = xstrndup(status_line, strcspn(status_line, "\n"));
+ status_node->status = search_name_hashtable(status_line);
+ free(status_line);
+ }
+ status_node->package = package_num;
+ status_num = search_status_hashtable(name_hashtable[package_hashtable[status_node->package]->name]);
+ status_hashtable[status_num] = status_node;
+ }
+ free(control_buffer);
+ }
+ fclose(status_file);
+}
+
+static void write_buffer_no_status(FILE *new_status_file, const char *control_buffer)
+{
+ char *name;
+ char *value;
+ int start = 0;
+ while (1) {
+ start += read_package_field(&control_buffer[start], &name, &value);
+ if (name == NULL) {
+ break;
+ }
+ if (strcmp(name, "Status") != 0) {
+ fprintf(new_status_file, "%s: %s\n", name, value);
+ }
+ }
+}
+
+/* This could do with a cleanup */
+static void write_status_file(deb_file_t **deb_file)
+{
+ FILE *old_status_file = xfopen("/var/lib/dpkg/status", "r");
+ FILE *new_status_file = xfopen("/var/lib/dpkg/status.udeb", "w");
+ char *package_name;
+ char *status_from_file;
+ char *control_buffer = NULL;
+ char *tmp_string;
+ int status_num;
+ int field_start = 0;
+ int write_flag;
+ int i = 0;
+
+ /* Update previously known packages */
+ while ((control_buffer = xmalloc_fgets_str(old_status_file, "\n\n")) != NULL) {
+ if ((tmp_string = strstr(control_buffer, "Package:")) == NULL) {
+ continue;
+ }
+
+ tmp_string += 8;
+ tmp_string += strspn(tmp_string, " \n\t");
+ package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n"));
+ write_flag = FALSE;
+ tmp_string = strstr(control_buffer, "Status:");
+ if (tmp_string != NULL) {
+ /* Seperate the status value from the control buffer */
+ tmp_string += 7;
+ tmp_string += strspn(tmp_string, " \n\t");
+ status_from_file = xstrndup(tmp_string, strcspn(tmp_string, "\n"));
+ } else {
+ status_from_file = NULL;
+ }
+
+ /* Find this package in the status hashtable */
+ status_num = search_status_hashtable(package_name);
+ if (status_hashtable[status_num] != NULL) {
+ const char *status_from_hashtable = name_hashtable[status_hashtable[status_num]->status];
+ if (strcmp(status_from_file, status_from_hashtable) != 0) {
+ /* New status isnt exactly the same as old status */
+ const int state_status = get_status(status_num, 3);
+ if ((strcmp("installed", name_hashtable[state_status]) == 0) ||
+ (strcmp("unpacked", name_hashtable[state_status]) == 0)) {
+ /* We need to add the control file from the package */
+ i = 0;
+ while (deb_file[i] != NULL) {
+ if (strcmp(package_name, name_hashtable[package_hashtable[deb_file[i]->package]->name]) == 0) {
+ /* Write a status file entry with a modified status */
+ /* remove trailing \n's */
+ write_buffer_no_status(new_status_file, deb_file[i]->control_file);
+ set_status(status_num, "ok", 2);
+ fprintf(new_status_file, "Status: %s\n\n",
+ name_hashtable[status_hashtable[status_num]->status]);
+ write_flag = TRUE;
+ break;
+ }
+ i++;
+ }
+ /* This is temperary, debugging only */
+ if (deb_file[i] == NULL) {
+ bb_error_msg_and_die("ALERT: cannot find a control file, "
+ "your status file may be broken, status may be "
+ "incorrect for %s", package_name);
+ }
+ }
+ else if (strcmp("not-installed", name_hashtable[state_status]) == 0) {
+ /* Only write the Package, Status, Priority and Section lines */
+ fprintf(new_status_file, "Package: %s\n", package_name);
+ fprintf(new_status_file, "Status: %s\n", status_from_hashtable);
+
+ while (1) {
+ char *field_name;
+ char *field_value;
+ field_start += read_package_field(&control_buffer[field_start], &field_name, &field_value);
+ if (field_name == NULL) {
+ break;
+ }
+ if ((strcmp(field_name, "Priority") == 0) ||
+ (strcmp(field_name, "Section") == 0)) {
+ fprintf(new_status_file, "%s: %s\n", field_name, field_value);
+ }
+ }
+ write_flag = TRUE;
+ fputs("\n", new_status_file);
+ }
+ else if (strcmp("config-files", name_hashtable[state_status]) == 0) {
+ /* only change the status line */
+ while (1) {
+ char *field_name;
+ char *field_value;
+ field_start += read_package_field(&control_buffer[field_start], &field_name, &field_value);
+ if (field_name == NULL) {
+ break;
+ }
+ /* Setup start point for next field */
+ if (strcmp(field_name, "Status") == 0) {
+ fprintf(new_status_file, "Status: %s\n", status_from_hashtable);
+ } else {
+ fprintf(new_status_file, "%s: %s\n", field_name, field_value);
+ }
+ }
+ write_flag = TRUE;
+ fputs("\n", new_status_file);
+ }
+ }
+ }
+ /* If the package from the status file wasnt handle above, do it now*/
+ if (! write_flag) {
+ fprintf(new_status_file, "%s\n\n", control_buffer);
+ }
+
+ free(status_from_file);
+ free(package_name);
+ free(control_buffer);
+ }
+
+ /* Write any new packages */
+ for (i = 0; deb_file[i] != NULL; i++) {
+ status_num = search_status_hashtable(name_hashtable[package_hashtable[deb_file[i]->package]->name]);
+ if (strcmp("reinstreq", name_hashtable[get_status(status_num, 2)]) == 0) {
+ write_buffer_no_status(new_status_file, deb_file[i]->control_file);
+ set_status(status_num, "ok", 2);
+ fprintf(new_status_file, "Status: %s\n\n", name_hashtable[status_hashtable[status_num]->status]);
+ }
+ }
+ fclose(old_status_file);
+ fclose(new_status_file);
+
+
+ /* Create a separate backfile to dpkg */
+ if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
+ struct stat stat_buf;
+ xstat("/var/lib/dpkg/status", &stat_buf);
+ /* Its ok if renaming the status file fails because status
+ * file doesnt exist, maybe we are starting from scratch */
+ bb_error_msg("no status file found, creating new one");
+ }
+
+ if (rename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status") == -1) {
+ bb_error_msg_and_die("DANGER: cannot create status file, "
+ "you need to manually repair your status file");
+ }
+}
+
+/* This function returns TRUE if the given package can satisfy a
+ * dependency of type depend_type.
+ *
+ * A pre-depends is satisfied only if a package is already installed,
+ * which a regular depends can be satisfied by a package which we want
+ * to install.
+ */
+static int package_satisfies_dependency(int package, int depend_type)
+{
+ int status_num = search_status_hashtable(name_hashtable[package_hashtable[package]->name]);
+
+ /* status could be unknown if package is a pure virtual
+ * provides which cannot satisfy any dependency by itself.
+ */
+ if (status_hashtable[status_num] == NULL)
+ return 0;
+
+ switch (depend_type) {
+ case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed");
+ case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install");
+ }
+ return 0;
+}
+
+static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count)
+{
+ int *conflicts = NULL;
+ int conflicts_num = 0;
+ int i = deb_start;
+ int j;
+
+ /* Check for conflicts
+ * TODO: TEST if conflicts with other packages to be installed
+ *
+ * Add install packages and the packages they provide
+ * to the list of files to check conflicts for
+ */
+
+ /* Create array of package numbers to check against
+ * installed package for conflicts*/
+ while (deb_file[i] != NULL) {
+ const unsigned package_num = deb_file[i]->package;
+ conflicts = xrealloc(conflicts, sizeof(int) * (conflicts_num + 1));
+ conflicts[conflicts_num] = package_num;
+ conflicts_num++;
+ /* add provides to conflicts list */
+ for (j = 0; j < package_hashtable[package_num]->num_of_edges; j++) {
+ if (package_hashtable[package_num]->edge[j]->type == EDGE_PROVIDES) {
+ const int conflicts_package_num = search_package_hashtable(
+ package_hashtable[package_num]->edge[j]->name,
+ package_hashtable[package_num]->edge[j]->version,
+ package_hashtable[package_num]->edge[j]->operator);
+ if (package_hashtable[conflicts_package_num] == NULL) {
+ /* create a new package */
+ common_node_t *new_node = xzalloc(sizeof(common_node_t));
+ new_node->name = package_hashtable[package_num]->edge[j]->name;
+ new_node->version = package_hashtable[package_num]->edge[j]->version;
+ package_hashtable[conflicts_package_num] = new_node;
+ }
+ conflicts = xrealloc(conflicts, sizeof(int) * (conflicts_num + 1));
+ conflicts[conflicts_num] = conflicts_package_num;
+ conflicts_num++;
+ }
+ }
+ i++;
+ }
+
+ /* Check conflicts */
+ i = 0;
+ while (deb_file[i] != NULL) {
+ const common_node_t *package_node = package_hashtable[deb_file[i]->package];
+ int status_num = 0;
+ status_num = search_status_hashtable(name_hashtable[package_node->name]);
+
+ if (get_status(status_num, 3) == search_name_hashtable("installed")) {
+ i++;
+ continue;
+ }
+
+ for (j = 0; j < package_node->num_of_edges; j++) {
+ const edge_t *package_edge = package_node->edge[j];
+
+ if (package_edge->type == EDGE_CONFLICTS) {
+ const unsigned package_num =
+ search_package_hashtable(package_edge->name,
+ package_edge->version,
+ package_edge->operator);
+ int result = 0;
+ if (package_hashtable[package_num] != NULL) {
+ status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
+
+ if (get_status(status_num, 1) == search_name_hashtable("install")) {
+ result = test_version(package_hashtable[deb_file[i]->package]->version,
+ package_edge->version, package_edge->operator);
+ }
+ }
+
+ if (result) {
+ bb_error_msg_and_die("package %s conflicts with %s",
+ name_hashtable[package_node->name],
+ name_hashtable[package_edge->name]);
+ }
+ }
+ }
+ i++;
+ }
+
+
+ /* Check dependendcies */
+ for (i = 0; i < PACKAGE_HASH_PRIME; i++) {
+ int status_num = 0;
+ int number_of_alternatives = 0;
+ const edge_t * root_of_alternatives = NULL;
+ const common_node_t *package_node = package_hashtable[i];
+
+ /* If the package node does not exist then this
+ * package is a virtual one. In which case there are
+ * no dependencies to check.
+ */
+ if (package_node == NULL) continue;
+
+ status_num = search_status_hashtable(name_hashtable[package_node->name]);
+
+ /* If there is no status then this package is a
+ * virtual one provided by something else. In which
+ * case there are no dependencies to check.
+ */
+ if (status_hashtable[status_num] == NULL) continue;
+
+ /* If we don't want this package installed then we may
+ * as well ignore it's dependencies.
+ */
+ if (get_status(status_num, 1) != search_name_hashtable("install")) {
+ continue;
+ }
+
+ /* This code is tested only for EDGE_DEPENDS, since I
+ * have no suitable pre-depends available. There is no
+ * reason that it shouldn't work though :-)
+ */
+ for (j = 0; j < package_node->num_of_edges; j++) {
+ const edge_t *package_edge = package_node->edge[j];
+ unsigned package_num;
+
+ if (package_edge->type == EDGE_OR_PRE_DEPENDS ||
+ package_edge->type == EDGE_OR_DEPENDS) { /* start an EDGE_OR_ list */
+ number_of_alternatives = package_edge->version;
+ root_of_alternatives = package_edge;
+ continue;
+ } else if (number_of_alternatives == 0) { /* not in the middle of an EDGE_OR_ list */
+ number_of_alternatives = 1;
+ root_of_alternatives = NULL;
+ }
+
+ package_num = search_package_hashtable(package_edge->name, package_edge->version, package_edge->operator);
+
+ if (package_edge->type == EDGE_PRE_DEPENDS ||
+ package_edge->type == EDGE_DEPENDS) {
+ int result=1;
+ status_num = 0;
+
+ /* If we are inside an alternative then check
+ * this edge is the right type.
+ *
+ * EDGE_DEPENDS == OR_DEPENDS -1
+ * EDGE_PRE_DEPENDS == OR_PRE_DEPENDS -1
+ */
+ if (root_of_alternatives && package_edge->type != root_of_alternatives->type - 1)
+ bb_error_msg_and_die("fatal error, package dependencies corrupt: %d != %d - 1",
+ package_edge->type, root_of_alternatives->type);
+
+ if (package_hashtable[package_num] != NULL)
+ result = !package_satisfies_dependency(package_num, package_edge->type);
+
+ if (result) { /* check for other package which provide what we are looking for */
+ int provider = -1;
+
+ while ((provider = search_for_provides(package_edge->name, provider)) > -1) {
+ if (package_hashtable[provider] == NULL) {
+ puts("Have a provider but no package information for it");
+ continue;
+ }
+ result = !package_satisfies_dependency(provider, package_edge->type);
+
+ if (result == 0)
+ break;
+ }
+ }
+
+ /* It must be already installed, or to be installed */
+ number_of_alternatives--;
+ if (result && number_of_alternatives == 0) {
+ if (root_of_alternatives)
+ bb_error_msg_and_die(
+ "package %s %sdepends on %s, "
+ "which cannot be satisfied",
+ name_hashtable[package_node->name],
+ package_edge->type == EDGE_PRE_DEPENDS ? "pre-" : "",
+ name_hashtable[root_of_alternatives->name]);
+ else
+ bb_error_msg_and_die(
+ "package %s %sdepends on %s, which %s\n",
+ name_hashtable[package_node->name],
+ package_edge->type == EDGE_PRE_DEPENDS ? "pre-" : "",
+ name_hashtable[package_edge->name],
+ describe_status(status_num));
+ } else if (result == 0 && number_of_alternatives) {
+ /* we've found a package which
+ * satisfies the dependency,
+ * so skip over the rest of
+ * the alternatives.
+ */
+ j += number_of_alternatives;
+ number_of_alternatives = 0;
+ }
+ }
+ }
+ }
+ free(conflicts);
+ return TRUE;
+}
+
+static char **create_list(const char *filename)
+{
+ FILE *list_stream;
+ char **file_list = NULL;
+ char *line = NULL;
+ int count = 0;
+
+ /* don't use [xw]fopen here, handle error ourself */
+ list_stream = fopen(filename, "r");
+ if (list_stream == NULL) {
+ return NULL;
+ }
+
+ while ((line = xmalloc_getline(list_stream)) != NULL) {
+ file_list = xrealloc(file_list, sizeof(char *) * (count + 2));
+ file_list[count] = line;
+ count++;
+ }
+ fclose(list_stream);
+
+ if (count == 0) {
+ return NULL;
+ } else {
+ file_list[count] = NULL;
+ return file_list;
+ }
+}
+
+/* maybe i should try and hook this into remove_file.c somehow */
+static int remove_file_array(char **remove_names, char **exclude_names)
+{
+ struct stat path_stat;
+ int match_flag;
+ int remove_flag = FALSE;
+ int i,j;
+
+ if (remove_names == NULL) {
+ return FALSE;
+ }
+ for (i = 0; remove_names[i] != NULL; i++) {
+ match_flag = FALSE;
+ if (exclude_names != NULL) {
+ for (j = 0; exclude_names[j] != 0; j++) {
+ if (strcmp(remove_names[i], exclude_names[j]) == 0) {
+ match_flag = TRUE;
+ break;
+ }
+ }
+ }
+ if (!match_flag) {
+ if (lstat(remove_names[i], &path_stat) < 0) {
+ continue;
+ }
+ if (S_ISDIR(path_stat.st_mode)) {
+ if (rmdir(remove_names[i]) != -1) {
+ remove_flag = TRUE;
+ }
+ } else {
+ if (unlink(remove_names[i]) != -1) {
+ remove_flag = TRUE;
+ }
+ }
+ }
+ }
+ return remove_flag;
+}
+
+static int run_package_script(const char *package_name, const char *script_type)
+{
+ struct stat path_stat;
+ char *script_path;
+ int result;
+
+ script_path = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, script_type);
+
+ /* If the file doesnt exist is isnt a fatal */
+ result = lstat(script_path, &path_stat) < 0 ? EXIT_SUCCESS : system(script_path);
+ free(script_path);
+ return result;
+}
+
+static const char *all_control_files[] = {"preinst", "postinst", "prerm", "postrm",
+ "list", "md5sums", "shlibs", "conffiles", "config", "templates", NULL };
+
+static char **all_control_list(const char *package_name)
+{
+ unsigned i = 0;
+ char **remove_files;
+
+ /* Create a list of all /var/lib/dpkg/info/<package> files */
+ remove_files = xzalloc(sizeof(all_control_files));
+ while (all_control_files[i]) {
+ remove_files[i] = xasprintf("/var/lib/dpkg/info/%s.%s", package_name, all_control_files[i]);
+ i++;
+ }
+
+ return remove_files;
+}
+
+static void free_array(char **array)
+{
+
+ if (array) {
+ unsigned i = 0;
+ while (array[i]) {
+ free(array[i]);
+ i++;
+ }
+ free(array);
+ }
+}
+
+/* This function lists information on the installed packages. It loops through
+ * the status_hashtable to retrieve the info. This results in smaller code than
+ * scanning the status file. The resulting list, however, is unsorted.
+ */
+static void list_packages(void)
+{
+ int i;
+
+ puts(" Name Version");
+ puts("+++-==============-==============");
+
+ /* go through status hash, dereference package hash and finally strings */
+ for (i=0; i<STATUS_HASH_PRIME+1; i++) {
+
+ if (status_hashtable[i]) {
+ const char *stat_str; /* status string */
+ const char *name_str; /* package name */
+ const char *vers_str; /* version */
+ char s1, s2; /* status abbreviations */
+ int spccnt; /* space count */
+ int j;
+
+ stat_str = name_hashtable[status_hashtable[i]->status];
+ name_str = name_hashtable[package_hashtable[status_hashtable[i]->package]->name];
+ vers_str = name_hashtable[package_hashtable[status_hashtable[i]->package]->version];
+
+ /* get abbreviation for status field 1 */
+ s1 = stat_str[0] == 'i' ? 'i' : 'r';
+
+ /* get abbreviation for status field 2 */
+ for (j=0, spccnt=0; stat_str[j] && spccnt<2; j++) {
+ if (stat_str[j] == ' ') spccnt++;
+ }
+ s2 = stat_str[j];
+
+ /* print out the line formatted like Debian dpkg */
+ printf("%c%c %-14s %s\n", s1, s2, name_str, vers_str);
+ }
+ }
+}
+
+static void remove_package(const unsigned package_num, int noisy)
+{
+ const char *package_name = name_hashtable[package_hashtable[package_num]->name];
+ const char *package_version = name_hashtable[package_hashtable[package_num]->version];
+ const unsigned status_num = search_status_hashtable(package_name);
+ const int package_name_length = strlen(package_name);
+ char **remove_files;
+ char **exclude_files;
+ char list_name[package_name_length + 25];
+ char conffile_name[package_name_length + 30];
+ int return_value;
+
+ if (noisy)
+ printf("Removing %s (%s)...\n", package_name, package_version);
+
+ /* run prerm script */
+ return_value = run_package_script(package_name, "prerm");
+ if (return_value == -1) {
+ bb_error_msg_and_die("script failed, prerm failure");
+ }
+
+ /* Create a list of files to remove, and a separate list of those to keep */
+ sprintf(list_name, "/var/lib/dpkg/info/%s.list", package_name);
+ remove_files = create_list(list_name);
+
+ sprintf(conffile_name, "/var/lib/dpkg/info/%s.conffiles", package_name);
+ exclude_files = create_list(conffile_name);
+
+ /* Some directories can't be removed straight away, so do multiple passes */
+ while (remove_file_array(remove_files, exclude_files)) /*repeat */;
+ free_array(exclude_files);
+ free_array(remove_files);
+
+ /* Create a list of files in /var/lib/dpkg/info/<package>.* to keep */
+ exclude_files = xzalloc(sizeof(char*) * 3);
+ exclude_files[0] = xstrdup(conffile_name);
+ exclude_files[1] = xasprintf("/var/lib/dpkg/info/%s.postrm", package_name);
+
+ /* Create a list of all /var/lib/dpkg/info/<package> files */
+ remove_files = all_control_list(package_name);
+
+ remove_file_array(remove_files, exclude_files);
+ free_array(remove_files);
+ free_array(exclude_files);
+
+ /* rename <package>.conffile to <package>.list */
+ rename(conffile_name, list_name);
+
+ /* Change package status */
+ set_status(status_num, "config-files", 3);
+}
+
+static void purge_package(const unsigned package_num)
+{
+ const char *package_name = name_hashtable[package_hashtable[package_num]->name];
+ const char *package_version = name_hashtable[package_hashtable[package_num]->version];
+ const unsigned status_num = search_status_hashtable(package_name);
+ char **remove_files;
+ char **exclude_files;
+ char list_name[strlen(package_name) + 25];
+
+ printf("Purging %s (%s)...\n", package_name, package_version);
+
+ /* run prerm script */
+ if (run_package_script(package_name, "prerm") != 0) {
+ bb_error_msg_and_die("script failed, prerm failure");
+ }
+
+ /* Create a list of files to remove */
+ sprintf(list_name, "/var/lib/dpkg/info/%s.list", package_name);
+ remove_files = create_list(list_name);
+
+ exclude_files = xzalloc(sizeof(char*));
+
+ /* Some directories cant be removed straight away, so do multiple passes */
+ while (remove_file_array(remove_files, exclude_files)) /* repeat */;
+ free_array(remove_files);
+
+ /* Create a list of all /var/lib/dpkg/info/<package> files */
+ remove_files = all_control_list(package_name);
+ remove_file_array(remove_files, exclude_files);
+ free_array(remove_files);
+ free(exclude_files);
+
+ /* run postrm script */
+ if (run_package_script(package_name, "postrm") == -1) {
+ bb_error_msg_and_die("postrm fialure.. set status to what?");
+ }
+
+ /* Change package status */
+ set_status(status_num, "not-installed", 3);
+}
+
+static archive_handle_t *init_archive_deb_ar(const char *filename)
+{
+ archive_handle_t *ar_handle;
+
+ /* Setup an ar archive handle that refers to the gzip sub archive */
+ ar_handle = init_handle();
+ ar_handle->filter = filter_accept_list_reassign;
+ ar_handle->src_fd = xopen(filename, O_RDONLY);
+
+ return ar_handle;
+}
+
+static void init_archive_deb_control(archive_handle_t *ar_handle)
+{
+ archive_handle_t *tar_handle;
+
+ /* Setup the tar archive handle */
+ tar_handle = init_handle();
+ tar_handle->src_fd = ar_handle->src_fd;
+
+ /* We don't care about data.tar.* or debian-binary, just control.tar.* */
+#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+ llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz");
+#endif
+#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+ llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2");
+#endif
+
+ /* Assign the tar handle as a subarchive of the ar handle */
+ ar_handle->sub_archive = tar_handle;
+}
+
+static void init_archive_deb_data(archive_handle_t *ar_handle)
+{
+ archive_handle_t *tar_handle;
+
+ /* Setup the tar archive handle */
+ tar_handle = init_handle();
+ tar_handle->src_fd = ar_handle->src_fd;
+
+ /* We don't care about control.tar.* or debian-binary, just data.tar.* */
+#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+ llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz");
+#endif
+#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+ llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2");
+#endif
+
+ /* Assign the tar handle as a subarchive of the ar handle */
+ ar_handle->sub_archive = tar_handle;
+}
+
+static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *myaccept)
+{
+ ar_handle->sub_archive->action_data = data_extract_to_buffer;
+ ar_handle->sub_archive->accept = myaccept;
+ ar_handle->sub_archive->filter = filter_accept_list;
+
+ unpack_ar_archive(ar_handle);
+ close(ar_handle->src_fd);
+
+ return ar_handle->sub_archive->buffer;
+}
+
+static void data_extract_all_prefix(archive_handle_t *archive_handle)
+{
+ char *name_ptr = archive_handle->file_header->name;
+
+ name_ptr += strspn(name_ptr, "./");
+ if (name_ptr[0] != '\0') {
+ archive_handle->file_header->name = xasprintf("%s%s", archive_handle->buffer, name_ptr);
+ data_extract_all(archive_handle);
+ }
+}
+
+static void unpack_package(deb_file_t *deb_file)
+{
+ const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name];
+ const unsigned status_num = search_status_hashtable(package_name);
+ const unsigned status_package_num = status_hashtable[status_num]->package;
+ char *info_prefix;
+ char *list_filename;
+ archive_handle_t *archive_handle;
+ FILE *out_stream;
+ llist_t *accept_list = NULL;
+ int i = 0;
+
+ /* If existing version, remove it first */
+ if (strcmp(name_hashtable[get_status(status_num, 3)], "installed") == 0) {
+ /* Package is already installed, remove old version first */
+ printf("Preparing to replace %s %s (using %s)...\n", package_name,
+ name_hashtable[package_hashtable[status_package_num]->version],
+ deb_file->filename);
+ remove_package(status_package_num, 0);
+ } else {
+ printf("Unpacking %s (from %s)...\n", package_name, deb_file->filename);
+ }
+
+ /* Extract control.tar.gz to /var/lib/dpkg/info/<package>.filename */
+ info_prefix = xasprintf("/var/lib/dpkg/info/%s.", package_name);
+ archive_handle = init_archive_deb_ar(deb_file->filename);
+ init_archive_deb_control(archive_handle);
+
+ while (all_control_files[i]) {
+ char *c = xasprintf("./%s", all_control_files[i]);
+ llist_add_to(&accept_list, c);
+ i++;
+ }
+ archive_handle->sub_archive->accept = accept_list;
+ archive_handle->sub_archive->filter = filter_accept_list;
+ archive_handle->sub_archive->action_data = data_extract_all_prefix;
+ archive_handle->sub_archive->buffer = info_prefix;
+ archive_handle->sub_archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
+ unpack_ar_archive(archive_handle);
+
+ /* Run the preinst prior to extracting */
+ if (run_package_script(package_name, "preinst") != 0) {
+ /* when preinst returns exit code != 0 then quit installation process */
+ bb_error_msg_and_die("subprocess pre-installation script returned error");
+ }
+
+ /* Extract data.tar.gz to the root directory */
+ archive_handle = init_archive_deb_ar(deb_file->filename);
+ init_archive_deb_data(archive_handle);
+ archive_handle->sub_archive->action_data = data_extract_all_prefix;
+ archive_handle->sub_archive->buffer = (char*)"/"; /* huh? */
+ archive_handle->sub_archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
+ unpack_ar_archive(archive_handle);
+
+ /* Create the list file */
+ list_filename = xasprintf("/var/lib/dpkg/info/%s.list", package_name);
+ out_stream = xfopen(list_filename, "w");
+ while (archive_handle->sub_archive->passed) {
+ /* the leading . has been stripped by data_extract_all_prefix already */
+ fputs(archive_handle->sub_archive->passed->data, out_stream);
+ fputc('\n', out_stream);
+ archive_handle->sub_archive->passed = archive_handle->sub_archive->passed->link;
+ }
+ fclose(out_stream);
+
+ /* change status */
+ set_status(status_num, "install", 1);
+ set_status(status_num, "unpacked", 3);
+
+ free(info_prefix);
+ free(list_filename);
+}
+
+static void configure_package(deb_file_t *deb_file)
+{
+ const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name];
+ const char *package_version = name_hashtable[package_hashtable[deb_file->package]->version];
+ const int status_num = search_status_hashtable(package_name);
+
+ printf("Setting up %s (%s)...\n", package_name, package_version);
+
+ /* Run the postinst script */
+ if (run_package_script(package_name, "postinst") != 0) {
+ /* TODO: handle failure gracefully */
+ bb_error_msg_and_die("postrm failure.. set status to what?");
+ }
+ /* Change status to reflect success */
+ set_status(status_num, "install", 1);
+ set_status(status_num, "installed", 3);
+}
+
+int dpkg_main(int argc, char **argv);
+int dpkg_main(int argc, char **argv)
+{
+ deb_file_t **deb_file = NULL;
+ status_node_t *status_node;
+ char *str_f;
+ int opt;
+ int package_num;
+ int deb_count = 0;
+ int state_status;
+ int status_num;
+ int i;
+ enum {
+ OPT_configure = 0x1,
+ OPT_force_ignore_depends = 0x2,
+ OPT_install = 0x4,
+ OPT_list_installed = 0x8,
+ OPT_purge = 0x10,
+ OPT_remove = 0x20,
+ OPT_unpack = 0x40,
+ };
+
+ opt = getopt32(argc, argv, "CF:ilPru", &str_f);
+ //if (opt & OPT_configure) ... // -C
+ if (opt & OPT_force_ignore_depends) { // -F (--force in official dpkg)
+ if (strcmp(str_f, "depends"))
+ opt &= ~OPT_force_ignore_depends;
+ }
+ //if (opt & OPT_install) ... // -i
+ //if (opt & OPT_list_installed) ... // -l
+ //if (opt & OPT_purge) ... // -P
+ //if (opt & OPT_remove) ... // -r
+ //if (opt & OPT_unpack) ... // -u (--unpack in official dpkg)
+ argc -= optind;
+ argv += optind;
+ /* check for non-option argument if expected */
+ if (!opt || (!argc && !(opt && OPT_list_installed)))
+ bb_show_usage();
+
+ name_hashtable = xzalloc(sizeof(name_hashtable[0]) * (NAME_HASH_PRIME + 1));
+ package_hashtable = xzalloc(sizeof(package_hashtable[0]) * (PACKAGE_HASH_PRIME + 1));
+ status_hashtable = xzalloc(sizeof(status_hashtable[0]) * (STATUS_HASH_PRIME + 1));
+
+/* puts("(Reading database ... xxxxx files and directories installed.)"); */
+ index_status_file("/var/lib/dpkg/status");
+
+ /* if the list action was given print the installed packages and exit */
+ if (opt & OPT_list_installed) {
+ list_packages();
+ return EXIT_SUCCESS;
+ }
+
+ /* Read arguments and store relevant info in structs */
+ while (*argv) {
+ /* deb_count = nb_elem - 1 and we need nb_elem + 1 to allocate terminal node [NULL pointer] */
+ deb_file = xrealloc(deb_file, sizeof(deb_file[0]) * (deb_count + 2));
+ deb_file[deb_count] = xzalloc(sizeof(deb_file[0][0]));
+ if (opt & (OPT_install | OPT_unpack)) {
+ /* -i/-u: require filename */
+ archive_handle_t *archive_handle;
+ llist_t *control_list = NULL;
+
+ /* Extract the control file */
+ llist_add_to(&control_list, (char*)"./control");
+ archive_handle = init_archive_deb_ar(argv[0]);
+ init_archive_deb_control(archive_handle);
+ deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list);
+ if (deb_file[deb_count]->control_file == NULL) {
+ bb_error_msg_and_die("cannot extract control file");
+ }
+ deb_file[deb_count]->filename = xstrdup(argv[0]);
+ package_num = fill_package_struct(deb_file[deb_count]->control_file);
+
+ if (package_num == -1) {
+ bb_error_msg("invalid control file in %s", argv[0]);
+ argv++;
+ continue;
+ }
+ deb_file[deb_count]->package = (unsigned) package_num;
+
+ /* Add the package to the status hashtable */
+ if (opt & (OPT_unpack | OPT_install)) {
+ /* Try and find a currently installed version of this package */
+ status_num = search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
+ /* If no previous entry was found initialise a new entry */
+ if (status_hashtable[status_num] == NULL
+ || status_hashtable[status_num]->status == 0
+ ) {
+ status_node = xmalloc(sizeof(status_node_t));
+ status_node->package = deb_file[deb_count]->package;
+ /* reinstreq isnt changed to "ok" until the package control info
+ * is written to the status file*/
+ status_node->status = search_name_hashtable("install reinstreq not-installed");
+ status_hashtable[status_num] = status_node;
+ } else {
+ set_status(status_num, "install", 1);
+ set_status(status_num, "reinstreq", 2);
+ }
+ }
+ } else if (opt & (OPT_configure | OPT_purge | OPT_remove)) {
+ /* -C/-p/-r: require package name */
+ deb_file[deb_count]->package = search_package_hashtable(
+ search_name_hashtable(argv[0]),
+ search_name_hashtable("ANY"), VER_ANY);
+ if (package_hashtable[deb_file[deb_count]->package] == NULL) {
+ bb_error_msg_and_die("package %s is uninstalled or unknown", argv[0]);
+ }
+ package_num = deb_file[deb_count]->package;
+ status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
+ state_status = get_status(status_num, 3);
+
+ /* check package status is "installed" */
+ if (opt & OPT_remove) {
+ if (strcmp(name_hashtable[state_status], "not-installed") == 0
+ || strcmp(name_hashtable[state_status], "config-files") == 0
+ ) {
+ bb_error_msg_and_die("%s is already removed", name_hashtable[package_hashtable[package_num]->name]);
+ }
+ set_status(status_num, "deinstall", 1);
+ } else if (opt & OPT_purge) {
+ /* if package status is "conf-files" then its ok */
+ if (strcmp(name_hashtable[state_status], "not-installed") == 0) {
+ bb_error_msg_and_die("%s is already purged", name_hashtable[package_hashtable[package_num]->name]);
+ }
+ set_status(status_num, "purge", 1);
+ }
+ }
+ deb_count++;
+ argv++;
+ }
+ if (!deb_count)
+ bb_error_msg_and_die("no package files specified");
+ deb_file[deb_count] = NULL;
+
+ /* Check that the deb file arguments are installable */
+ if (!(opt & OPT_force_ignore_depends)) {
+ if (!check_deps(deb_file, 0, deb_count)) {
+ bb_error_msg_and_die("dependency check failed");
+ }
+ }
+
+ /* TODO: install or remove packages in the correct dependency order */
+ for (i = 0; i < deb_count; i++) {
+ /* Remove or purge packages */
+ if (opt & OPT_remove) {
+ remove_package(deb_file[i]->package, 1);
+ }
+ else if (opt & OPT_purge) {
+ purge_package(deb_file[i]->package);
+ }
+ else if (opt & OPT_unpack) {
+ unpack_package(deb_file[i]);
+ }
+ else if (opt & OPT_install) {
+ unpack_package(deb_file[i]);
+ /* package is configured in second pass below */
+ }
+ else if (opt & OPT_configure) {
+ configure_package(deb_file[i]);
+ }
+ }
+ /* configure installed packages */
+ if (opt & OPT_install) {
+ for (i = 0; i < deb_count; i++)
+ configure_package(deb_file[i]);
+ }
+
+ write_status_file(deb_file);
+
+ if (ENABLE_FEATURE_CLEAN_UP) {
+ for (i = 0; i < deb_count; i++) {
+ free(deb_file[i]->control_file);
+ free(deb_file[i]->filename);
+ free(deb_file[i]);
+ }
+
+ free(deb_file);
+
+ for (i = 0; i < NAME_HASH_PRIME; i++) {
+ free(name_hashtable[i]);
+ }
+
+ for (i = 0; i < PACKAGE_HASH_PRIME; i++) {
+ free_package(package_hashtable[i]);
+ }
+
+ for (i = 0; i < STATUS_HASH_PRIME; i++) {
+ free(status_hashtable[i]);
+ }
+
+ free(status_hashtable);
+ free(package_hashtable);
+ free(name_hashtable);
+ }
+
+ return EXIT_SUCCESS;
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/dpkg_deb.c b/i/pc104/initrd/conf/busybox/archival/dpkg_deb.c
new file mode 100644
index 0000000..fde3c33
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/dpkg_deb.c
@@ -0,0 +1,97 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * dpkg-deb packs, unpacks and provides information about Debian archives.
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+#include "busybox.h"
+#include "unarchive.h"
+
+#define DPKG_DEB_OPT_CONTENTS 1
+#define DPKG_DEB_OPT_CONTROL 2
+#define DPKG_DEB_OPT_FIELD 4
+#define DPKG_DEB_OPT_EXTRACT 8
+#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16
+
+int dpkg_deb_main(int argc, char **argv);
+int dpkg_deb_main(int argc, char **argv)
+{
+ archive_handle_t *ar_archive;
+ archive_handle_t *tar_archive;
+ llist_t *control_tar_llist = NULL;
+ unsigned opt;
+ const char *extract_dir = NULL;
+ short argcount = 1;
+
+ /* Setup the tar archive handle */
+ tar_archive = init_handle();
+
+ /* Setup an ar archive handle that refers to the gzip sub archive */
+ ar_archive = init_handle();
+ ar_archive->sub_archive = tar_archive;
+ ar_archive->filter = filter_accept_list_reassign;
+
+#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+ llist_add_to(&(ar_archive->accept), (char*)"data.tar.gz");
+ llist_add_to(&control_tar_llist, (char*)"control.tar.gz");
+#endif
+
+#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+ llist_add_to(&(ar_archive->accept), (char*)"data.tar.bz2");
+ llist_add_to(&control_tar_llist, (char*)"control.tar.bz2");
+#endif
+
+ opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
+ opt = getopt32(argc, argv, "cefXx");
+
+ if (opt & DPKG_DEB_OPT_CONTENTS) {
+ tar_archive->action_header = header_verbose_list;
+ }
+ if (opt & DPKG_DEB_OPT_CONTROL) {
+ ar_archive->accept = control_tar_llist;
+ tar_archive->action_data = data_extract_all;
+ if (optind + 1 == argc) {
+ extract_dir = "./DEBIAN";
+ } else {
+ argcount++;
+ }
+ }
+ if (opt & DPKG_DEB_OPT_FIELD) {
+ /* Print the entire control file
+ * it should accept a second argument which specifies a
+ * specific field to print */
+ ar_archive->accept = control_tar_llist;
+ llist_add_to(&(tar_archive->accept), (char*)"./control");
+ tar_archive->filter = filter_accept_list;
+ tar_archive->action_data = data_extract_to_stdout;
+ }
+ if (opt & DPKG_DEB_OPT_EXTRACT) {
+ tar_archive->action_header = header_list;
+ }
+ if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) {
+ tar_archive->action_data = data_extract_all;
+ argcount = 2;
+ }
+
+ if ((optind + argcount) != argc) {
+ bb_show_usage();
+ }
+
+ tar_archive->src_fd = ar_archive->src_fd = xopen(argv[optind++], O_RDONLY);
+
+ /* Workout where to extract the files */
+ /* 2nd argument is a dir name */
+ if (argv[optind]) {
+ extract_dir = argv[optind];
+ }
+ if (extract_dir) {
+ mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */
+ xchdir(extract_dir);
+ }
+ unpack_ar_archive(ar_archive);
+
+ /* Cleanup */
+ close(ar_archive->src_fd);
+
+ return EXIT_SUCCESS;
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/gzip.c b/i/pc104/initrd/conf/busybox/archival/gzip.c
new file mode 100644
index 0000000..39391df
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/gzip.c
@@ -0,0 +1,2085 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Gzip implementation for busybox
+ *
+ * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
+ *
+ * Originally adjusted for busybox by Charles P. Wright <cpw@unix.asb.com>
+ * "this is a stripped down version of gzip I put into busybox, it does
+ * only standard in to standard out with -9 compression. It also requires
+ * the zcat module for some important functions."
+ *
+ * Adjusted further by Erik Andersen <andersen@codepoet.org> to support
+ * files as well as stdin/stdout, and to generally behave itself wrt
+ * command line handling.
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+/* big objects in bss:
+ * 00000020 b bl_count
+ * 00000074 b base_length
+ * 00000078 b base_dist
+ * 00000078 b static_dtree
+ * 0000009c b bl_tree
+ * 000000f4 b dyn_dtree
+ * 00000100 b length_code
+ * 00000200 b dist_code
+ * 0000023d b depth
+ * 00000400 b flag_buf
+ * 0000047a b heap
+ * 00000480 b static_ltree
+ * 000008f4 b dyn_ltree
+ */
+
+/* TODO: full support for -v for DESKTOP
+ * "/usr/bin/gzip -v a bogus aa" should say:
+a: 85.1% -- replaced with a.gz
+gzip: bogus: No such file or directory
+aa: 85.1% -- replaced with aa.gz
+*/
+
+#include "busybox.h"
+
+
+/* ===========================================================================
+ */
+//#define DEBUG 1
+/* Diagnostic functions */
+#ifdef DEBUG
+# define Assert(cond,msg) {if(!(cond)) bb_error_msg(msg);}
+# define Trace(x) fprintf x
+# define Tracev(x) {if (verbose) fprintf x ;}
+# define Tracevv(x) {if (verbose > 1) fprintf x ;}
+# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
+# define Tracecv(c,x) {if (verbose > 1 && (c)) fprintf x ;}
+#else
+# define Assert(cond,msg)
+# define Trace(x)
+# define Tracev(x)
+# define Tracevv(x)
+# define Tracec(c,x)
+# define Tracecv(c,x)
+#endif
+
+
+/* ===========================================================================
+ */
+#define SMALL_MEM
+
+#ifndef INBUFSIZ
+# ifdef SMALL_MEM
+# define INBUFSIZ 0x2000 /* input buffer size */
+# else
+# define INBUFSIZ 0x8000 /* input buffer size */
+# endif
+#endif
+
+#ifndef OUTBUFSIZ
+# ifdef SMALL_MEM
+# define OUTBUFSIZ 8192 /* output buffer size */
+# else
+# define OUTBUFSIZ 16384 /* output buffer size */
+# endif
+#endif
+
+#ifndef DIST_BUFSIZE
+# ifdef SMALL_MEM
+# define DIST_BUFSIZE 0x2000 /* buffer for distances, see trees.c */
+# else
+# define DIST_BUFSIZE 0x8000 /* buffer for distances, see trees.c */
+# endif
+#endif
+
+/* gzip flag byte */
+#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
+#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
+#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
+#define COMMENT 0x10 /* bit 4 set: file comment present */
+#define RESERVED 0xC0 /* bit 6,7: reserved */
+
+/* internal file attribute */
+#define UNKNOWN 0xffff
+#define BINARY 0
+#define ASCII 1
+
+#ifndef WSIZE
+# define WSIZE 0x8000 /* window size--must be a power of two, and */
+#endif /* at least 32K for zip's deflate method */
+
+#define MIN_MATCH 3
+#define MAX_MATCH 258
+/* The minimum and maximum match lengths */
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST (WSIZE-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+#ifndef MAX_PATH_LEN
+# define MAX_PATH_LEN 1024 /* max pathname length */
+#endif
+
+#define seekable() 0 /* force sequential output */
+#define translate_eol 0 /* no option -a yet */
+
+#ifndef BITS
+# define BITS 16
+#endif
+#define INIT_BITS 9 /* Initial number of bits per code */
+
+#define BIT_MASK 0x1f /* Mask for 'number of compression bits' */
+/* Mask 0x20 is reserved to mean a fourth header byte, and 0x40 is free.
+ * It's a pity that old uncompress does not check bit 0x20. That makes
+ * extension of the format actually undesirable because old compress
+ * would just crash on the new format instead of giving a meaningful
+ * error message. It does check the number of bits, but it's more
+ * helpful to say "unsupported format, get a new version" than
+ * "can only handle 16 bits".
+ */
+
+#ifdef MAX_EXT_CHARS
+# define MAX_SUFFIX MAX_EXT_CHARS
+#else
+# define MAX_SUFFIX 30
+#endif
+
+
+/* ===========================================================================
+ * Compile with MEDIUM_MEM to reduce the memory requirements or
+ * with SMALL_MEM to use as little memory as possible. Use BIG_MEM if the
+ * entire input file can be held in memory (not possible on 16 bit systems).
+ * Warning: defining these symbols affects HASH_BITS (see below) and thus
+ * affects the compression ratio. The compressed output
+ * is still correct, and might even be smaller in some cases.
+ */
+
+#ifdef SMALL_MEM
+# define HASH_BITS 13 /* Number of bits used to hash strings */
+#endif
+#ifdef MEDIUM_MEM
+# define HASH_BITS 14
+#endif
+#ifndef HASH_BITS
+# define HASH_BITS 15
+ /* For portability to 16 bit machines, do not use values above 15. */
+#endif
+
+#define HASH_SIZE (unsigned)(1<<HASH_BITS)
+#define HASH_MASK (HASH_SIZE-1)
+#define WMASK (WSIZE-1)
+/* HASH_SIZE and WSIZE must be powers of two */
+#ifndef TOO_FAR
+# define TOO_FAR 4096
+#endif
+/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
+
+/* ===========================================================================
+ * These types are not really 'char', 'short' and 'long'
+ */
+typedef uint8_t uch;
+typedef uint16_t ush;
+typedef uint32_t ulg;
+typedef int32_t lng;
+
+typedef ush Pos;
+typedef unsigned IPos;
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+enum {
+ WINDOW_SIZE = 2 * WSIZE,
+/* window size, 2*WSIZE except for MMAP or BIG_MEM, where it is the
+ * input file length plus MIN_LOOKAHEAD.
+ */
+
+ max_chain_length = 4096,
+/* To speed up deflation, hash chains are never searched beyond this length.
+ * A higher limit improves compression ratio but degrades the speed.
+ */
+
+ max_lazy_match = 258,
+/* Attempt to find a better match only when the current match is strictly
+ * smaller than this value. This mechanism is used only for compression
+ * levels >= 4.
+ */
+
+ max_insert_length = max_lazy_match,
+/* Insert new strings in the hash table only if the match length
+ * is not greater than this length. This saves time but degrades compression.
+ * max_insert_length is used only for compression levels <= 3.
+ */
+
+ good_match = 32,
+/* Use a faster search when the previous match is longer than this */
+
+/* Values for max_lazy_match, good_match and max_chain_length, depending on
+ * the desired pack level (0..9). The values given below have been tuned to
+ * exclude worst case performance for pathological files. Better values may be
+ * found for specific files.
+ */
+
+ nice_match = 258, /* Stop searching when current match exceeds this */
+/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
+ * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
+ * meaning.
+ */
+};
+
+
+struct globals {
+
+ lng block_start;
+
+/* window position at the beginning of the current output block. Gets
+ * negative when the window is moved backwards.
+ */
+ unsigned ins_h; /* hash index of string to be inserted */
+
+#define H_SHIFT ((HASH_BITS+MIN_MATCH-1) / MIN_MATCH)
+/* Number of bits by which ins_h and del_h must be shifted at each
+ * input step. It must be such that after MIN_MATCH steps, the oldest
+ * byte no longer takes part in the hash key, that is:
+ * H_SHIFT * MIN_MATCH >= HASH_BITS
+ */
+
+ unsigned prev_length;
+
+/* Length of the best match at previous step. Matches not greater than this
+ * are discarded. This is used in the lazy match evaluation.
+ */
+
+ unsigned strstart; /* start of string to insert */
+ unsigned match_start; /* start of matching string */
+ unsigned lookahead; /* number of valid bytes ahead in window */
+
+/* ===========================================================================
+ */
+#define DECLARE(type, array, size) \
+ type * array
+#define ALLOC(type, array, size) \
+ array = xzalloc((size_t)(((size)+1L)/2) * 2*sizeof(type));
+#define FREE(array) \
+ do { free(array); array = NULL; } while (0)
+
+ /* global buffers */
+
+ /* buffer for literals or lengths */
+ /* DECLARE(uch, l_buf, LIT_BUFSIZE); */
+ DECLARE(uch, l_buf, INBUFSIZ);
+
+ DECLARE(ush, d_buf, DIST_BUFSIZE);
+ DECLARE(uch, outbuf, OUTBUFSIZ);
+
+/* Sliding window. Input bytes are read into the second half of the window,
+ * and move to the first half later to keep a dictionary of at least WSIZE
+ * bytes. With this organization, matches are limited to a distance of
+ * WSIZE-MAX_MATCH bytes, but this ensures that IO is always
+ * performed with a length multiple of the block size. Also, it limits
+ * the window size to 64K, which is quite useful on MSDOS.
+ * To do: limit the window size to WSIZE+BSZ if SMALL_MEM (the code would
+ * be less efficient).
+ */
+ DECLARE(uch, window, 2L * WSIZE);
+
+/* Link to older string with same hash index. To limit the size of this
+ * array to 64K, this link is maintained only for the last 32K strings.
+ * An index in this array is thus a window index modulo 32K.
+ */
+ /* DECLARE(Pos, prev, WSIZE); */
+ DECLARE(ush, prev, 1L << BITS);
+
+/* Heads of the hash chains or 0. */
+ /* DECLARE(Pos, head, 1<<HASH_BITS); */
+#define head (G1.prev + WSIZE) /* hash head (see deflate.c) */
+
+/* number of input bytes */
+ ulg isize; /* only 32 bits stored in .gz file */
+
+/* bbox always use stdin/stdout */
+#define ifd STDIN_FILENO /* input file descriptor */
+#define ofd STDOUT_FILENO /* output file descriptor */
+
+#ifdef DEBUG
+ unsigned insize; /* valid bytes in l_buf */
+#endif
+ unsigned outcnt; /* bytes in output buffer */
+
+ smallint eofile; /* flag set at end of input file */
+
+/* ===========================================================================
+ * Local data used by the "bit string" routines.
+ */
+
+ unsigned short bi_buf;
+
+/* Output buffer. bits are inserted starting at the bottom (least significant
+ * bits).
+ */
+
+#undef BUF_SIZE
+#define BUF_SIZE (8 * sizeof(G1.bi_buf))
+/* Number of bits used within bi_buf. (bi_buf might be implemented on
+ * more than 16 bits on some systems.)
+ */
+
+ int bi_valid;
+
+/* Current input function. Set to mem_read for in-memory compression */
+
+#ifdef DEBUG
+ ulg bits_sent; /* bit length of the compressed data */
+#endif
+
+ uint32_t *crc_32_tab;
+ uint32_t crc; /* shift register contents */
+};
+
+#define G1 (*(ptr_to_globals - 1))
+
+
+/* ===========================================================================
+ * Write the output buffer outbuf[0..outcnt-1] and update bytes_out.
+ * (used for the compressed data only)
+ */
+static void flush_outbuf(void)
+{
+ if (G1.outcnt == 0)
+ return;
+
+ xwrite(ofd, (char *) G1.outbuf, G1.outcnt);
+ G1.outcnt = 0;
+}
+
+
+/* ===========================================================================
+ */
+/* put_8bit is used for the compressed output */
+#define put_8bit(c) \
+do { \
+ G1.outbuf[G1.outcnt++] = (c); \
+ if (G1.outcnt == OUTBUFSIZ) flush_outbuf(); \
+} while (0)
+
+/* Output a 16 bit value, lsb first */
+static void put_16bit(ush w)
+{
+ if (G1.outcnt < OUTBUFSIZ - 2) {
+ G1.outbuf[G1.outcnt++] = w;
+ G1.outbuf[G1.outcnt++] = w >> 8;
+ } else {
+ put_8bit(w);
+ put_8bit(w >> 8);
+ }
+}
+
+static void put_32bit(ulg n)
+{
+ put_16bit(n);
+ put_16bit(n >> 16);
+}
+
+/* ===========================================================================
+ * Clear input and output buffers
+ */
+static void clear_bufs(void)
+{
+ G1.outcnt = 0;
+#ifdef DEBUG
+ G1.insize = 0;
+#endif
+ G1.isize = 0;
+}
+
+
+/* ===========================================================================
+ * Run a set of bytes through the crc shift register. If s is a NULL
+ * pointer, then initialize the crc shift register contents instead.
+ * Return the current crc in either case.
+ */
+static uint32_t updcrc(uch * s, unsigned n)
+{
+ uint32_t c = G1.crc;
+ while (n) {
+ c = G1.crc_32_tab[(uch)(c ^ *s++)] ^ (c >> 8);
+ n--;
+ }
+ G1.crc = c;
+ return c;
+}
+
+
+/* ===========================================================================
+ * Read a new buffer from the current input file, perform end-of-line
+ * translation, and update the crc and input file size.
+ * IN assertion: size >= 2 (for end-of-line translation)
+ */
+static unsigned file_read(void *buf, unsigned size)
+{
+ unsigned len;
+
+ Assert(G1.insize == 0, "l_buf not empty");
+
+ len = safe_read(ifd, buf, size);
+ if (len == (unsigned)(-1) || len == 0)
+ return len;
+
+ updcrc(buf, len);
+ G1.isize += len;
+ return len;
+}
+
+
+/* ===========================================================================
+ * Send a value on a given number of bits.
+ * IN assertion: length <= 16 and value fits in length bits.
+ */
+static void send_bits(int value, int length)
+{
+#ifdef DEBUG
+ Tracev((stderr, " l %2d v %4x ", length, value));
+ Assert(length > 0 && length <= 15, "invalid length");
+ G1.bits_sent += length;
+#endif
+ /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+ * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+ * unused bits in value.
+ */
+ if (G1.bi_valid > (int) BUF_SIZE - length) {
+ G1.bi_buf |= (value << G1.bi_valid);
+ put_16bit(G1.bi_buf);
+ G1.bi_buf = (ush) value >> (BUF_SIZE - G1.bi_valid);
+ G1.bi_valid += length - BUF_SIZE;
+ } else {
+ G1.bi_buf |= value << G1.bi_valid;
+ G1.bi_valid += length;
+ }
+}
+
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
+ */
+static unsigned bi_reverse(unsigned code, int len)
+{
+ unsigned res = 0;
+
+ while (1) {
+ res |= code & 1;
+ if (--len <= 0) return res;
+ code >>= 1;
+ res <<= 1;
+ }
+}
+
+
+/* ===========================================================================
+ * Write out any remaining bits in an incomplete byte.
+ */
+static void bi_windup(void)
+{
+ if (G1.bi_valid > 8) {
+ put_16bit(G1.bi_buf);
+ } else if (G1.bi_valid > 0) {
+ put_8bit(G1.bi_buf);
+ }
+ G1.bi_buf = 0;
+ G1.bi_valid = 0;
+#ifdef DEBUG
+ G1.bits_sent = (G1.bits_sent + 7) & ~7;
+#endif
+}
+
+
+/* ===========================================================================
+ * Copy a stored block to the zip file, storing first the length and its
+ * one's complement if requested.
+ */
+static void copy_block(char *buf, unsigned len, int header)
+{
+ bi_windup(); /* align on byte boundary */
+
+ if (header) {
+ put_16bit(len);
+ put_16bit(~len);
+#ifdef DEBUG
+ G1.bits_sent += 2 * 16;
+#endif
+ }
+#ifdef DEBUG
+ G1.bits_sent += (ulg) len << 3;
+#endif
+ while (len--) {
+ put_8bit(*buf++);
+ }
+}
+
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead, and sets eofile if end of input file.
+ * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0
+ * OUT assertions: at least one byte has been read, or eofile is set;
+ * file reads are performed for at least two bytes (required for the
+ * translate_eol option).
+ */
+static void fill_window(void)
+{
+ unsigned n, m;
+ unsigned more = WINDOW_SIZE - G1.lookahead - G1.strstart;
+ /* Amount of free space at the end of the window. */
+
+ /* If the window is almost full and there is insufficient lookahead,
+ * move the upper half to the lower one to make room in the upper half.
+ */
+ if (more == (unsigned) -1) {
+ /* Very unlikely, but possible on 16 bit machine if strstart == 0
+ * and lookahead == 1 (input done one byte at time)
+ */
+ more--;
+ } else if (G1.strstart >= WSIZE + MAX_DIST) {
+ /* By the IN assertion, the window is not empty so we can't confuse
+ * more == 0 with more == 64K on a 16 bit machine.
+ */
+ Assert(WINDOW_SIZE == 2 * WSIZE, "no sliding with BIG_MEM");
+
+ memcpy(G1.window, G1.window + WSIZE, WSIZE);
+ G1.match_start -= WSIZE;
+ G1.strstart -= WSIZE; /* we now have strstart >= MAX_DIST: */
+
+ G1.block_start -= WSIZE;
+
+ for (n = 0; n < HASH_SIZE; n++) {
+ m = head[n];
+ head[n] = (Pos) (m >= WSIZE ? m - WSIZE : 0);
+ }
+ for (n = 0; n < WSIZE; n++) {
+ m = G1.prev[n];
+ G1.prev[n] = (Pos) (m >= WSIZE ? m - WSIZE : 0);
+ /* If n is not on any hash chain, prev[n] is garbage but
+ * its value will never be used.
+ */
+ }
+ more += WSIZE;
+ }
+ /* At this point, more >= 2 */
+ if (!G1.eofile) {
+ n = file_read(G1.window + G1.strstart + G1.lookahead, more);
+ if (n == 0 || n == (unsigned) -1) {
+ G1.eofile = 1;
+ } else {
+ G1.lookahead += n;
+ }
+ }
+}
+
+
+/* ===========================================================================
+ * Set match_start to the longest match starting at the given string and
+ * return its length. Matches shorter or equal to prev_length are discarded,
+ * in which case the result is equal to prev_length and match_start is
+ * garbage.
+ * IN assertions: cur_match is the head of the hash chain for the current
+ * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
+ */
+
+/* For MSDOS, OS/2 and 386 Unix, an optimized version is in match.asm or
+ * match.s. The code is functionally equivalent, so you can use the C version
+ * if desired.
+ */
+static int longest_match(IPos cur_match)
+{
+ unsigned chain_length = max_chain_length; /* max hash chain length */
+ uch *scan = G1.window + G1.strstart; /* current string */
+ uch *match; /* matched string */
+ int len; /* length of current match */
+ int best_len = G1.prev_length; /* best match length so far */
+ IPos limit = G1.strstart > (IPos) MAX_DIST ? G1.strstart - (IPos) MAX_DIST : 0;
+ /* Stop when cur_match becomes <= limit. To simplify the code,
+ * we prevent matches with the string of window index 0.
+ */
+
+/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+ * It is easy to get rid of this optimization if necessary.
+ */
+#if HASH_BITS < 8 || MAX_MATCH != 258
+# error Code too clever
+#endif
+ uch *strend = G1.window + G1.strstart + MAX_MATCH;
+ uch scan_end1 = scan[best_len - 1];
+ uch scan_end = scan[best_len];
+
+ /* Do not waste too much time if we already have a good match: */
+ if (G1.prev_length >= good_match) {
+ chain_length >>= 2;
+ }
+ Assert(G1.strstart <= WINDOW_SIZE - MIN_LOOKAHEAD, "insufficient lookahead");
+
+ do {
+ Assert(cur_match < G1.strstart, "no future");
+ match = G1.window + cur_match;
+
+ /* Skip to next match if the match length cannot increase
+ * or if the match length is less than 2:
+ */
+ if (match[best_len] != scan_end ||
+ match[best_len - 1] != scan_end1 ||
+ *match != *scan || *++match != scan[1])
+ continue;
+
+ /* The check at best_len-1 can be removed because it will be made
+ * again later. (This heuristic is not always a win.)
+ * It is not necessary to compare scan[2] and match[2] since they
+ * are always equal when the other bytes match, given that
+ * the hash keys are equal and that HASH_BITS >= 8.
+ */
+ scan += 2, match++;
+
+ /* We check for insufficient lookahead only every 8th comparison;
+ * the 256th check will be made at strstart+258.
+ */
+ do {
+ } while (*++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match && scan < strend);
+
+ len = MAX_MATCH - (int) (strend - scan);
+ scan = strend - MAX_MATCH;
+
+ if (len > best_len) {
+ G1.match_start = cur_match;
+ best_len = len;
+ if (len >= nice_match)
+ break;
+ scan_end1 = scan[best_len - 1];
+ scan_end = scan[best_len];
+ }
+ } while ((cur_match = G1.prev[cur_match & WMASK]) > limit
+ && --chain_length != 0);
+
+ return best_len;
+}
+
+
+#ifdef DEBUG
+/* ===========================================================================
+ * Check that the match at match_start is indeed a match.
+ */
+static void check_match(IPos start, IPos match, int length)
+{
+ /* check that the match is indeed a match */
+ if (memcmp(G1.window + match, G1.window + start, length) != 0) {
+ bb_error_msg(" start %d, match %d, length %d", start, match, length);
+ bb_error_msg("invalid match");
+ }
+ if (verbose > 1) {
+ bb_error_msg("\\[%d,%d]", start - match, length);
+ do {
+ putc(G1.window[start++], stderr);
+ } while (--length != 0);
+ }
+}
+#else
+# define check_match(start, match, length) ((void)0)
+#endif
+
+
+/* trees.c -- output deflated data using Huffman coding
+ * Copyright (C) 1992-1993 Jean-loup Gailly
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License, see the file COPYING.
+ */
+
+/* PURPOSE
+ * Encode various sets of source values using variable-length
+ * binary code trees.
+ *
+ * DISCUSSION
+ * The PKZIP "deflation" process uses several Huffman trees. The more
+ * common source values are represented by shorter bit sequences.
+ *
+ * Each code tree is stored in the ZIP file in a compressed form
+ * which is itself a Huffman encoding of the lengths of
+ * all the code strings (in ascending order by source values).
+ * The actual code strings are reconstructed from the lengths in
+ * the UNZIP process, as described in the "application note"
+ * (APPNOTE.TXT) distributed as part of PKWARE's PKZIP program.
+ *
+ * REFERENCES
+ * Lynch, Thomas J.
+ * Data Compression: Techniques and Applications, pp. 53-55.
+ * Lifetime Learning Publications, 1985. ISBN 0-534-03418-7.
+ *
+ * Storer, James A.
+ * Data Compression: Methods and Theory, pp. 49-50.
+ * Computer Science Press, 1988. ISBN 0-7167-8156-5.
+ *
+ * Sedgewick, R.
+ * Algorithms, p290.
+ * Addison-Wesley, 1983. ISBN 0-201-06672-6.
+ *
+ * INTERFACE
+ * void ct_init()
+ * Allocate the match buffer, initialize the various tables [and save
+ * the location of the internal file attribute (ascii/binary) and
+ * method (DEFLATE/STORE) -- deleted in bbox]
+ *
+ * void ct_tally(int dist, int lc);
+ * Save the match info and tally the frequency counts.
+ *
+ * ulg flush_block(char *buf, ulg stored_len, int eof)
+ * Determine the best encoding for the current block: dynamic trees,
+ * static trees or store, and output the encoded block to the zip
+ * file. Returns the total compressed length for the file so far.
+ */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define MAX_BL_BITS 7
+/* Bit length codes must not exceed MAX_BL_BITS bits */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS 256
+/* number of literal bytes 0..255 */
+
+#define END_BLOCK 256
+/* end of block literal code */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES 30
+/* number of distance codes */
+
+#define BL_CODES 19
+/* number of codes used to transfer the bit lengths */
+
+typedef uch extra_bits_t;
+
+/* extra bits for each length code */
+static const extra_bits_t extra_lbits[LENGTH_CODES]= {
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4,
+ 4, 4, 5, 5, 5, 5, 0
+};
+
+/* extra bits for each distance code */
+static const extra_bits_t extra_dbits[D_CODES] = {
+ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
+ 10, 10, 11, 11, 12, 12, 13, 13
+};
+
+/* extra bits for each bit length code */
+static const extra_bits_t extra_blbits[BL_CODES] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 };
+
+/* number of codes at each bit length for an optimal tree */
+static const uch bl_order[BL_CODES] = {
+ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES 2
+/* The three kinds of block type */
+
+#ifndef LIT_BUFSIZE
+# ifdef SMALL_MEM
+# define LIT_BUFSIZE 0x2000
+# else
+# ifdef MEDIUM_MEM
+# define LIT_BUFSIZE 0x4000
+# else
+# define LIT_BUFSIZE 0x8000
+# endif
+# endif
+#endif
+#ifndef DIST_BUFSIZE
+# define DIST_BUFSIZE LIT_BUFSIZE
+#endif
+/* Sizes of match buffers for literals/lengths and distances. There are
+ * 4 reasons for limiting LIT_BUFSIZE to 64K:
+ * - frequencies can be kept in 16 bit counters
+ * - if compression is not successful for the first block, all input data is
+ * still in the window so we can still emit a stored block even when input
+ * comes from standard input. (This can also be done for all blocks if
+ * LIT_BUFSIZE is not greater than 32K.)
+ * - if compression is not successful for a file smaller than 64K, we can
+ * even emit a stored file instead of a stored block (saving 5 bytes).
+ * - creating new Huffman trees less frequently may not provide fast
+ * adaptation to changes in the input data statistics. (Take for
+ * example a binary file with poorly compressible code followed by
+ * a highly compressible string table.) Smaller buffer sizes give
+ * fast adaptation but have of course the overhead of transmitting trees
+ * more frequently.
+ * - I can't count above 4
+ * The current code is general and allows DIST_BUFSIZE < LIT_BUFSIZE (to save
+ * memory at the expense of compression). Some optimizations would be possible
+ * if we rely on DIST_BUFSIZE == LIT_BUFSIZE.
+ */
+#define REP_3_6 16
+/* repeat previous bit length 3-6 times (2 bits of repeat count) */
+#define REPZ_3_10 17
+/* repeat a zero length 3-10 times (3 bits of repeat count) */
+#define REPZ_11_138 18
+/* repeat a zero length 11-138 times (7 bits of repeat count) */
+
+/* ===========================================================================
+*/
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data {
+ union {
+ ush freq; /* frequency count */
+ ush code; /* bit string */
+ } fc;
+ union {
+ ush dad; /* father node in Huffman tree */
+ ush len; /* length of bit string */
+ } dl;
+} ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad dl.dad
+#define Len dl.len
+
+#define HEAP_SIZE (2*L_CODES + 1)
+/* maximum heap size */
+
+typedef struct tree_desc {
+ ct_data *dyn_tree; /* the dynamic tree */
+ ct_data *static_tree; /* corresponding static tree or NULL */
+ const extra_bits_t *extra_bits; /* extra bits for each code or NULL */
+ int extra_base; /* base index for extra_bits */
+ int elems; /* max number of elements in the tree */
+ int max_length; /* max bit length for the codes */
+ int max_code; /* largest code with non zero frequency */
+} tree_desc;
+
+struct globals2 {
+
+ ush heap[HEAP_SIZE]; /* heap used to build the Huffman trees */
+ int heap_len; /* number of elements in the heap */
+ int heap_max; /* element of largest frequency */
+
+/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+ * The same heap array is used to build all trees.
+ */
+
+ ct_data dyn_ltree[HEAP_SIZE]; /* literal and length tree */
+ ct_data dyn_dtree[2 * D_CODES + 1]; /* distance tree */
+
+ ct_data static_ltree[L_CODES + 2];
+
+/* The static literal tree. Since the bit lengths are imposed, there is no
+ * need for the L_CODES extra codes used during heap construction. However
+ * The codes 286 and 287 are needed to build a canonical tree (see ct_init
+ * below).
+ */
+
+ ct_data static_dtree[D_CODES];
+
+/* The static distance tree. (Actually a trivial tree since all codes use
+ * 5 bits.)
+ */
+
+ ct_data bl_tree[2 * BL_CODES + 1];
+
+/* Huffman tree for the bit lengths */
+
+ tree_desc l_desc;
+ tree_desc d_desc;
+ tree_desc bl_desc;
+
+ ush bl_count[MAX_BITS + 1];
+
+/* The lengths of the bit length codes are sent in order of decreasing
+ * probability, to avoid transmitting the lengths for unused bit length codes.
+ */
+
+ uch depth[2 * L_CODES + 1];
+
+/* Depth of each subtree used as tie breaker for trees of equal frequency */
+
+ uch length_code[MAX_MATCH - MIN_MATCH + 1];
+
+/* length code for each normalized match length (0 == MIN_MATCH) */
+
+ uch dist_code[512];
+
+/* distance codes. The first 256 values correspond to the distances
+ * 3 .. 258, the last 256 values correspond to the top 8 bits of
+ * the 15 bit distances.
+ */
+
+ int base_length[LENGTH_CODES];
+
+/* First normalized length for each code (0 = MIN_MATCH) */
+
+ int base_dist[D_CODES];
+
+/* First normalized distance for each code (0 = distance of 1) */
+
+ uch flag_buf[LIT_BUFSIZE / 8];
+
+/* flag_buf is a bit array distinguishing literals from lengths in
+ * l_buf, thus indicating the presence or absence of a distance.
+ */
+
+ unsigned last_lit; /* running index in l_buf */
+ unsigned last_dist; /* running index in d_buf */
+ unsigned last_flags; /* running index in flag_buf */
+ uch flags; /* current flags not yet saved in flag_buf */
+ uch flag_bit; /* current bit used in flags */
+
+/* bits are filled in flags starting at bit 0 (least significant).
+ * Note: these flags are overkill in the current code since we don't
+ * take advantage of DIST_BUFSIZE == LIT_BUFSIZE.
+ */
+
+ ulg opt_len; /* bit length of current block with optimal trees */
+ ulg static_len; /* bit length of current block with static trees */
+
+ ulg compressed_len; /* total bit length of compressed file */
+};
+
+#define G2ptr ((struct globals2*)(ptr_to_globals))
+#define G2 (*G2ptr)
+
+
+/* ===========================================================================
+ */
+static void gen_codes(ct_data * tree, int max_code);
+static void build_tree(tree_desc * desc);
+static void scan_tree(ct_data * tree, int max_code);
+static void send_tree(ct_data * tree, int max_code);
+static int build_bl_tree(void);
+static void send_all_trees(int lcodes, int dcodes, int blcodes);
+static void compress_block(ct_data * ltree, ct_data * dtree);
+
+
+#ifndef DEBUG
+/* Send a code of the given tree. c and tree must not have side effects */
+# define SEND_CODE(c, tree) send_bits(tree[c].Code, tree[c].Len)
+#else
+# define SEND_CODE(c, tree) \
+{ \
+ if (verbose > 1) bb_error_msg("\ncd %3d ",(c)); \
+ send_bits(tree[c].Code, tree[c].Len); \
+}
+#endif
+
+#define D_CODE(dist) \
+ ((dist) < 256 ? G2.dist_code[dist] : G2.dist_code[256 + ((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. dist_code[256] and dist_code[257] are never
+ * used.
+ * The arguments must not have side effects.
+ */
+
+
+/* ===========================================================================
+ * Initialize a new block.
+ */
+static void init_block(void)
+{
+ int n; /* iterates over tree elements */
+
+ /* Initialize the trees. */
+ for (n = 0; n < L_CODES; n++)
+ G2.dyn_ltree[n].Freq = 0;
+ for (n = 0; n < D_CODES; n++)
+ G2.dyn_dtree[n].Freq = 0;
+ for (n = 0; n < BL_CODES; n++)
+ G2.bl_tree[n].Freq = 0;
+
+ G2.dyn_ltree[END_BLOCK].Freq = 1;
+ G2.opt_len = G2.static_len = 0;
+ G2.last_lit = G2.last_dist = G2.last_flags = 0;
+ G2.flags = 0;
+ G2.flag_bit = 1;
+}
+
+
+/* ===========================================================================
+ * Restore the heap property by moving down the tree starting at node k,
+ * exchanging a node with the smallest of its two sons if necessary, stopping
+ * when the heap property is re-established (each father smaller than its
+ * two sons).
+ */
+
+/* Compares to subtrees, using the tree depth as tie breaker when
+ * the subtrees have equal frequency. This minimizes the worst case length. */
+#define SMALLER(tree, n, m) \
+ (tree[n].Freq < tree[m].Freq \
+ || (tree[n].Freq == tree[m].Freq && G2.depth[n] <= G2.depth[m]))
+
+static void pqdownheap(ct_data * tree, int k)
+{
+ int v = G2.heap[k];
+ int j = k << 1; /* left son of k */
+
+ while (j <= G2.heap_len) {
+ /* Set j to the smallest of the two sons: */
+ if (j < G2.heap_len && SMALLER(tree, G2.heap[j + 1], G2.heap[j]))
+ j++;
+
+ /* Exit if v is smaller than both sons */
+ if (SMALLER(tree, v, G2.heap[j]))
+ break;
+
+ /* Exchange v with the smallest son */
+ G2.heap[k] = G2.heap[j];
+ k = j;
+
+ /* And continue down the tree, setting j to the left son of k */
+ j <<= 1;
+ }
+ G2.heap[k] = v;
+}
+
+
+/* ===========================================================================
+ * Compute the optimal bit lengths for a tree and update the total bit length
+ * for the current block.
+ * IN assertion: the fields freq and dad are set, heap[heap_max] and
+ * above are the tree nodes sorted by increasing frequency.
+ * OUT assertions: the field len is set to the optimal bit length, the
+ * array bl_count contains the frequencies for each bit length.
+ * The length opt_len is updated; static_len is also updated if stree is
+ * not null.
+ */
+static void gen_bitlen(tree_desc * desc)
+{
+ ct_data *tree = desc->dyn_tree;
+ const extra_bits_t *extra = desc->extra_bits;
+ int base = desc->extra_base;
+ int max_code = desc->max_code;
+ int max_length = desc->max_length;
+ ct_data *stree = desc->static_tree;
+ int h; /* heap index */
+ int n, m; /* iterate over the tree elements */
+ int bits; /* bit length */
+ int xbits; /* extra bits */
+ ush f; /* frequency */
+ int overflow = 0; /* number of elements with bit length too large */
+
+ for (bits = 0; bits <= MAX_BITS; bits++)
+ G2.bl_count[bits] = 0;
+
+ /* In a first pass, compute the optimal bit lengths (which may
+ * overflow in the case of the bit length tree).
+ */
+ tree[G2.heap[G2.heap_max]].Len = 0; /* root of the heap */
+
+ for (h = G2.heap_max + 1; h < HEAP_SIZE; h++) {
+ n = G2.heap[h];
+ bits = tree[tree[n].Dad].Len + 1;
+ if (bits > max_length) {
+ bits = max_length;
+ overflow++;
+ }
+ tree[n].Len = (ush) bits;
+ /* We overwrite tree[n].Dad which is no longer needed */
+
+ if (n > max_code)
+ continue; /* not a leaf node */
+
+ G2.bl_count[bits]++;
+ xbits = 0;
+ if (n >= base)
+ xbits = extra[n - base];
+ f = tree[n].Freq;
+ G2.opt_len += (ulg) f *(bits + xbits);
+
+ if (stree)
+ G2.static_len += (ulg) f * (stree[n].Len + xbits);
+ }
+ if (overflow == 0)
+ return;
+
+ Trace((stderr, "\nbit length overflow\n"));
+ /* This happens for example on obj2 and pic of the Calgary corpus */
+
+ /* Find the first bit length which could increase: */
+ do {
+ bits = max_length - 1;
+ while (G2.bl_count[bits] == 0)
+ bits--;
+ G2.bl_count[bits]--; /* move one leaf down the tree */
+ G2.bl_count[bits + 1] += 2; /* move one overflow item as its brother */
+ G2.bl_count[max_length]--;
+ /* The brother of the overflow item also moves one step up,
+ * but this does not affect bl_count[max_length]
+ */
+ overflow -= 2;
+ } while (overflow > 0);
+
+ /* Now recompute all bit lengths, scanning in increasing frequency.
+ * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+ * lengths instead of fixing only the wrong ones. This idea is taken
+ * from 'ar' written by Haruhiko Okumura.)
+ */
+ for (bits = max_length; bits != 0; bits--) {
+ n = G2.bl_count[bits];
+ while (n != 0) {
+ m = G2.heap[--h];
+ if (m > max_code)
+ continue;
+ if (tree[m].Len != (unsigned) bits) {
+ Trace((stderr, "code %d bits %d->%d\n", m, tree[m].Len, bits));
+ G2.opt_len += ((int32_t) bits - tree[m].Len) * tree[m].Freq;
+ tree[m].Len = bits;
+ }
+ n--;
+ }
+ }
+}
+
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ * zero code length.
+ */
+static void gen_codes(ct_data * tree, int max_code)
+{
+ ush next_code[MAX_BITS + 1]; /* next code value for each bit length */
+ ush code = 0; /* running code value */
+ int bits; /* bit index */
+ int n; /* code index */
+
+ /* The distribution counts are first used to generate the code values
+ * without bit reversal.
+ */
+ for (bits = 1; bits <= MAX_BITS; bits++) {
+ next_code[bits] = code = (code + G2.bl_count[bits - 1]) << 1;
+ }
+ /* Check that the bit counts in bl_count are consistent. The last code
+ * must be all ones.
+ */
+ Assert(code + G2.bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
+ "inconsistent bit counts");
+ Tracev((stderr, "\ngen_codes: max_code %d ", max_code));
+
+ for (n = 0; n <= max_code; n++) {
+ int len = tree[n].Len;
+
+ if (len == 0)
+ continue;
+ /* Now reverse the bits */
+ tree[n].Code = bi_reverse(next_code[len]++, len);
+
+ Tracec(tree != G2.static_ltree,
+ (stderr, "\nn %3d %c l %2d c %4x (%x) ", n,
+ (isgraph(n) ? n : ' '), len, tree[n].Code,
+ next_code[len] - 1));
+ }
+}
+
+
+/* ===========================================================================
+ * Construct one Huffman tree and assigns the code bit strings and lengths.
+ * Update the total bit length for the current block.
+ * IN assertion: the field freq is set for all tree elements.
+ * OUT assertions: the fields len and code are set to the optimal bit length
+ * and corresponding code. The length opt_len is updated; static_len is
+ * also updated if stree is not null. The field max_code is set.
+ */
+
+/* Remove the smallest element from the heap and recreate the heap with
+ * one less element. Updates heap and heap_len. */
+
+#define SMALLEST 1
+/* Index within the heap array of least frequent node in the Huffman tree */
+
+#define PQREMOVE(tree, top) \
+do { \
+ top = G2.heap[SMALLEST]; \
+ G2.heap[SMALLEST] = G2.heap[G2.heap_len--]; \
+ pqdownheap(tree, SMALLEST); \
+} while (0)
+
+static void build_tree(tree_desc * desc)
+{
+ ct_data *tree = desc->dyn_tree;
+ ct_data *stree = desc->static_tree;
+ int elems = desc->elems;
+ int n, m; /* iterate over heap elements */
+ int max_code = -1; /* largest code with non zero frequency */
+ int node = elems; /* next internal node of the tree */
+
+ /* Construct the initial heap, with least frequent element in
+ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+ * heap[0] is not used.
+ */
+ G2.heap_len = 0;
+ G2.heap_max = HEAP_SIZE;
+
+ for (n = 0; n < elems; n++) {
+ if (tree[n].Freq != 0) {
+ G2.heap[++G2.heap_len] = max_code = n;
+ G2.depth[n] = 0;
+ } else {
+ tree[n].Len = 0;
+ }
+ }
+
+ /* The pkzip format requires that at least one distance code exists,
+ * and that at least one bit should be sent even if there is only one
+ * possible code. So to avoid special checks later on we force at least
+ * two codes of non zero frequency.
+ */
+ while (G2.heap_len < 2) {
+ int new = G2.heap[++G2.heap_len] = (max_code < 2 ? ++max_code : 0);
+
+ tree[new].Freq = 1;
+ G2.depth[new] = 0;
+ G2.opt_len--;
+ if (stree)
+ G2.static_len -= stree[new].Len;
+ /* new is 0 or 1 so it does not have extra bits */
+ }
+ desc->max_code = max_code;
+
+ /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+ * establish sub-heaps of increasing lengths:
+ */
+ for (n = G2.heap_len / 2; n >= 1; n--)
+ pqdownheap(tree, n);
+
+ /* Construct the Huffman tree by repeatedly combining the least two
+ * frequent nodes.
+ */
+ do {
+ PQREMOVE(tree, n); /* n = node of least frequency */
+ m = G2.heap[SMALLEST]; /* m = node of next least frequency */
+
+ G2.heap[--G2.heap_max] = n; /* keep the nodes sorted by frequency */
+ G2.heap[--G2.heap_max] = m;
+
+ /* Create a new node father of n and m */
+ tree[node].Freq = tree[n].Freq + tree[m].Freq;
+ G2.depth[node] = MAX(G2.depth[n], G2.depth[m]) + 1;
+ tree[n].Dad = tree[m].Dad = (ush) node;
+#ifdef DUMP_BL_TREE
+ if (tree == G2.bl_tree) {
+ bb_error_msg("\nnode %d(%d), sons %d(%d) %d(%d)",
+ node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+ }
+#endif
+ /* and insert the new node in the heap */
+ G2.heap[SMALLEST] = node++;
+ pqdownheap(tree, SMALLEST);
+
+ } while (G2.heap_len >= 2);
+
+ G2.heap[--G2.heap_max] = G2.heap[SMALLEST];
+
+ /* At this point, the fields freq and dad are set. We can now
+ * generate the bit lengths.
+ */
+ gen_bitlen((tree_desc *) desc);
+
+ /* The field len is now set, we can generate the bit codes */
+ gen_codes((ct_data *) tree, max_code);
+}
+
+
+/* ===========================================================================
+ * Scan a literal or distance tree to determine the frequencies of the codes
+ * in the bit length tree. Updates opt_len to take into account the repeat
+ * counts. (The contribution of the bit length codes will be added later
+ * during the construction of bl_tree.)
+ */
+static void scan_tree(ct_data * tree, int max_code)
+{
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+ if (nextlen == 0) {
+ max_count = 138;
+ min_count = 3;
+ }
+ tree[max_code + 1].Len = 0xffff; /* guard */
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen;
+ nextlen = tree[n + 1].Len;
+ if (++count < max_count && curlen == nextlen)
+ continue;
+
+ if (count < min_count) {
+ G2.bl_tree[curlen].Freq += count;
+ } else if (curlen != 0) {
+ if (curlen != prevlen)
+ G2.bl_tree[curlen].Freq++;
+ G2.bl_tree[REP_3_6].Freq++;
+ } else if (count <= 10) {
+ G2.bl_tree[REPZ_3_10].Freq++;
+ } else {
+ G2.bl_tree[REPZ_11_138].Freq++;
+ }
+ count = 0;
+ prevlen = curlen;
+
+ max_count = 7;
+ min_count = 4;
+ if (nextlen == 0) {
+ max_count = 138;
+ min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6;
+ min_count = 3;
+ }
+ }
+}
+
+
+/* ===========================================================================
+ * Send a literal or distance tree in compressed form, using the codes in
+ * bl_tree.
+ */
+static void send_tree(ct_data * tree, int max_code)
+{
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+/* tree[max_code+1].Len = -1; *//* guard already set */
+ if (nextlen == 0)
+ max_count = 138, min_count = 3;
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen;
+ nextlen = tree[n + 1].Len;
+ if (++count < max_count && curlen == nextlen) {
+ continue;
+ } else if (count < min_count) {
+ do {
+ SEND_CODE(curlen, G2.bl_tree);
+ } while (--count);
+ } else if (curlen != 0) {
+ if (curlen != prevlen) {
+ SEND_CODE(curlen, G2.bl_tree);
+ count--;
+ }
+ Assert(count >= 3 && count <= 6, " 3_6?");
+ SEND_CODE(REP_3_6, G2.bl_tree);
+ send_bits(count - 3, 2);
+ } else if (count <= 10) {
+ SEND_CODE(REPZ_3_10, G2.bl_tree);
+ send_bits(count - 3, 3);
+ } else {
+ SEND_CODE(REPZ_11_138, G2.bl_tree);
+ send_bits(count - 11, 7);
+ }
+ count = 0;
+ prevlen = curlen;
+ if (nextlen == 0) {
+ max_count = 138;
+ min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6;
+ min_count = 3;
+ } else {
+ max_count = 7;
+ min_count = 4;
+ }
+ }
+}
+
+
+/* ===========================================================================
+ * Construct the Huffman tree for the bit lengths and return the index in
+ * bl_order of the last bit length code to send.
+ */
+static int build_bl_tree(void)
+{
+ int max_blindex; /* index of last bit length code of non zero freq */
+
+ /* Determine the bit length frequencies for literal and distance trees */
+ scan_tree(G2.dyn_ltree, G2.l_desc.max_code);
+ scan_tree(G2.dyn_dtree, G2.d_desc.max_code);
+
+ /* Build the bit length tree: */
+ build_tree(&G2.bl_desc);
+ /* opt_len now includes the length of the tree representations, except
+ * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+ */
+
+ /* Determine the number of bit length codes to send. The pkzip format
+ * requires that at least 4 bit length codes be sent. (appnote.txt says
+ * 3 but the actual value used is 4.)
+ */
+ for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
+ if (G2.bl_tree[bl_order[max_blindex]].Len != 0)
+ break;
+ }
+ /* Update opt_len to include the bit length tree and counts */
+ G2.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
+ Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", G2.opt_len, G2.static_len));
+
+ return max_blindex;
+}
+
+
+/* ===========================================================================
+ * Send the header for a block using dynamic Huffman trees: the counts, the
+ * lengths of the bit length codes, the literal tree and the distance tree.
+ * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+ */
+static void send_all_trees(int lcodes, int dcodes, int blcodes)
+{
+ int rank; /* index in bl_order */
+
+ Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
+ Assert(lcodes <= L_CODES && dcodes <= D_CODES
+ && blcodes <= BL_CODES, "too many codes");
+ Tracev((stderr, "\nbl counts: "));
+ send_bits(lcodes - 257, 5); /* not +255 as stated in appnote.txt */
+ send_bits(dcodes - 1, 5);
+ send_bits(blcodes - 4, 4); /* not -3 as stated in appnote.txt */
+ for (rank = 0; rank < blcodes; rank++) {
+ Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
+ send_bits(G2.bl_tree[bl_order[rank]].Len, 3);
+ }
+ Tracev((stderr, "\nbl tree: sent %ld", G1.bits_sent));
+
+ send_tree((ct_data *) G2.dyn_ltree, lcodes - 1); /* send the literal tree */
+ Tracev((stderr, "\nlit tree: sent %ld", G1.bits_sent));
+
+ send_tree((ct_data *) G2.dyn_dtree, dcodes - 1); /* send the distance tree */
+ Tracev((stderr, "\ndist tree: sent %ld", G1.bits_sent));
+}
+
+
+/* ===========================================================================
+ * Save the match info and tally the frequency counts. Return true if
+ * the current block must be flushed.
+ */
+static int ct_tally(int dist, int lc)
+{
+ G1.l_buf[G2.last_lit++] = lc;
+ if (dist == 0) {
+ /* lc is the unmatched char */
+ G2.dyn_ltree[lc].Freq++;
+ } else {
+ /* Here, lc is the match length - MIN_MATCH */
+ dist--; /* dist = match distance - 1 */
+ Assert((ush) dist < (ush) MAX_DIST
+ && (ush) lc <= (ush) (MAX_MATCH - MIN_MATCH)
+ && (ush) D_CODE(dist) < (ush) D_CODES, "ct_tally: bad match"
+ );
+
+ G2.dyn_ltree[G2.length_code[lc] + LITERALS + 1].Freq++;
+ G2.dyn_dtree[D_CODE(dist)].Freq++;
+
+ G1.d_buf[G2.last_dist++] = dist;
+ G2.flags |= G2.flag_bit;
+ }
+ G2.flag_bit <<= 1;
+
+ /* Output the flags if they fill a byte: */
+ if ((G2.last_lit & 7) == 0) {
+ G2.flag_buf[G2.last_flags++] = G2.flags;
+ G2.flags = 0;
+ G2.flag_bit = 1;
+ }
+ /* Try to guess if it is profitable to stop the current block here */
+ if ((G2.last_lit & 0xfff) == 0) {
+ /* Compute an upper bound for the compressed length */
+ ulg out_length = G2.last_lit * 8L;
+ ulg in_length = (ulg) G1.strstart - G1.block_start;
+ int dcode;
+
+ for (dcode = 0; dcode < D_CODES; dcode++) {
+ out_length += G2.dyn_dtree[dcode].Freq * (5L + extra_dbits[dcode]);
+ }
+ out_length >>= 3;
+ Trace((stderr,
+ "\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",
+ G2.last_lit, G2.last_dist, in_length, out_length,
+ 100L - out_length * 100L / in_length));
+ if (G2.last_dist < G2.last_lit / 2 && out_length < in_length / 2)
+ return 1;
+ }
+ return (G2.last_lit == LIT_BUFSIZE - 1 || G2.last_dist == DIST_BUFSIZE);
+ /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K
+ * on 16 bit machines and because stored blocks are restricted to
+ * 64K-1 bytes.
+ */
+}
+
+/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+static void compress_block(ct_data * ltree, ct_data * dtree)
+{
+ unsigned dist; /* distance of matched string */
+ int lc; /* match length or unmatched char (if dist == 0) */
+ unsigned lx = 0; /* running index in l_buf */
+ unsigned dx = 0; /* running index in d_buf */
+ unsigned fx = 0; /* running index in flag_buf */
+ uch flag = 0; /* current flags */
+ unsigned code; /* the code to send */
+ int extra; /* number of extra bits to send */
+
+ if (G2.last_lit != 0) do {
+ if ((lx & 7) == 0)
+ flag = G2.flag_buf[fx++];
+ lc = G1.l_buf[lx++];
+ if ((flag & 1) == 0) {
+ SEND_CODE(lc, ltree); /* send a literal byte */
+ Tracecv(isgraph(lc), (stderr, " '%c' ", lc));
+ } else {
+ /* Here, lc is the match length - MIN_MATCH */
+ code = G2.length_code[lc];
+ SEND_CODE(code + LITERALS + 1, ltree); /* send the length code */
+ extra = extra_lbits[code];
+ if (extra != 0) {
+ lc -= G2.base_length[code];
+ send_bits(lc, extra); /* send the extra length bits */
+ }
+ dist = G1.d_buf[dx++];
+ /* Here, dist is the match distance - 1 */
+ code = D_CODE(dist);
+ Assert(code < D_CODES, "bad d_code");
+
+ SEND_CODE(code, dtree); /* send the distance code */
+ extra = extra_dbits[code];
+ if (extra != 0) {
+ dist -= G2.base_dist[code];
+ send_bits(dist, extra); /* send the extra distance bits */
+ }
+ } /* literal or match pair ? */
+ flag >>= 1;
+ } while (lx < G2.last_lit);
+
+ SEND_CODE(END_BLOCK, ltree);
+}
+
+
+/* ===========================================================================
+ * Determine the best encoding for the current block: dynamic trees, static
+ * trees or store, and output the encoded block to the zip file. This function
+ * returns the total compressed length for the file so far.
+ */
+static ulg flush_block(char *buf, ulg stored_len, int eof)
+{
+ ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+ int max_blindex; /* index of last bit length code of non zero freq */
+
+ G2.flag_buf[G2.last_flags] = G2.flags; /* Save the flags for the last 8 items */
+
+ /* Construct the literal and distance trees */
+ build_tree(&G2.l_desc);
+ Tracev((stderr, "\nlit data: dyn %ld, stat %ld", G2.opt_len, G2.static_len));
+
+ build_tree(&G2.d_desc);
+ Tracev((stderr, "\ndist data: dyn %ld, stat %ld", G2.opt_len, G2.static_len));
+ /* At this point, opt_len and static_len are the total bit lengths of
+ * the compressed block data, excluding the tree representations.
+ */
+
+ /* Build the bit length tree for the above two trees, and get the index
+ * in bl_order of the last bit length code to send.
+ */
+ max_blindex = build_bl_tree();
+
+ /* Determine the best encoding. Compute first the block length in bytes */
+ opt_lenb = (G2.opt_len + 3 + 7) >> 3;
+ static_lenb = (G2.static_len + 3 + 7) >> 3;
+
+ Trace((stderr,
+ "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u ",
+ opt_lenb, G2.opt_len, static_lenb, G2.static_len, stored_len,
+ G2.last_lit, G2.last_dist));
+
+ if (static_lenb <= opt_lenb)
+ opt_lenb = static_lenb;
+
+ /* If compression failed and this is the first and last block,
+ * and if the zip file can be seeked (to rewrite the local header),
+ * the whole file is transformed into a stored file:
+ */
+ if (stored_len <= opt_lenb && eof && G2.compressed_len == 0L && seekable()) {
+ /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
+ if (buf == NULL)
+ bb_error_msg("block vanished");
+
+ copy_block(buf, (unsigned) stored_len, 0); /* without header */
+ G2.compressed_len = stored_len << 3;
+
+ } else if (stored_len + 4 <= opt_lenb && buf != NULL) {
+ /* 4: two words for the lengths */
+ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+ * Otherwise we can't have processed more than WSIZE input bytes since
+ * the last block flush, because compression would have been
+ * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+ * transform a block into a stored block.
+ */
+ send_bits((STORED_BLOCK << 1) + eof, 3); /* send block type */
+ G2.compressed_len = (G2.compressed_len + 3 + 7) & ~7L;
+ G2.compressed_len += (stored_len + 4) << 3;
+
+ copy_block(buf, (unsigned) stored_len, 1); /* with header */
+
+ } else if (static_lenb == opt_lenb) {
+ send_bits((STATIC_TREES << 1) + eof, 3);
+ compress_block((ct_data *) G2.static_ltree, (ct_data *) G2.static_dtree);
+ G2.compressed_len += 3 + G2.static_len;
+ } else {
+ send_bits((DYN_TREES << 1) + eof, 3);
+ send_all_trees(G2.l_desc.max_code + 1, G2.d_desc.max_code + 1,
+ max_blindex + 1);
+ compress_block((ct_data *) G2.dyn_ltree, (ct_data *) G2.dyn_dtree);
+ G2.compressed_len += 3 + G2.opt_len;
+ }
+ Assert(G2.compressed_len == G1.bits_sent, "bad compressed size");
+ init_block();
+
+ if (eof) {
+ bi_windup();
+ G2.compressed_len += 7; /* align on byte boundary */
+ }
+ Tracev((stderr, "\ncomprlen %lu(%lu) ", G2.compressed_len >> 3,
+ G2.compressed_len - 7 * eof));
+
+ return G2.compressed_len >> 3;
+}
+
+
+/* ===========================================================================
+ * Update a hash value with the given input byte
+ * IN assertion: all calls to to UPDATE_HASH are made with consecutive
+ * input characters, so that a running hash key can be computed from the
+ * previous key instead of complete recalculation each time.
+ */
+#define UPDATE_HASH(h, c) (h = (((h)<<H_SHIFT) ^ (c)) & HASH_MASK)
+
+
+/* ===========================================================================
+ * Same as above, but achieves better compression. We use a lazy
+ * evaluation for matches: a match is finally adopted only if there is
+ * no better match at the next window position.
+ *
+ * Processes a new input file and return its compressed length. Sets
+ * the compressed length, crc, deflate flags and internal file
+ * attributes.
+ */
+
+/* Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match. */
+#define FLUSH_BLOCK(eof) \
+ flush_block( \
+ G1.block_start >= 0L \
+ ? (char*)&G1.window[(unsigned)G1.block_start] \
+ : (char*)NULL, \
+ (ulg)G1.strstart - G1.block_start, \
+ (eof) \
+ )
+
+/* Insert string s in the dictionary and set match_head to the previous head
+ * of the hash chain (the most recent string with same hash key). Return
+ * the previous length of the hash chain.
+ * IN assertion: all calls to to INSERT_STRING are made with consecutive
+ * input characters and the first MIN_MATCH bytes of s are valid
+ * (except for the last MIN_MATCH-1 bytes of the input file). */
+#define INSERT_STRING(s, match_head) \
+do { \
+ UPDATE_HASH(G1.ins_h, G1.window[(s) + MIN_MATCH-1]); \
+ G1.prev[(s) & WMASK] = match_head = head[G1.ins_h]; \
+ head[G1.ins_h] = (s); \
+} while (0)
+
+static ulg deflate(void)
+{
+ IPos hash_head; /* head of hash chain */
+ IPos prev_match; /* previous match */
+ int flush; /* set if current block must be flushed */
+ int match_available = 0; /* set if previous match exists */
+ unsigned match_length = MIN_MATCH - 1; /* length of best match */
+
+ /* Process the input block. */
+ while (G1.lookahead != 0) {
+ /* Insert the string window[strstart .. strstart+2] in the
+ * dictionary, and set hash_head to the head of the hash chain:
+ */
+ INSERT_STRING(G1.strstart, hash_head);
+
+ /* Find the longest match, discarding those <= prev_length.
+ */
+ G1.prev_length = match_length;
+ prev_match = G1.match_start;
+ match_length = MIN_MATCH - 1;
+
+ if (hash_head != 0 && G1.prev_length < max_lazy_match
+ && G1.strstart - hash_head <= MAX_DIST
+ ) {
+ /* To simplify the code, we prevent matches with the string
+ * of window index 0 (in particular we have to avoid a match
+ * of the string with itself at the start of the input file).
+ */
+ match_length = longest_match(hash_head);
+ /* longest_match() sets match_start */
+ if (match_length > G1.lookahead)
+ match_length = G1.lookahead;
+
+ /* Ignore a length 3 match if it is too distant: */
+ if (match_length == MIN_MATCH && G1.strstart - G1.match_start > TOO_FAR) {
+ /* If prev_match is also MIN_MATCH, G1.match_start is garbage
+ * but we will ignore the current match anyway.
+ */
+ match_length--;
+ }
+ }
+ /* If there was a match at the previous step and the current
+ * match is not better, output the previous match:
+ */
+ if (G1.prev_length >= MIN_MATCH && match_length <= G1.prev_length) {
+ check_match(G1.strstart - 1, prev_match, G1.prev_length);
+ flush = ct_tally(G1.strstart - 1 - prev_match, G1.prev_length - MIN_MATCH);
+
+ /* Insert in hash table all strings up to the end of the match.
+ * strstart-1 and strstart are already inserted.
+ */
+ G1.lookahead -= G1.prev_length - 1;
+ G1.prev_length -= 2;
+ do {
+ G1.strstart++;
+ INSERT_STRING(G1.strstart, hash_head);
+ /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+ * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH
+ * these bytes are garbage, but it does not matter since the
+ * next lookahead bytes will always be emitted as literals.
+ */
+ } while (--G1.prev_length != 0);
+ match_available = 0;
+ match_length = MIN_MATCH - 1;
+ G1.strstart++;
+ if (flush) {
+ FLUSH_BLOCK(0);
+ G1.block_start = G1.strstart;
+ }
+ } else if (match_available) {
+ /* If there was no match at the previous position, output a
+ * single literal. If there was a match but the current match
+ * is longer, truncate the previous match to a single literal.
+ */
+ Tracevv((stderr, "%c", G1.window[G1.strstart - 1]));
+ if (ct_tally(0, G1.window[G1.strstart - 1])) {
+ FLUSH_BLOCK(0);
+ G1.block_start = G1.strstart;
+ }
+ G1.strstart++;
+ G1.lookahead--;
+ } else {
+ /* There is no previous match to compare with, wait for
+ * the next step to decide.
+ */
+ match_available = 1;
+ G1.strstart++;
+ G1.lookahead--;
+ }
+ Assert(G1.strstart <= G1.isize && lookahead <= G1.isize, "a bit too far");
+
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the next match, plus MIN_MATCH bytes to insert the
+ * string following the next match.
+ */
+ while (G1.lookahead < MIN_LOOKAHEAD && !G1.eofile)
+ fill_window();
+ }
+ if (match_available)
+ ct_tally(0, G1.window[G1.strstart - 1]);
+
+ return FLUSH_BLOCK(1); /* eof */
+}
+
+
+/* ===========================================================================
+ * Initialize the bit string routines.
+ */
+static void bi_init(void)
+{
+ G1.bi_buf = 0;
+ G1.bi_valid = 0;
+#ifdef DEBUG
+ G1.bits_sent = 0L;
+#endif
+}
+
+
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new file
+ */
+static void lm_init(ush * flagsp)
+{
+ unsigned j;
+
+ /* Initialize the hash table. */
+ memset(head, 0, HASH_SIZE * sizeof(*head));
+ /* prev will be initialized on the fly */
+
+ /* speed options for the general purpose bit flag */
+ *flagsp |= 2; /* FAST 4, SLOW 2 */
+ /* ??? reduce max_chain_length for binary files */
+
+ G1.strstart = 0;
+ G1.block_start = 0L;
+
+ G1.lookahead = file_read(G1.window,
+ sizeof(int) <= 2 ? (unsigned) WSIZE : 2 * WSIZE);
+
+ if (G1.lookahead == 0 || G1.lookahead == (unsigned) -1) {
+ G1.eofile = 1;
+ G1.lookahead = 0;
+ return;
+ }
+ G1.eofile = 0;
+ /* Make sure that we always have enough lookahead. This is important
+ * if input comes from a device such as a tty.
+ */
+ while (G1.lookahead < MIN_LOOKAHEAD && !G1.eofile)
+ fill_window();
+
+ G1.ins_h = 0;
+ for (j = 0; j < MIN_MATCH - 1; j++)
+ UPDATE_HASH(G1.ins_h, G1.window[j]);
+ /* If lookahead < MIN_MATCH, ins_h is garbage, but this is
+ * not important since only literal bytes will be emitted.
+ */
+}
+
+
+/* ===========================================================================
+ * Allocate the match buffer, initialize the various tables and save the
+ * location of the internal file attribute (ascii/binary) and method
+ * (DEFLATE/STORE).
+ * One callsite in zip()
+ */
+static void ct_init(void)
+{
+ int n; /* iterates over tree elements */
+ int length; /* length value */
+ int code; /* code value */
+ int dist; /* distance index */
+
+ G2.compressed_len = 0L;
+
+#ifdef NOT_NEEDED
+ if (G2.static_dtree[0].Len != 0)
+ return; /* ct_init already called */
+#endif
+
+ /* Initialize the mapping length (0..255) -> length code (0..28) */
+ length = 0;
+ for (code = 0; code < LENGTH_CODES - 1; code++) {
+ G2.base_length[code] = length;
+ for (n = 0; n < (1 << extra_lbits[code]); n++) {
+ G2.length_code[length++] = code;
+ }
+ }
+ Assert(length == 256, "ct_init: length != 256");
+ /* Note that the length 255 (match length 258) can be represented
+ * in two different ways: code 284 + 5 bits or code 285, so we
+ * overwrite length_code[255] to use the best encoding:
+ */
+ G2.length_code[length - 1] = code;
+
+ /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+ dist = 0;
+ for (code = 0; code < 16; code++) {
+ G2.base_dist[code] = dist;
+ for (n = 0; n < (1 << extra_dbits[code]); n++) {
+ G2.dist_code[dist++] = code;
+ }
+ }
+ Assert(dist == 256, "ct_init: dist != 256");
+ dist >>= 7; /* from now on, all distances are divided by 128 */
+ for (; code < D_CODES; code++) {
+ G2.base_dist[code] = dist << 7;
+ for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {
+ G2.dist_code[256 + dist++] = code;
+ }
+ }
+ Assert(dist == 256, "ct_init: 256+dist != 512");
+
+ /* Construct the codes of the static literal tree */
+ /* already zeroed - it's in bss
+ for (n = 0; n <= MAX_BITS; n++)
+ G2.bl_count[n] = 0; */
+
+ n = 0;
+ while (n <= 143) {
+ G2.static_ltree[n++].Len = 8;
+ G2.bl_count[8]++;
+ }
+ while (n <= 255) {
+ G2.static_ltree[n++].Len = 9;
+ G2.bl_count[9]++;
+ }
+ while (n <= 279) {
+ G2.static_ltree[n++].Len = 7;
+ G2.bl_count[7]++;
+ }
+ while (n <= 287) {
+ G2.static_ltree[n++].Len = 8;
+ G2.bl_count[8]++;
+ }
+ /* Codes 286 and 287 do not exist, but we must include them in the
+ * tree construction to get a canonical Huffman tree (longest code
+ * all ones)
+ */
+ gen_codes((ct_data *) G2.static_ltree, L_CODES + 1);
+
+ /* The static distance tree is trivial: */
+ for (n = 0; n < D_CODES; n++) {
+ G2.static_dtree[n].Len = 5;
+ G2.static_dtree[n].Code = bi_reverse(n, 5);
+ }
+
+ /* Initialize the first block of the first file: */
+ init_block();
+}
+
+
+/* ===========================================================================
+ * Deflate in to out.
+ * IN assertions: the input and output buffers are cleared.
+ */
+
+static void zip(ulg time_stamp)
+{
+ ush deflate_flags = 0; /* pkzip -es, -en or -ex equivalent */
+
+ G1.outcnt = 0;
+
+ /* Write the header to the gzip file. See algorithm.doc for the format */
+ /* magic header for gzip files: 1F 8B */
+ /* compression method: 8 (DEFLATED) */
+ /* general flags: 0 */
+ put_32bit(0x00088b1f);
+ put_32bit(time_stamp);
+
+ /* Write deflated file to zip file */
+ G1.crc = ~0;
+
+ bi_init();
+ ct_init();
+ lm_init(&deflate_flags);
+
+ put_8bit(deflate_flags); /* extra flags */
+ put_8bit(3); /* OS identifier = 3 (Unix) */
+
+ deflate();
+
+ /* Write the crc and uncompressed size */
+ put_32bit(~G1.crc);
+ put_32bit(G1.isize);
+
+ flush_outbuf();
+}
+
+
+/* ======================================================================== */
+static
+char* make_new_name_gzip(char *filename)
+{
+ return xasprintf("%s.gz", filename);
+}
+
+static
+USE_DESKTOP(long long) int pack_gzip(void)
+{
+ struct stat s;
+
+ clear_bufs();
+ s.st_ctime = 0;
+ fstat(STDIN_FILENO, &s);
+ zip(s.st_ctime);
+ return 0;
+}
+
+int gzip_main(int argc, char **argv);
+int gzip_main(int argc, char **argv)
+{
+ unsigned opt;
+
+ /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
+ opt = getopt32(argc, argv, "cfv" USE_GUNZIP("d") "q123456789" );
+ option_mask32 &= 0x7; /* Clear -d, ignore -q, -0..9 */
+ //if (opt & 0x1) // -c
+ //if (opt & 0x2) // -f
+ //if (opt & 0x4) // -v
+#if ENABLE_GUNZIP /* gunzip_main may not be visible... */
+ if (opt & 0x8) { // -d
+ return gunzip_main(argc, argv);
+ }
+#endif
+ argv += optind;
+
+ PTR_TO_GLOBALS = xzalloc(sizeof(struct globals) + sizeof(struct globals2))
+ + sizeof(struct globals);
+ G2.l_desc.dyn_tree = G2.dyn_ltree;
+ G2.l_desc.static_tree = G2.static_ltree;
+ G2.l_desc.extra_bits = extra_lbits;
+ G2.l_desc.extra_base = LITERALS + 1;
+ G2.l_desc.elems = L_CODES;
+ G2.l_desc.max_length = MAX_BITS;
+ //G2.l_desc.max_code = 0;
+
+ G2.d_desc.dyn_tree = G2.dyn_dtree;
+ G2.d_desc.static_tree = G2.static_dtree;
+ G2.d_desc.extra_bits = extra_dbits;
+ //G2.d_desc.extra_base = 0;
+ G2.d_desc.elems = D_CODES;
+ G2.d_desc.max_length = MAX_BITS;
+ //G2.d_desc.max_code = 0;
+
+ G2.bl_desc.dyn_tree = G2.bl_tree;
+ //G2.bl_desc.static_tree = NULL;
+ G2.bl_desc.extra_bits = extra_blbits,
+ //G2.bl_desc.extra_base = 0;
+ G2.bl_desc.elems = BL_CODES;
+ G2.bl_desc.max_length = MAX_BL_BITS;
+ //G2.bl_desc.max_code = 0;
+
+ /* Allocate all global buffers (for DYN_ALLOC option) */
+ ALLOC(uch, G1.l_buf, INBUFSIZ);
+ ALLOC(uch, G1.outbuf, OUTBUFSIZ);
+ ALLOC(ush, G1.d_buf, DIST_BUFSIZE);
+ ALLOC(uch, G1.window, 2L * WSIZE);
+ ALLOC(ush, G1.prev, 1L << BITS);
+
+ /* Initialise the CRC32 table */
+ G1.crc_32_tab = crc32_filltable(0);
+
+ return bbunpack(argv, make_new_name_gzip, pack_gzip);
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/Kbuild b/i/pc104/initrd/conf/busybox/archival/libunarchive/Kbuild
new file mode 100644
index 0000000..4e14541
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/Kbuild
@@ -0,0 +1,59 @@
+# Makefile for busybox
+#
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+#
+# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+
+lib-y:= \
+\
+ data_skip.o \
+ data_extract_all.o \
+ data_extract_to_stdout.o \
+ data_extract_to_buffer.o \
+\
+ filter_accept_all.o \
+ filter_accept_list.o \
+ filter_accept_reject_list.o \
+\
+ header_skip.o \
+ header_list.o \
+ header_verbose_list.o \
+\
+ archive_xread_all_eof.o \
+\
+ seek_by_read.o \
+ seek_by_jump.o \
+\
+ data_align.o \
+ find_list_entry.o \
+ open_transformer.o \
+ init_handle.o
+
+GUNZIP_FILES:= check_header_gzip.o decompress_unzip.o
+DPKG_FILES:= \
+ get_header_ar.o \
+ unpack_ar_archive.o \
+ get_header_tar.o \
+ filter_accept_list_reassign.o
+
+lib-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
+lib-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
+lib-$(CONFIG_UNLZMA) += decompress_unlzma.o
+lib-$(CONFIG_CPIO) += get_header_cpio.o
+lib-$(CONFIG_DPKG) += $(DPKG_FILES)
+lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES)
+lib-$(CONFIG_FEATURE_DEB_TAR_GZ) += $(GUNZIP_FILES) get_header_tar_gz.o
+lib-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o
+lib-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o
+lib-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
+lib-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o
+lib-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
+lib-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
+lib-$(CONFIG_TAR) += get_header_tar.o
+lib-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
+lib-$(CONFIG_FEATURE_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o
+lib-$(CONFIG_FEATURE_TAR_GZIP) += $(GUNZIP_FILES) get_header_tar_gz.o
+lib-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o
+lib-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o
+lib-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
+lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/archive_xread_all_eof.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/archive_xread_all_eof.c
new file mode 100644
index 0000000..007f68c
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/archive_xread_all_eof.c
@@ -0,0 +1,20 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include "unarchive.h"
+#include "libbb.h"
+
+ssize_t archive_xread_all_eof(archive_handle_t *archive_handle,
+ unsigned char *buf, size_t count)
+{
+ ssize_t size;
+
+ size = full_read(archive_handle->src_fd, buf, count);
+ if (size != 0 && size != count) {
+ bb_error_msg_and_die("short read: %u of %u",
+ (unsigned)size, (unsigned)count);
+ }
+ return size;
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/check_header_gzip.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/check_header_gzip.c
new file mode 100644
index 0000000..66aa574
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/check_header_gzip.c
@@ -0,0 +1,59 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include "libbb.h"
+#include "unarchive.h" /* for external decl of check_header_gzip_or_die */
+
+void check_header_gzip_or_die(int src_fd)
+{
+ union {
+ unsigned char raw[8];
+ struct {
+ unsigned char method;
+ unsigned char flags;
+ unsigned int mtime;
+ unsigned char xtra_flags;
+ unsigned char os_flags;
+ } formatted;
+ } header;
+
+ xread(src_fd, header.raw, 8);
+
+ /* Check the compression method */
+ if (header.formatted.method != 8) {
+ bb_error_msg_and_die("unknown compression method %d",
+ header.formatted.method);
+ }
+
+ if (header.formatted.flags & 0x04) {
+ /* bit 2 set: extra field present */
+ unsigned extra_short;
+
+ extra_short = xread_char(src_fd) + (xread_char(src_fd) << 8);
+ while (extra_short > 0) {
+ /* Ignore extra field */
+ xread_char(src_fd);
+ extra_short--;
+ }
+ }
+
+ /* Discard original name if any */
+ if (header.formatted.flags & 0x08) {
+ /* bit 3 set: original file name present */
+ while (xread_char(src_fd) != 0);
+ }
+
+ /* Discard file comment if any */
+ if (header.formatted.flags & 0x10) {
+ /* bit 4 set: file comment present */
+ while (xread_char(src_fd) != 0);
+ }
+
+ /* Read the header checksum */
+ if (header.formatted.flags & 0x02) {
+ xread_char(src_fd);
+ xread_char(src_fd);
+ }
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/data_align.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_align.c
new file mode 100644
index 0000000..946c94d
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_align.c
@@ -0,0 +1,17 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include <sys/types.h>
+
+#include "libbb.h"
+#include "unarchive.h"
+
+void data_align(archive_handle_t *archive_handle, const unsigned short boundary)
+{
+ const unsigned short skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary;
+
+ archive_handle->seek(archive_handle, skip_amount);
+ archive_handle->offset += skip_amount;
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_all.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_all.c
new file mode 100644
index 0000000..0bb5bfe
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_all.c
@@ -0,0 +1,127 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include "libbb.h"
+#include "unarchive.h"
+
+void data_extract_all(archive_handle_t *archive_handle)
+{
+ file_header_t *file_header = archive_handle->file_header;
+ int dst_fd;
+ int res;
+
+ if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
+ char *name = xstrdup(file_header->name);
+ bb_make_directory(dirname(name), -1, FILEUTILS_RECUR);
+ free(name);
+ }
+
+ /* Check if the file already exists */
+ if (archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) {
+ /* Remove the existing entry if it exists */
+ if (((file_header->mode & S_IFMT) != S_IFDIR)
+ && (unlink(file_header->name) == -1)
+ && (errno != ENOENT)
+ ) {
+ bb_perror_msg_and_die("cannot remove old file");
+ }
+ }
+ else if (archive_handle->flags & ARCHIVE_EXTRACT_NEWER) {
+ /* Remove the existing entry if its older than the extracted entry */
+ struct stat statbuf;
+ if (lstat(file_header->name, &statbuf) == -1) {
+ if (errno != ENOENT) {
+ bb_perror_msg_and_die("cannot stat old file");
+ }
+ }
+ else if (statbuf.st_mtime <= file_header->mtime) {
+ if (!(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
+ bb_error_msg("%s not created: newer or "
+ "same age file exists", file_header->name);
+ }
+ data_skip(archive_handle);
+ return;
+ }
+ else if ((unlink(file_header->name) == -1) && (errno != EISDIR)) {
+ bb_perror_msg_and_die("cannot remove old file %s",
+ file_header->name);
+ }
+ }
+
+ /* Handle hard links separately
+ * We identified hard links as regular files of size 0 with a symlink */
+ if (S_ISREG(file_header->mode) && (file_header->link_name)
+ && (file_header->size == 0)
+ ) {
+ /* hard link */
+ res = link(file_header->link_name, file_header->name);
+ if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
+ bb_perror_msg("cannot create hard link");
+ }
+ } else {
+ /* Create the filesystem entry */
+ switch (file_header->mode & S_IFMT) {
+ case S_IFREG: {
+ /* Regular file */
+ dst_fd = xopen3(file_header->name, O_WRONLY | O_CREAT | O_EXCL,
+ file_header->mode);
+ bb_copyfd_exact_size(archive_handle->src_fd, dst_fd, file_header->size);
+ close(dst_fd);
+ break;
+ }
+ case S_IFDIR:
+ res = mkdir(file_header->name, file_header->mode);
+ if ((errno != EISDIR) && (res == -1)
+ && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)
+ ) {
+ bb_perror_msg("extract_archive: %s", file_header->name);
+ }
+ break;
+ case S_IFLNK:
+ /* Symlink */
+ res = symlink(file_header->link_name, file_header->name);
+ if ((res == -1)
+ && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)
+ ) {
+ bb_perror_msg("cannot create symlink "
+ "from %s to '%s'",
+ file_header->name,
+ file_header->link_name);
+ }
+ break;
+ case S_IFSOCK:
+ case S_IFBLK:
+ case S_IFCHR:
+ case S_IFIFO:
+ res = mknod(file_header->name, file_header->mode, file_header->device);
+ if ((res == -1)
+ && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)
+ ) {
+ bb_perror_msg("cannot create node %s", file_header->name);
+ }
+ break;
+ default:
+ bb_error_msg_and_die("unrecognized file type");
+ }
+ }
+
+ if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) {
+ lchown(file_header->name, file_header->uid, file_header->gid);
+ }
+ /* uclibc has no lchmod, glibc is even stranger -
+ * it has lchmod which seems to do nothing!
+ * so we use chmod... */
+ if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_PERM)
+ && (file_header->mode & S_IFMT) != S_IFLNK
+ ) {
+ chmod(file_header->name, file_header->mode);
+ }
+
+ if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
+ struct utimbuf t;
+ t.actime = t.modtime = file_header->mtime;
+ utime(file_header->name, &t);
+ }
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_buffer.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_buffer.c
new file mode 100644
index 0000000..d8fcdf3
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_buffer.c
@@ -0,0 +1,17 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright 2002 Glenn McGrath
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include "libbb.h"
+#include "unarchive.h"
+
+void data_extract_to_buffer(archive_handle_t *archive_handle)
+{
+ unsigned int size = archive_handle->file_header->size;
+
+ archive_handle->buffer = xzalloc(size + 1);
+ xread(archive_handle->src_fd, archive_handle->buffer, size);
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_stdout.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_stdout.c
new file mode 100644
index 0000000..d87a4a5
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_extract_to_stdout.c
@@ -0,0 +1,13 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include "unarchive.h"
+
+void data_extract_to_stdout(archive_handle_t *archive_handle)
+{
+ bb_copyfd_exact_size(archive_handle->src_fd,
+ STDOUT_FILENO,
+ archive_handle->file_header->size);
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/data_skip.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_skip.c
new file mode 100644
index 0000000..dc3505a
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/data_skip.c
@@ -0,0 +1,16 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "unarchive.h"
+#include "libbb.h"
+
+void data_skip(archive_handle_t *archive_handle)
+{
+ archive_handle->seek(archive_handle, archive_handle->file_header->size);
+}
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_bunzip2.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_bunzip2.c
new file mode 100644
index 0000000..ff7d64d
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_bunzip2.c
@@ -0,0 +1,731 @@
+/* vi: set sw=4 ts=4: */
+/* Small bzip2 deflate implementation, by Rob Landley (rob@landley.net).
+
+ Based on bzip2 decompression code by Julian R Seward (jseward@acm.org),
+ which also acknowledges contributions by Mike Burrows, David Wheeler,
+ Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
+ Robert Sedgewick, and Jon L. Bentley.
+
+ Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+*/
+
+/*
+ Size and speed optimizations by Manuel Novoa III (mjn3@codepoet.org).
+
+ More efficient reading of Huffman codes, a streamlined read_bunzip()
+ function, and various other tweaks. In (limited) tests, approximately
+ 20% faster than bzcat on x86 and about 10% faster on arm.
+
+ Note that about 2/3 of the time is spent in read_unzip() reversing
+ the Burrows-Wheeler transformation. Much of that time is delay
+ resulting from cache misses.
+
+ I would ask that anyone benefiting from this work, especially those
+ using it in commercial products, consider making a donation to my local
+ non-profit hospice organization (www.hospiceacadiana.com) in the name of
+ the woman I loved, Toni W. Hagan, who passed away Feb. 12, 2003.
+
+ Manuel
+ */
+
+#include "libbb.h"
+#include "unarchive.h"
+
+/* Constants for Huffman coding */
+#define MAX_GROUPS 6
+#define GROUP_SIZE 50 /* 64 would have been more efficient */
+#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */
+#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
+#define SYMBOL_RUNA 0
+#define SYMBOL_RUNB 1
+
+/* Status return values */
+#define RETVAL_OK 0
+#define RETVAL_LAST_BLOCK (-1)
+#define RETVAL_NOT_BZIP_DATA (-2)
+#define RETVAL_UNEXPECTED_INPUT_EOF (-3)
+#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4)
+#define RETVAL_DATA_ERROR (-5)
+#define RETVAL_OUT_OF_MEMORY (-6)
+#define RETVAL_OBSOLETE_INPUT (-7)
+
+/* Other housekeeping constants */
+#define IOBUF_SIZE 4096
+
+/* This is what we know about each Huffman coding group */
+struct group_data {
+ /* We have an extra slot at the end of limit[] for a sentinal value. */
+ int limit[MAX_HUFCODE_BITS+1],base[MAX_HUFCODE_BITS],permute[MAX_SYMBOLS];
+ int minLen, maxLen;
+};
+
+/* Structure holding all the housekeeping data, including IO buffers and
+ memory that persists between calls to bunzip */
+
+typedef struct {
+ /* State for interrupting output loop */
+
+ int writeCopies,writePos,writeRunCountdown,writeCount,writeCurrent;
+
+ /* I/O tracking data (file handles, buffers, positions, etc.) */
+
+ int in_fd,out_fd,inbufCount,inbufPos /*,outbufPos*/;
+ unsigned char *inbuf /*,*outbuf*/;
+ unsigned int inbufBitCount, inbufBits;
+
+ /* The CRC values stored in the block header and calculated from the data */
+
+ uint32_t headerCRC, totalCRC, writeCRC;
+ uint32_t *crc32Table;
+ /* Intermediate buffer and its size (in bytes) */
+
+ unsigned int *dbuf, dbufSize;
+
+ /* These things are a bit too big to go on the stack */
+
+ unsigned char selectors[32768]; /* nSelectors=15 bits */
+ struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */
+
+ /* For I/O error handling */
+
+ jmp_buf jmpbuf;
+} bunzip_data;
+
+/* Return the next nnn bits of input. All reads from the compressed input
+ are done through this function. All reads are big endian */
+
+static unsigned int get_bits(bunzip_data *bd, char bits_wanted)
+{
+ unsigned int bits=0;
+
+ /* If we need to get more data from the byte buffer, do so. (Loop getting
+ one byte at a time to enforce endianness and avoid unaligned access.) */
+
+ while (bd->inbufBitCount<bits_wanted) {
+
+ /* If we need to read more data from file into byte buffer, do so */
+
+ if(bd->inbufPos==bd->inbufCount) {
+ if((bd->inbufCount = read(bd->in_fd, bd->inbuf, IOBUF_SIZE)) <= 0)
+ longjmp(bd->jmpbuf,RETVAL_UNEXPECTED_INPUT_EOF);
+ bd->inbufPos=0;
+ }
+
+ /* Avoid 32-bit overflow (dump bit buffer to top of output) */
+
+ if(bd->inbufBitCount>=24) {
+ bits=bd->inbufBits&((1<<bd->inbufBitCount)-1);
+ bits_wanted-=bd->inbufBitCount;
+ bits<<=bits_wanted;
+ bd->inbufBitCount=0;
+ }
+
+ /* Grab next 8 bits of input from buffer. */
+
+ bd->inbufBits=(bd->inbufBits<<8)|bd->inbuf[bd->inbufPos++];
+ bd->inbufBitCount+=8;
+ }
+
+ /* Calculate result */
+
+ bd->inbufBitCount-=bits_wanted;
+ bits|=(bd->inbufBits>>bd->inbufBitCount)&((1<<bits_wanted)-1);
+
+ return bits;
+}
+
+/* Unpacks the next block and sets up for the inverse burrows-wheeler step. */
+
+static int get_next_block(bunzip_data *bd)
+{
+ struct group_data *hufGroup;
+ int dbufCount,nextSym,dbufSize,groupCount,*base,*limit,selector,
+ i,j,k,t,runPos,symCount,symTotal,nSelectors,byteCount[256];
+ unsigned char uc, symToByte[256], mtfSymbol[256], *selectors;
+ unsigned int *dbuf,origPtr;
+
+ dbuf=bd->dbuf;
+ dbufSize=bd->dbufSize;
+ selectors=bd->selectors;
+
+ /* Reset longjmp I/O error handling */
+
+ i=setjmp(bd->jmpbuf);
+ if (i) return i;
+
+ /* Read in header signature and CRC, then validate signature.
+ (last block signature means CRC is for whole file, return now) */
+
+ i = get_bits(bd,24);
+ j = get_bits(bd,24);
+ bd->headerCRC=get_bits(bd,32);
+ if ((i == 0x177245) && (j == 0x385090)) return RETVAL_LAST_BLOCK;
+ if ((i != 0x314159) || (j != 0x265359)) return RETVAL_NOT_BZIP_DATA;
+
+ /* We can add support for blockRandomised if anybody complains. There was
+ some code for this in busybox 1.0.0-pre3, but nobody ever noticed that
+ it didn't actually work. */
+
+ if (get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
+ if ((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR;
+
+ /* mapping table: if some byte values are never used (encoding things
+ like ascii text), the compression code removes the gaps to have fewer
+ symbols to deal with, and writes a sparse bitfield indicating which
+ values were present. We make a translation table to convert the symbols
+ back to the corresponding bytes. */
+
+ t=get_bits(bd, 16);
+ symTotal=0;
+ for (i=0;i<16;i++) {
+ if(t&(1<<(15-i))) {
+ k=get_bits(bd,16);
+ for (j=0;j<16;j++)
+ if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j;
+ }
+ }
+
+ /* How many different Huffman coding groups does this block use? */
+
+ groupCount=get_bits(bd,3);
+ if (groupCount<2 || groupCount>MAX_GROUPS) return RETVAL_DATA_ERROR;
+
+ /* nSelectors: Every GROUP_SIZE many symbols we select a new Huffman coding
+ group. Read in the group selector list, which is stored as MTF encoded
+ bit runs. (MTF=Move To Front, as each value is used it's moved to the
+ start of the list.) */
+
+ if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR;
+ for (i=0; i<groupCount; i++) mtfSymbol[i] = i;
+ for (i=0; i<nSelectors; i++) {
+
+ /* Get next value */
+
+ for (j=0;get_bits(bd,1);j++) if (j>=groupCount) return RETVAL_DATA_ERROR;
+
+ /* Decode MTF to get the next selector */
+
+ uc = mtfSymbol[j];
+ for (;j;j--) mtfSymbol[j] = mtfSymbol[j-1];
+ mtfSymbol[0]=selectors[i]=uc;
+ }
+
+ /* Read the Huffman coding tables for each group, which code for symTotal
+ literal symbols, plus two run symbols (RUNA, RUNB) */
+
+ symCount=symTotal+2;
+ for (j=0; j<groupCount; j++) {
+ unsigned char length[MAX_SYMBOLS],temp[MAX_HUFCODE_BITS+1];
+ int minLen, maxLen, pp;
+
+ /* Read Huffman code lengths for each symbol. They're stored in
+ a way similar to mtf; record a starting value for the first symbol,
+ and an offset from the previous value for everys symbol after that.
+ (Subtracting 1 before the loop and then adding it back at the end is
+ an optimization that makes the test inside the loop simpler: symbol
+ length 0 becomes negative, so an unsigned inequality catches it.) */
+
+ t=get_bits(bd, 5)-1;
+ for (i = 0; i < symCount; i++) {
+ for (;;) {
+ if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
+ return RETVAL_DATA_ERROR;
+
+ /* If first bit is 0, stop. Else second bit indicates whether
+ to increment or decrement the value. Optimization: grab 2
+ bits and unget the second if the first was 0. */
+
+ k = get_bits(bd,2);
+ if (k < 2) {
+ bd->inbufBitCount++;
+ break;
+ }
+
+ /* Add one if second bit 1, else subtract 1. Avoids if/else */
+
+ t+=(((k+1)&2)-1);
+ }
+
+ /* Correct for the initial -1, to get the final symbol length */
+
+ length[i]=t+1;
+ }
+
+ /* Find largest and smallest lengths in this group */
+
+ minLen=maxLen=length[0];
+ for (i = 1; i < symCount; i++) {
+ if(length[i] > maxLen) maxLen = length[i];
+ else if(length[i] < minLen) minLen = length[i];
+ }
+
+ /* Calculate permute[], base[], and limit[] tables from length[].
+ *
+ * permute[] is the lookup table for converting Huffman coded symbols
+ * into decoded symbols. base[] is the amount to subtract from the
+ * value of a Huffman symbol of a given length when using permute[].
+ *
+ * limit[] indicates the largest numerical value a symbol with a given
+ * number of bits can have. This is how the Huffman codes can vary in
+ * length: each code with a value>limit[length] needs another bit.
+ */
+
+ hufGroup=bd->groups+j;
+ hufGroup->minLen = minLen;
+ hufGroup->maxLen = maxLen;
+
+ /* Note that minLen can't be smaller than 1, so we adjust the base
+ and limit array pointers so we're not always wasting the first
+ entry. We do this again when using them (during symbol decoding).*/
+
+ base=hufGroup->base-1;
+ limit=hufGroup->limit-1;
+
+ /* Calculate permute[]. Concurently, initialize temp[] and limit[]. */
+
+ pp=0;
+ for (i=minLen;i<=maxLen;i++) {
+ temp[i]=limit[i]=0;
+ for (t=0;t<symCount;t++)
+ if(length[t]==i) hufGroup->permute[pp++] = t;
+ }
+
+ /* Count symbols coded for at each bit length */
+
+ for (i=0;i<symCount;i++) temp[length[i]]++;
+
+ /* Calculate limit[] (the largest symbol-coding value at each bit
+ * length, which is (previous limit<<1)+symbols at this level), and
+ * base[] (number of symbols to ignore at each bit length, which is
+ * limit minus the cumulative count of symbols coded for already). */
+
+ pp=t=0;
+ for (i=minLen; i<maxLen; i++) {
+ pp+=temp[i];
+
+ /* We read the largest possible symbol size and then unget bits
+ after determining how many we need, and those extra bits could
+ be set to anything. (They're noise from future symbols.) At
+ each level we're really only interested in the first few bits,
+ so here we set all the trailing to-be-ignored bits to 1 so they
+ don't affect the value>limit[length] comparison. */
+
+ limit[i]= (pp << (maxLen - i)) - 1;
+ pp<<=1;
+ base[i+1]=pp-(t+=temp[i]);
+ }
+ limit[maxLen+1] = INT_MAX; /* Sentinal value for reading next sym. */
+ limit[maxLen]=pp+temp[maxLen]-1;
+ base[minLen]=0;
+ }
+
+ /* We've finished reading and digesting the block header. Now read this
+ block's Huffman coded symbols from the file and undo the Huffman coding
+ and run length encoding, saving the result into dbuf[dbufCount++]=uc */
+
+ /* Initialize symbol occurrence counters and symbol Move To Front table */
+
+ for (i=0;i<256;i++) {
+ byteCount[i] = 0;
+ mtfSymbol[i]=(unsigned char)i;
+ }
+
+ /* Loop through compressed symbols. */
+
+ runPos=dbufCount=selector=0;
+ for (;;) {
+
+ /* fetch next Huffman coding group from list. */
+
+ symCount=GROUP_SIZE-1;
+ if(selector>=nSelectors) return RETVAL_DATA_ERROR;
+ hufGroup=bd->groups+selectors[selector++];
+ base=hufGroup->base-1;
+ limit=hufGroup->limit-1;
+continue_this_group:
+
+ /* Read next Huffman-coded symbol. */
+
+ /* Note: It is far cheaper to read maxLen bits and back up than it is
+ to read minLen bits and then an additional bit at a time, testing
+ as we go. Because there is a trailing last block (with file CRC),
+ there is no danger of the overread causing an unexpected EOF for a
+ valid compressed file. As a further optimization, we do the read
+ inline (falling back to a call to get_bits if the buffer runs
+ dry). The following (up to got_huff_bits:) is equivalent to
+ j=get_bits(bd,hufGroup->maxLen);
+ */
+
+ while (bd->inbufBitCount<hufGroup->maxLen) {
+ if(bd->inbufPos==bd->inbufCount) {
+ j = get_bits(bd,hufGroup->maxLen);
+ goto got_huff_bits;
+ }
+ bd->inbufBits=(bd->inbufBits<<8)|bd->inbuf[bd->inbufPos++];
+ bd->inbufBitCount+=8;
+ };
+ bd->inbufBitCount-=hufGroup->maxLen;
+ j = (bd->inbufBits>>bd->inbufBitCount)&((1<<hufGroup->maxLen)-1);
+
+got_huff_bits:
+
+ /* Figure how how many bits are in next symbol and unget extras */
+
+ i=hufGroup->minLen;
+ while (j>limit[i]) ++i;
+ bd->inbufBitCount += (hufGroup->maxLen - i);
+
+ /* Huffman decode value to get nextSym (with bounds checking) */
+
+ if ((i > hufGroup->maxLen)
+ || (((unsigned)(j=(j>>(hufGroup->maxLen-i))-base[i]))
+ >= MAX_SYMBOLS))
+ return RETVAL_DATA_ERROR;
+ nextSym = hufGroup->permute[j];
+
+ /* We have now decoded the symbol, which indicates either a new literal
+ byte, or a repeated run of the most recent literal byte. First,
+ check if nextSym indicates a repeated run, and if so loop collecting
+ how many times to repeat the last literal. */
+
+ if (((unsigned)nextSym) <= SYMBOL_RUNB) { /* RUNA or RUNB */
+
+ /* If this is the start of a new run, zero out counter */
+
+ if(!runPos) {
+ runPos = 1;
+ t = 0;
+ }
+
+ /* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at
+ each bit position, add 1 or 2 instead. For example,
+ 1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2.
+ You can make any bit pattern that way using 1 less symbol than
+ the basic or 0/1 method (except all bits 0, which would use no
+ symbols, but a run of length 0 doesn't mean anything in this
+ context). Thus space is saved. */
+
+ t += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
+ if(runPos < dbufSize) runPos <<= 1;
+ goto end_of_huffman_loop;
+ }
+
+ /* When we hit the first non-run symbol after a run, we now know
+ how many times to repeat the last literal, so append that many
+ copies to our buffer of decoded symbols (dbuf) now. (The last
+ literal used is the one at the head of the mtfSymbol array.) */
+
+ if(runPos) {
+ runPos=0;
+ if(dbufCount+t>=dbufSize) return RETVAL_DATA_ERROR;
+
+ uc = symToByte[mtfSymbol[0]];
+ byteCount[uc] += t;
+ while (t--) dbuf[dbufCount++]=uc;
+ }
+
+ /* Is this the terminating symbol? */
+
+ if(nextSym>symTotal) break;
+
+ /* At this point, nextSym indicates a new literal character. Subtract
+ one to get the position in the MTF array at which this literal is
+ currently to be found. (Note that the result can't be -1 or 0,
+ because 0 and 1 are RUNA and RUNB. But another instance of the
+ first symbol in the mtf array, position 0, would have been handled
+ as part of a run above. Therefore 1 unused mtf position minus
+ 2 non-literal nextSym values equals -1.) */
+
+ if(dbufCount>=dbufSize) return RETVAL_DATA_ERROR;
+ i = nextSym - 1;
+ uc = mtfSymbol[i];
+
+ /* Adjust the MTF array. Since we typically expect to move only a
+ * small number of symbols, and are bound by 256 in any case, using
+ * memmove here would typically be bigger and slower due to function
+ * call overhead and other assorted setup costs. */
+
+ do {
+ mtfSymbol[i] = mtfSymbol[i-1];
+ } while (--i);
+ mtfSymbol[0] = uc;
+ uc=symToByte[uc];
+
+ /* We have our literal byte. Save it into dbuf. */
+
+ byteCount[uc]++;
+ dbuf[dbufCount++] = (unsigned int)uc;
+
+ /* Skip group initialization if we're not done with this group. Done
+ * this way to avoid compiler warning. */
+
+end_of_huffman_loop:
+ if(symCount--) goto continue_this_group;
+ }
+
+ /* At this point, we've read all the Huffman-coded symbols (and repeated
+ runs) for this block from the input stream, and decoded them into the
+ intermediate buffer. There are dbufCount many decoded bytes in dbuf[].
+ Now undo the Burrows-Wheeler transform on dbuf.
+ See http://dogma.net/markn/articles/bwt/bwt.htm
+ */
+
+ /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
+
+ j=0;
+ for (i=0;i<256;i++) {
+ k=j+byteCount[i];
+ byteCount[i] = j;
+ j=k;
+ }
+
+ /* Figure out what order dbuf would be in if we sorted it. */
+
+ for (i=0;i<dbufCount;i++) {
+ uc=(unsigned char)(dbuf[i] & 0xff);
+ dbuf[byteCount[uc]] |= (i << 8);
+ byteCount[uc]++;
+ }
+
+ /* Decode first byte by hand to initialize "previous" byte. Note that it
+ doesn't get output, and if the first three characters are identical
+ it doesn't qualify as a run (hence writeRunCountdown=5). */
+
+ if(dbufCount) {
+ if(origPtr>=dbufCount) return RETVAL_DATA_ERROR;
+ bd->writePos=dbuf[origPtr];
+ bd->writeCurrent=(unsigned char)(bd->writePos&0xff);
+ bd->writePos>>=8;
+ bd->writeRunCountdown=5;
+ }
+ bd->writeCount=dbufCount;
+
+ return RETVAL_OK;
+}
+
+/* Undo burrows-wheeler transform on intermediate buffer to produce output.
+ If start_bunzip was initialized with out_fd=-1, then up to len bytes of
+ data are written to outbuf. Return value is number of bytes written or
+ error (all errors are negative numbers). If out_fd!=-1, outbuf and len
+ are ignored, data is written to out_fd and return is RETVAL_OK or error.
+*/
+
+static int read_bunzip(bunzip_data *bd, char *outbuf, int len)
+{
+ const unsigned int *dbuf;
+ int pos,current,previous,gotcount;
+
+ /* If last read was short due to end of file, return last block now */
+ if(bd->writeCount<0) return bd->writeCount;
+
+ gotcount = 0;
+ dbuf=bd->dbuf;
+ pos=bd->writePos;
+ current=bd->writeCurrent;
+
+ /* We will always have pending decoded data to write into the output
+ buffer unless this is the very first call (in which case we haven't
+ Huffman-decoded a block into the intermediate buffer yet). */
+
+ if (bd->writeCopies) {
+
+ /* Inside the loop, writeCopies means extra copies (beyond 1) */
+
+ --bd->writeCopies;
+
+ /* Loop outputting bytes */
+
+ for (;;) {
+
+ /* If the output buffer is full, snapshot state and return */
+
+ if(gotcount >= len) {
+ bd->writePos=pos;
+ bd->writeCurrent=current;
+ bd->writeCopies++;
+ return len;
+ }
+
+ /* Write next byte into output buffer, updating CRC */
+
+ outbuf[gotcount++] = current;
+ bd->writeCRC=(((bd->writeCRC)<<8)
+ ^bd->crc32Table[((bd->writeCRC)>>24)^current]);
+
+ /* Loop now if we're outputting multiple copies of this byte */
+
+ if (bd->writeCopies) {
+ --bd->writeCopies;
+ continue;
+ }
+decode_next_byte:
+ if (!bd->writeCount--) break;
+ /* Follow sequence vector to undo Burrows-Wheeler transform */
+ previous=current;
+ pos=dbuf[pos];
+ current=pos&0xff;
+ pos>>=8;
+
+ /* After 3 consecutive copies of the same byte, the 4th is a repeat
+ count. We count down from 4 instead
+ * of counting up because testing for non-zero is faster */
+
+ if(--bd->writeRunCountdown) {
+ if(current!=previous) bd->writeRunCountdown=4;
+ } else {
+
+ /* We have a repeated run, this byte indicates the count */
+
+ bd->writeCopies=current;
+ current=previous;
+ bd->writeRunCountdown=5;
+
+ /* Sometimes there are just 3 bytes (run length 0) */
+
+ if(!bd->writeCopies) goto decode_next_byte;
+
+ /* Subtract the 1 copy we'd output anyway to get extras */
+
+ --bd->writeCopies;
+ }
+ }
+
+ /* Decompression of this block completed successfully */
+
+ bd->writeCRC=~bd->writeCRC;
+ bd->totalCRC=((bd->totalCRC<<1) | (bd->totalCRC>>31)) ^ bd->writeCRC;
+
+ /* If this block had a CRC error, force file level CRC error. */
+
+ if(bd->writeCRC!=bd->headerCRC) {
+ bd->totalCRC=bd->headerCRC+1;
+ return RETVAL_LAST_BLOCK;
+ }
+ }
+
+ /* Refill the intermediate buffer by Huffman-decoding next block of input */
+ /* (previous is just a convenient unused temp variable here) */
+
+ previous=get_next_block(bd);
+ if(previous) {
+ bd->writeCount=previous;
+ return (previous!=RETVAL_LAST_BLOCK) ? previous : gotcount;
+ }
+ bd->writeCRC=~0;
+ pos=bd->writePos;
+ current=bd->writeCurrent;
+ goto decode_next_byte;
+}
+
+/* Allocate the structure, read file header. If in_fd==-1, inbuf must contain
+ a complete bunzip file (len bytes long). If in_fd!=-1, inbuf and len are
+ ignored, and data is read from file handle into temporary buffer. */
+
+static int start_bunzip(bunzip_data **bdp, int in_fd, unsigned char *inbuf,
+ int len)
+{
+ bunzip_data *bd;
+ unsigned int i;
+ const unsigned int BZh0=(((unsigned int)'B')<<24)+(((unsigned int)'Z')<<16)
+ +(((unsigned int)'h')<<8)+(unsigned int)'0';
+
+ /* Figure out how much data to allocate */
+
+ i=sizeof(bunzip_data);
+ if(in_fd!=-1) i+=IOBUF_SIZE;
+
+ /* Allocate bunzip_data. Most fields initialize to zero. */
+
+ bd=*bdp=xzalloc(i);
+
+ /* Setup input buffer */
+
+ if(-1==(bd->in_fd=in_fd)) {
+ bd->inbuf=inbuf;
+ bd->inbufCount=len;
+ } else bd->inbuf=(unsigned char *)(bd+1);
+
+ /* Init the CRC32 table (big endian) */
+
+ bd->crc32Table = crc32_filltable(1);
+
+ /* Setup for I/O error handling via longjmp */
+
+ i=setjmp(bd->jmpbuf);
+ if(i) return i;
+
+ /* Ensure that file starts with "BZh['1'-'9']." */
+
+ i = get_bits(bd,32);
+ if (((unsigned int)(i-BZh0-1)) >= 9) return RETVAL_NOT_BZIP_DATA;
+
+ /* Fourth byte (ascii '1'-'9'), indicates block size in units of 100k of
+ uncompressed data. Allocate intermediate buffer for block. */
+
+ bd->dbufSize=100000*(i-BZh0);
+
+ bd->dbuf=xmalloc(bd->dbufSize * sizeof(int));
+ return RETVAL_OK;
+}
+
+/* Example usage: decompress src_fd to dst_fd. (Stops at end of bzip data,
+ not end of file.) */
+
+USE_DESKTOP(long long) int
+uncompressStream(int src_fd, int dst_fd)
+{
+ USE_DESKTOP(long long total_written = 0;)
+ char *outbuf;
+ bunzip_data *bd;
+ int i;
+
+ outbuf=xmalloc(IOBUF_SIZE);
+ i=start_bunzip(&bd,src_fd,0,0);
+ if(!i) {
+ for (;;) {
+ if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break;
+ if(i!=write(dst_fd,outbuf,i)) {
+ i=RETVAL_UNEXPECTED_OUTPUT_EOF;
+ break;
+ }
+ USE_DESKTOP(total_written += i;)
+ }
+ }
+
+ /* Check CRC and release memory */
+
+ if(i==RETVAL_LAST_BLOCK) {
+ if (bd->headerCRC!=bd->totalCRC) {
+ bb_error_msg("data integrity error when decompressing");
+ } else {
+ i=RETVAL_OK;
+ }
+ } else if (i==RETVAL_UNEXPECTED_OUTPUT_EOF) {
+ bb_error_msg("compressed file ends unexpectedly");
+ } else {
+ bb_error_msg("decompression failed");
+ }
+ free(bd->dbuf);
+ free(bd);
+ free(outbuf);
+
+ return i ? i : USE_DESKTOP(total_written) + 0;
+}
+
+#ifdef TESTING
+
+static char * const bunzip_errors[]={NULL,"Bad file checksum","Not bzip data",
+ "Unexpected input EOF","Unexpected output EOF","Data error",
+ "Out of memory","Obsolete (pre 0.9.5) bzip format not supported."};
+
+/* Dumb little test thing, decompress stdin to stdout */
+int main(int argc, char *argv[])
+{
+ int i=uncompressStream(0,1);
+ char c;
+
+ if(i<0) fprintf(stderr,"%s\n", bunzip_errors[-i]);
+ else if(read(0,&c,1)) fprintf(stderr,"Trailing garbage ignored\n");
+ return -i;
+}
+#endif
diff --git a/i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_uncompress.c b/i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_uncompress.c
new file mode 100644
index 0000000..8ce3cba
--- /dev/null
+++ b/i/pc104/initrd/conf/busybox/archival/libunarchive/decompress_uncompress.c
@@ -0,0 +1,308 @@
+/* vi: set sw=4 ts=4: */
+#include "libbb.h"
+
+/* uncompress for busybox -- (c) 2002 Robert Griebl
+ *
+ * based on the original compress42.c source
+ * (see disclaimer below)
+ */
+
+
+/* (N)compress42.c - File compression ala IEEE Computer, Mar 1992.
+ *
+ * Authors:
+ * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
+ * Jim McKie (decvax!mcvax!jim)
+ * Steve Davies (decvax!vax135!petsd!peora!srd)
+ * Ken Turkowski (decvax!decwrl!turtlevax!ken)
+ * James A. Woods (decvax!ihnp4!ames!jaw)
+ * Joe Orost (decvax!vax135!petsd!joe)
+ * Dave Mack (csu@alembic.acs.com)
+ * Peter Jannesen, Network Communication Systems
+ * (peter@ncs.nl)
+ *
+ * marc@suse.de : a small security fix for a buffer overflow
+ *
+ * [... History snipped ...]
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Default input buffer size */
+#define IBUFSIZ 2048
+
+/* Default output buffer size */
+#define OBUFSIZ 2048
+
+/* Defines for third byte of header */
+#define MAGIC_1 (char_type)'\037' /* First byte of compressed file */
+#define MAGIC_2 (char_type)'\235' /* Second byte of compressed file */
+#define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */
+ /* Masks 0x20 and 0x40 are free. */
+ /* I think 0x20 should mean that there is */
+ /* a fourth header byte (for expansion). */
+#define BLOCK_MODE 0x80 /* Block compresssion if table is full and */
+ /* compression rate is dropping flush tables */
+ /* the next two codes should not be changed lightly, as they must not */
+ /* lie within the contiguous general code space. */
+#define FIRST 257 /* first free entry */
+#define CLEAR 256 /* table clear output code */
+
+#define INIT_BITS 9 /* initial number of bits/code */
+
+
+/* machine variants which require cc -Dmachine: pdp11, z8000, DOS */
+#define FAST
+
+#define HBITS 17 /* 50% occupancy */
+#define HSIZE (1<<HBITS)
+#define HMASK (HSIZE-1)
+#define HPRIME 9941
+#define BITS 16
+#undef MAXSEG_64K
+#define MAXCODE(n) (1L << (n))
+
+#define htabof(i) htab[i]
+#define codetabof(i) codetab[i]
+#define tab_prefixof(i) codetabof(i)
+#define tab_suffixof(i) ((unsigned char *)(htab))[i]
+#define de_stack ((unsigned char *)&(htab[HSIZE-1]))
+#define clear_htab() memset(htab, -1, HSIZE)
+#define clear_tab_prefixof() memset(codetab, 0, 256);
+
+
+/*
+ * Decompress stdin to stdout. This routine adapts to the codes in the
+ * file building the "string" table on-the-fly; requiring no table to
+ * be stored in the compressed file. The tables used herein are shared
+ * with those of the compress() routine. See the definitions above.
+ */
+
+USE_DESKTOP(long long) int
+uncompress(int fd_in, int fd_out)
+{
+ USE_DESKTOP(long long total_written = 0;)
+ unsigned char *stackp;
+ long int code;
+ int finchar;
+ long int oldcode;
+ long int incode;
+ int inbits;
+ int posbits;
+ int outpos;
+ int insize;
+ int bitmask;
+ long int free_ent;
+ long int maxcode;
+ long int maxmaxcode;
+ int n_bits;
+ int rsize = 0;
+ RESERVE_CONFIG_UBUFFER(inbuf, IBUFSIZ + 64);
+ RESERVE_CONFIG_UBUFFER(outbuf, OBUFSIZ + 2048);
+ unsigned char htab[HSIZE];
+ unsigned short codetab[HSIZE];
+
+ /* Hmm, these were statics - why?! */
+ /* user settable max # bits/code */
+ int maxbits; /* = BITS; */
+ /* block compress mode -C compatible with 2.0 */
+ int block_mode; /* = BLOCK_MODE; */
+
+ memset(inbuf, 0, IBUFSIZ + 64);
+ memset(outbuf, 0, OBUFSIZ + 2048);
+
+ insize = 0;
+
+ /* xread isn't good here, we have to return - caller may want
+ * to do some cleanup (e.g. delete incomplete unpacked file etc) */
+ if (full_read(fd_in, inbuf, 1) != 1) {
+ bb_error_msg("short read");
+ return -1;
+ }
+
+ maxbits = inbuf[0] & BIT_MASK;
+ block_mode = inbuf[0] & BLOCK_MODE;
+ maxmaxcode = MAXCODE(maxbits);
+
+ if (maxbits > BITS) {
+ bb_error_msg("compressed with %d bits, can only handle "
+ "%d bits", maxbits, BITS);
+ return -1;
+ }
+
+ n_bits = INIT_BITS;
+ maxcode = MAXCODE(INIT_BITS) - 1;
+ bitmask = (1 << INIT_BITS) - 1;
+ oldcode = -1;
+ finchar = 0;
+ outpos = 0;
+ posbits = 0 << 3;
+
+ free_ent = ((block_mode) ? FIRST : 256);
+
+ /* As above, initialize the first 256 entries in the table. */
+ clear_tab_prefixof();
+
+ for (code = 255; code >= 0; --code) {
+ tab_suffixof(code) = (unsigned char) code;
+ }
+
+ do {
+ resetbuf:
+ {
+ int i;
+ int e;
+ int o;
+
+ o = posbits >> 3;
+ e = insize - o;
+
+ for (i = 0; i < e; ++i)
+ inbuf[i] = inbuf[i + o];
+
+ insize = e;
+ posbits = 0;
+ }
+
+ if (insize < (int) (IBUFSIZ + 64) - IBUFSIZ) {
+ rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ);
+//error check??
+ insize += rsize;
+ }
+
+ inbits = ((rsize > 0) ? (insize - insize % n_bits) << 3 :
+ (insize << 3) - (n_bits - 1));
+
+ while (inbits > posbits) {
+ if (free_ent > maxcode) {
+ posbits =
+ ((posbits - 1) +
+ ((n_bits << 3) -
+ (posbits - 1 + (n_bits << 3)) % (n_bits << 3)));
+ ++n_bits;
+ if (n_bits == maxbits) {
+ maxcode = maxmaxcode;
+ } else {
+ maxcode = MAXCODE(n_bits) - 1;
+ }
+ bitmask = (1 << n_bits) - 1;
+ goto resetbuf;
+ }
+ {
+ unsigned char *p = &inbuf[posbits >> 3];
+
+ code = ((((long) (p[0])) | ((long) (p[1]) << 8) |
+ ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask;
+ }
+ posbits += n_bits;
+
+
+ if (oldcode == -1) {
+ oldcode = code;
+ finchar = (int) oldcode;
+ outbuf[outpos++] = (unsigned char) finchar;
+ continue;
+ }
+
+ if (code == CLEAR && block_mode) {
+ clear_tab_prefixof();
+ free_ent = FIRST - 1;
+ posbits =
+ ((posbits - 1) +
+ ((n_bits << 3) -
+ (posbits - 1 + (n_bits << 3)) % (n_bits << 3)));