| 366 | | diff -urN linux-2.6.24/init/initramfs.c.orig linux-2.6.24-lzma-initrd/init/initramfs.c.orig |
| 367 | | --- linux-2.6.24/init/initramfs.c.orig 1970-01-01 01:00:00.000000000 +0100 |
| 368 | | +++ linux-2.6.24-lzma-initrd/init/initramfs.c.orig 2008-01-24 23:58:37.000000000 +0100 |
| 369 | | @@ -0,0 +1,585 @@ |
| 370 | | +#include <linux/init.h> |
| 371 | | +#include <linux/fs.h> |
| 372 | | +#include <linux/slab.h> |
| 373 | | +#include <linux/types.h> |
| 374 | | +#include <linux/fcntl.h> |
| 375 | | +#include <linux/delay.h> |
| 376 | | +#include <linux/string.h> |
| 377 | | +#include <linux/syscalls.h> |
| 378 | | + |
| 379 | | +static __initdata char *message; |
| 380 | | +static void __init error(char *x) |
| 381 | | +{ |
| 382 | | + if (!message) |
| 383 | | + message = x; |
| 384 | | +} |
| 385 | | + |
| 386 | | +static void __init *malloc(size_t size) |
| 387 | | +{ |
| 388 | | + return kmalloc(size, GFP_KERNEL); |
| 389 | | +} |
| 390 | | + |
| 391 | | +static void __init free(void *where) |
| 392 | | +{ |
| 393 | | + kfree(where); |
| 394 | | +} |
| 395 | | + |
| 396 | | +/* link hash */ |
| 397 | | + |
| 398 | | +#define N_ALIGN(len) ((((len) + 1) & ~3) + 2) |
| 399 | | + |
| 400 | | +static __initdata struct hash { |
| 401 | | + int ino, minor, major; |
| 402 | | + mode_t mode; |
| 403 | | + struct hash *next; |
| 404 | | + char name[N_ALIGN(PATH_MAX)]; |
| 405 | | +} *head[32]; |
| 406 | | + |
| 407 | | +static inline int hash(int major, int minor, int ino) |
| 408 | | +{ |
| 409 | | + unsigned long tmp = ino + minor + (major << 3); |
| 410 | | + tmp += tmp >> 5; |
| 411 | | + return tmp & 31; |
| 412 | | +} |
| 413 | | + |
| 414 | | +static char __init *find_link(int major, int minor, int ino, |
| 415 | | + mode_t mode, char *name) |
| 416 | | +{ |
| 417 | | + struct hash **p, *q; |
| 418 | | + for (p = head + hash(major, minor, ino); *p; p = &(*p)->next) { |
| 419 | | + if ((*p)->ino != ino) |
| 420 | | + continue; |
| 421 | | + if ((*p)->minor != minor) |
| 422 | | + continue; |
| 423 | | + if ((*p)->major != major) |
| 424 | | + continue; |
| 425 | | + if (((*p)->mode ^ mode) & S_IFMT) |
| 426 | | + continue; |
| 427 | | + return (*p)->name; |
| 428 | | + } |
| 429 | | + q = (struct hash *)malloc(sizeof(struct hash)); |
| 430 | | + if (!q) |
| 431 | | + panic("can't allocate link hash entry"); |
| 432 | | + q->major = major; |
| 433 | | + q->minor = minor; |
| 434 | | + q->ino = ino; |
| 435 | | + q->mode = mode; |
| 436 | | + strcpy(q->name, name); |
| 437 | | + q->next = NULL; |
| 438 | | + *p = q; |
| 439 | | + return NULL; |
| 440 | | +} |
| 441 | | + |
| 442 | | +static void __init free_hash(void) |
| 443 | | +{ |
| 444 | | + struct hash **p, *q; |
| 445 | | + for (p = head; p < head + 32; p++) { |
| 446 | | + while (*p) { |
| 447 | | + q = *p; |
| 448 | | + *p = q->next; |
| 449 | | + free(q); |
| 450 | | + } |
| 451 | | + } |
| 452 | | +} |
| 453 | | + |
| 454 | | +/* cpio header parsing */ |
| 455 | | + |
| 456 | | +static __initdata unsigned long ino, major, minor, nlink; |
| 457 | | +static __initdata mode_t mode; |
| 458 | | +static __initdata unsigned long body_len, name_len; |
| 459 | | +static __initdata uid_t uid; |
| 460 | | +static __initdata gid_t gid; |
| 461 | | +static __initdata unsigned rdev; |
| 462 | | + |
| 463 | | +static void __init parse_header(char *s) |
| 464 | | +{ |
| 465 | | + unsigned long parsed[12]; |
| 466 | | + char buf[9]; |
| 467 | | + int i; |
| 468 | | + |
| 469 | | + buf[8] = '\0'; |
| 470 | | + for (i = 0, s += 6; i < 12; i++, s += 8) { |
| 471 | | + memcpy(buf, s, 8); |
| 472 | | + parsed[i] = simple_strtoul(buf, NULL, 16); |
| 473 | | + } |
| 474 | | + ino = parsed[0]; |
| 475 | | + mode = parsed[1]; |
| 476 | | + uid = parsed[2]; |
| 477 | | + gid = parsed[3]; |
| 478 | | + nlink = parsed[4]; |
| 479 | | + body_len = parsed[6]; |
| 480 | | + major = parsed[7]; |
| 481 | | + minor = parsed[8]; |
| 482 | | + rdev = new_encode_dev(MKDEV(parsed[9], parsed[10])); |
| 483 | | + name_len = parsed[11]; |
| 484 | | +} |
| 485 | | + |
| 486 | | +/* FSM */ |
| 487 | | + |
| 488 | | +static __initdata enum state { |
| 489 | | + Start, |
| 490 | | + Collect, |
| 491 | | + GotHeader, |
| 492 | | + SkipIt, |
| 493 | | + GotName, |
| 494 | | + CopyFile, |
| 495 | | + GotSymlink, |
| 496 | | + Reset |
| 497 | | +} state, next_state; |
| 498 | | + |
| 499 | | +static __initdata char *victim; |
| 500 | | +static __initdata unsigned count; |
| 501 | | +static __initdata loff_t this_header, next_header; |
| 502 | | + |
| 503 | | +static __initdata int dry_run; |
| 504 | | + |
| 505 | | +static inline void __init eat(unsigned n) |
| 506 | | +{ |
| 507 | | + victim += n; |
| 508 | | + this_header += n; |
| 509 | | + count -= n; |
| 510 | | +} |
| 511 | | + |
| 512 | | +static __initdata char *collected; |
| 513 | | +static __initdata int remains; |
| 514 | | +static __initdata char *collect; |
| 515 | | + |
| 516 | | +static void __init read_into(char *buf, unsigned size, enum state next) |
| 517 | | +{ |
| 518 | | + if (count >= size) { |
| 519 | | + collected = victim; |
| 520 | | + eat(size); |
| 521 | | + state = next; |
| 522 | | + } else { |
| 523 | | + collect = collected = buf; |
| 524 | | + remains = size; |
| 525 | | + next_state = next; |
| 526 | | + state = Collect; |
| 527 | | + } |
| 528 | | +} |
| 529 | | + |
| 530 | | +static __initdata char *header_buf, *symlink_buf, *name_buf; |
| 531 | | + |
| 532 | | +static int __init do_start(void) |
| 533 | | +{ |
| 534 | | + read_into(header_buf, 110, GotHeader); |
| 535 | | + return 0; |
| 536 | | +} |
| 537 | | + |
| 538 | | +static int __init do_collect(void) |
| 539 | | +{ |
| 540 | | + unsigned n = remains; |
| 541 | | + if (count < n) |
| 542 | | + n = count; |
| 543 | | + memcpy(collect, victim, n); |
| 544 | | + eat(n); |
| 545 | | + collect += n; |
| 546 | | + if ((remains -= n) != 0) |
| 547 | | + return 1; |
| 548 | | + state = next_state; |
| 549 | | + return 0; |
| 550 | | +} |
| 551 | | + |
| 552 | | +static int __init do_header(void) |
| 553 | | +{ |
| 554 | | + if (memcmp(collected, "070707", 6)==0) { |
| 555 | | + error("incorrect cpio method used: use -H newc option"); |
| 556 | | + return 1; |
| 557 | | + } |
| 558 | | + if (memcmp(collected, "070701", 6)) { |
| 559 | | + error("no cpio magic"); |
| 560 | | + return 1; |
| 561 | | + } |
| 562 | | + parse_header(collected); |
| 563 | | + next_header = this_header + N_ALIGN(name_len) + body_len; |
| 564 | | + next_header = (next_header + 3) & ~3; |
| 565 | | + if (dry_run) { |
| 566 | | + read_into(name_buf, N_ALIGN(name_len), GotName); |
| 567 | | + return 0; |
| 568 | | + } |
| 569 | | + state = SkipIt; |
| 570 | | + if (name_len <= 0 || name_len > PATH_MAX) |
| 571 | | + return 0; |
| 572 | | + if (S_ISLNK(mode)) { |
| 573 | | + if (body_len > PATH_MAX) |
| 574 | | + return 0; |
| 575 | | + collect = collected = symlink_buf; |
| 576 | | + remains = N_ALIGN(name_len) + body_len; |
| 577 | | + next_state = GotSymlink; |
| 578 | | + state = Collect; |
| 579 | | + return 0; |
| 580 | | + } |
| 581 | | + if (S_ISREG(mode) || !body_len) |
| 582 | | + read_into(name_buf, N_ALIGN(name_len), GotName); |
| 583 | | + return 0; |
| 584 | | +} |
| 585 | | + |
| 586 | | +static int __init do_skip(void) |
| 587 | | +{ |
| 588 | | + if (this_header + count < next_header) { |
| 589 | | + eat(count); |
| 590 | | + return 1; |
| 591 | | + } else { |
| 592 | | + eat(next_header - this_header); |
| 593 | | + state = next_state; |
| 594 | | + return 0; |
| 595 | | + } |
| 596 | | +} |
| 597 | | + |
| 598 | | +static int __init do_reset(void) |
| 599 | | +{ |
| 600 | | + while(count && *victim == '\0') |
| 601 | | + eat(1); |
| 602 | | + if (count && (this_header & 3)) |
| 603 | | + error("broken padding"); |
| 604 | | + return 1; |
| 605 | | +} |
| 606 | | + |
| 607 | | +static int __init maybe_link(void) |
| 608 | | +{ |
| 609 | | + if (nlink >= 2) { |
| 610 | | + char *old = find_link(major, minor, ino, mode, collected); |
| 611 | | + if (old) |
| 612 | | + return (sys_link(old, collected) < 0) ? -1 : 1; |
| 613 | | + } |
| 614 | | + return 0; |
| 615 | | +} |
| 616 | | + |
| 617 | | +static void __init clean_path(char *path, mode_t mode) |
| 618 | | +{ |
| 619 | | + struct stat st; |
| 620 | | + |
| 621 | | + if (!sys_newlstat(path, &st) && (st.st_mode^mode) & S_IFMT) { |
| 622 | | + if (S_ISDIR(st.st_mode)) |
| 623 | | + sys_rmdir(path); |
| 624 | | + else |
| 625 | | + sys_unlink(path); |
| 626 | | + } |
| 627 | | +} |
| 628 | | + |
| 629 | | +static __initdata int wfd; |
| 630 | | + |
| 631 | | +static int __init do_name(void) |
| 632 | | +{ |
| 633 | | + state = SkipIt; |
| 634 | | + next_state = Reset; |
| 635 | | + if (strcmp(collected, "TRAILER!!!") == 0) { |
| 636 | | + free_hash(); |
| 637 | | + return 0; |
| 638 | | + } |
| 639 | | + if (dry_run) |
| 640 | | + return 0; |
| 641 | | + clean_path(collected, mode); |
| 642 | | + if (S_ISREG(mode)) { |
| 643 | | + int ml = maybe_link(); |
| 644 | | + if (ml >= 0) { |
| 645 | | + int openflags = O_WRONLY|O_CREAT; |
| 646 | | + if (ml != 1) |
| 647 | | + openflags |= O_TRUNC; |
| 648 | | + wfd = sys_open(collected, openflags, mode); |
| 649 | | + |
| 650 | | + if (wfd >= 0) { |
| 651 | | + sys_fchown(wfd, uid, gid); |
| 652 | | + sys_fchmod(wfd, mode); |
| 653 | | + state = CopyFile; |
| 654 | | + } |
| 655 | | + } |
| 656 | | + } else if (S_ISDIR(mode)) { |
| 657 | | + sys_mkdir(collected, mode); |
| 658 | | + sys_chown(collected, uid, gid); |
| 659 | | + sys_chmod(collected, mode); |
| 660 | | + } else if (S_ISBLK(mode) || S_ISCHR(mode) || |
| 661 | | + S_ISFIFO(mode) || S_ISSOCK(mode)) { |
| 662 | | + if (maybe_link() == 0) { |
| 663 | | + sys_mknod(collected, mode, rdev); |
| 664 | | + sys_chown(collected, uid, gid); |
| 665 | | + sys_chmod(collected, mode); |
| 666 | | + } |
| 667 | | + } |
| 668 | | + return 0; |
| 669 | | +} |
| 670 | | + |
| 671 | | +static int __init do_copy(void) |
| 672 | | +{ |
| 673 | | + if (count >= body_len) { |
| 674 | | + sys_write(wfd, victim, body_len); |
| 675 | | + sys_close(wfd); |
| 676 | | + eat(body_len); |
| 677 | | + state = SkipIt; |
| 678 | | + return 0; |
| 679 | | + } else { |
| 680 | | + sys_write(wfd, victim, count); |
| 681 | | + body_len -= count; |
| 682 | | + eat(count); |
| 683 | | + return 1; |
| 684 | | + } |
| 685 | | +} |
| 686 | | + |
| 687 | | +static int __init do_symlink(void) |
| 688 | | +{ |
| 689 | | + collected[N_ALIGN(name_len) + body_len] = '\0'; |
| 690 | | + clean_path(collected, 0); |
| 691 | | + sys_symlink(collected + N_ALIGN(name_len), collected); |
| 692 | | + sys_lchown(collected, uid, gid); |
| 693 | | + state = SkipIt; |
| 694 | | + next_state = Reset; |
| 695 | | + return 0; |
| 696 | | +} |
| 697 | | + |
| 698 | | +static __initdata int (*actions[])(void) = { |
| 699 | | + [Start] = do_start, |
| 700 | | + [Collect] = do_collect, |
| 701 | | + [GotHeader] = do_header, |
| 702 | | + [SkipIt] = do_skip, |
| 703 | | + [GotName] = do_name, |
| 704 | | + [CopyFile] = do_copy, |
| 705 | | + [GotSymlink] = do_symlink, |
| 706 | | + [Reset] = do_reset, |
| 707 | | +}; |
| 708 | | + |
| 709 | | +static int __init write_buffer(char *buf, unsigned len) |
| 710 | | +{ |
| 711 | | + count = len; |
| 712 | | + victim = buf; |
| 713 | | + |
| 714 | | + while (!actions[state]()) |
| 715 | | + ; |
| 716 | | + return len - count; |
| 717 | | +} |
| 718 | | + |
| 719 | | +static void __init flush_buffer(char *buf, unsigned len) |
| 720 | | +{ |
| 721 | | + int written; |
| 722 | | + if (message) |
| 723 | | + return; |
| 724 | | + while ((written = write_buffer(buf, len)) < len && !message) { |
| 725 | | + char c = buf[written]; |
| 726 | | + if (c == '0') { |
| 727 | | + buf += written; |
| 728 | | + len -= written; |
| 729 | | + state = Start; |
| 730 | | + } else if (c == 0) { |
| 731 | | + buf += written; |
| 732 | | + len -= written; |
| 733 | | + state = Reset; |
| 734 | | + } else |
| 735 | | + error("junk in compressed archive"); |
| 736 | | + } |
| 737 | | +} |
| 738 | | + |
| 739 | | +/* |
| 740 | | + * gzip declarations |
| 741 | | + */ |
| 742 | | + |
| 743 | | +#define OF(args) args |
| 744 | | + |
| 745 | | +#ifndef memzero |
| 746 | | +#define memzero(s, n) memset ((s), 0, (n)) |
| 747 | | +#endif |
| 748 | | + |
| 749 | | +typedef unsigned char uch; |
| 750 | | +typedef unsigned short ush; |
| 751 | | +typedef unsigned long ulg; |
| 752 | | + |
| 753 | | +#define WSIZE 0x8000 /* window size--must be a power of two, and */ |
| 754 | | + /* at least 32K for zip's deflate method */ |
| 755 | | + |
| 756 | | +static uch *inbuf; |
| 757 | | +static uch *window; |
| 758 | | + |
| 759 | | +static unsigned insize; /* valid bytes in inbuf */ |
| 760 | | +static unsigned inptr; /* index of next byte to be processed in inbuf */ |
| 761 | | +static unsigned outcnt; /* bytes in output buffer */ |
| 762 | | +static long bytes_out; |
| 763 | | + |
| 764 | | +#define get_byte() (inptr < insize ? inbuf[inptr++] : -1) |
| 765 | | + |
| 766 | | +/* Diagnostic functions (stubbed out) */ |
| 767 | | +#define Assert(cond,msg) |
| 768 | | +#define Trace(x) |
| 769 | | +#define Tracev(x) |
| 770 | | +#define Tracevv(x) |
| 771 | | +#define Tracec(c,x) |
| 772 | | +#define Tracecv(c,x) |
| 773 | | + |
| 774 | | +#define STATIC static |
| 775 | | +#define INIT __init |
| 776 | | + |
| 777 | | +static void __init flush_window(void); |
| 778 | | +static void __init error(char *m); |
| 779 | | +static void __init gzip_mark(void **); |
| 780 | | +static void __init gzip_release(void **); |
| 781 | | + |
| 782 | | +#include "../lib/inflate.c" |
| 783 | | + |
| 784 | | +static void __init gzip_mark(void **ptr) |
| 785 | | +{ |
| 786 | | +} |
| 787 | | + |
| 788 | | +static void __init gzip_release(void **ptr) |
| 789 | | +{ |
| 790 | | +} |
| 791 | | + |
| 792 | | +/* =========================================================================== |
| 793 | | + * Write the output window window[0..outcnt-1] and update crc and bytes_out. |
| 794 | | + * (Used for the decompressed data only.) |
| 795 | | + */ |
| 796 | | +static void __init flush_window(void) |
| 797 | | +{ |
| 798 | | + ulg c = crc; /* temporary variable */ |
| 799 | | + unsigned n; |
| 800 | | + uch *in, ch; |
| 801 | | + |
| 802 | | + flush_buffer(window, outcnt); |
| 803 | | + in = window; |
| 804 | | + for (n = 0; n < outcnt; n++) { |
| 805 | | + ch = *in++; |
| 806 | | + c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); |
| 807 | | + } |
| 808 | | + crc = c; |
| 809 | | + bytes_out += (ulg)outcnt; |
| 810 | | + outcnt = 0; |
| 811 | | +} |
| 812 | | + |
| 813 | | +static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) |
| 814 | | +{ |
| 815 | | + int written; |
| 816 | | + dry_run = check_only; |
| 817 | | + header_buf = malloc(110); |
| 818 | | + symlink_buf = malloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1); |
| 819 | | + name_buf = malloc(N_ALIGN(PATH_MAX)); |
| 820 | | + window = malloc(WSIZE); |
| 821 | | + if (!window || !header_buf || !symlink_buf || !name_buf) |
| 822 | | + panic("can't allocate buffers"); |
| 823 | | + state = Start; |
| 824 | | + this_header = 0; |
| 825 | | + message = NULL; |
| 826 | | + while (!message && len) { |
| 827 | | + loff_t saved_offset = this_header; |
| 828 | | + if (*buf == '0' && !(this_header & 3)) { |
| 829 | | + state = Start; |
| 830 | | + written = write_buffer(buf, len); |
| 831 | | + buf += written; |
| 832 | | + len -= written; |
| 833 | | + continue; |
| 834 | | + } |
| 835 | | + if (!*buf) { |
| 836 | | + buf++; |
| 837 | | + len--; |
| 838 | | + this_header++; |
| 839 | | + continue; |
| 840 | | + } |
| 841 | | + this_header = 0; |
| 842 | | + insize = len; |
| 843 | | + inbuf = buf; |
| 844 | | + inptr = 0; |
| 845 | | + outcnt = 0; /* bytes in output buffer */ |
| 846 | | + bytes_out = 0; |
| 847 | | + crc = (ulg)0xffffffffL; /* shift register contents */ |
| 848 | | + makecrc(); |
| 849 | | + gunzip(); |
| 850 | | + if (state != Reset) |
| 851 | | + error("junk in gzipped archive"); |
| 852 | | + this_header = saved_offset + inptr; |
| 853 | | + buf += inptr; |
| 854 | | + len -= inptr; |
| 855 | | + } |
| 856 | | + free(window); |
| 857 | | + free(name_buf); |
| 858 | | + free(symlink_buf); |
| 859 | | + free(header_buf); |
| 860 | | + return message; |
| 861 | | +} |
| 862 | | + |
| 863 | | +static int __initdata do_retain_initrd; |
| 864 | | + |
| 865 | | +static int __init retain_initrd_param(char *str) |
| 866 | | +{ |
| 867 | | + if (*str) |
| 868 | | + return 0; |
| 869 | | + do_retain_initrd = 1; |
| 870 | | + return 1; |
| 871 | | +} |
| 872 | | +__setup("retain_initrd", retain_initrd_param); |
| 873 | | + |
| 874 | | +extern char __initramfs_start[], __initramfs_end[]; |
| 875 | | +#ifdef CONFIG_BLK_DEV_INITRD |
| 876 | | +#include <linux/initrd.h> |
| 877 | | +#include <linux/kexec.h> |
| 878 | | + |
| 879 | | +static void __init free_initrd(void) |
| 880 | | +{ |
| 881 | | +#ifdef CONFIG_KEXEC |
| 882 | | + unsigned long crashk_start = (unsigned long)__va(crashk_res.start); |
| 883 | | + unsigned long crashk_end = (unsigned long)__va(crashk_res.end); |
| 884 | | +#endif |
| 885 | | + if (do_retain_initrd) |
| 886 | | + goto skip; |
| 887 | | + |
| 888 | | +#ifdef CONFIG_KEXEC |
| 889 | | + /* |
| 890 | | + * If the initrd region is overlapped with crashkernel reserved region, |
| 891 | | + * free only memory that is not part of crashkernel region. |
| 892 | | + */ |
| 893 | | + if (initrd_start < crashk_end && initrd_end > crashk_start) { |
| 894 | | + /* |
| 895 | | + * Initialize initrd memory region since the kexec boot does |
| 896 | | + * not do. |
| 897 | | + */ |
| 898 | | + memset((void *)initrd_start, 0, initrd_end - initrd_start); |
| 899 | | + if (initrd_start < crashk_start) |
| 900 | | + free_initrd_mem(initrd_start, crashk_start); |
| 901 | | + if (initrd_end > crashk_end) |
| 902 | | + free_initrd_mem(crashk_end, initrd_end); |
| 903 | | + } else |
| 904 | | +#endif |
| 905 | | + free_initrd_mem(initrd_start, initrd_end); |
| 906 | | +skip: |
| 907 | | + initrd_start = 0; |
| 908 | | + initrd_end = 0; |
| 909 | | +} |
| 910 | | + |
| 911 | | +#endif |
| 912 | | + |
| 913 | | +static int __init populate_rootfs(void) |
| 914 | | +{ |
| 915 | | + char *err = unpack_to_rootfs(__initramfs_start, |
| 916 | | + __initramfs_end - __initramfs_start, 0); |
| 917 | | + if (err) |
| 918 | | + panic(err); |
| 919 | | +#ifdef CONFIG_BLK_DEV_INITRD |
| 920 | | + if (initrd_start) { |
| 921 | | +#ifdef CONFIG_BLK_DEV_RAM |
| 922 | | + int fd; |
| 923 | | + printk(KERN_INFO "checking if image is initramfs..."); |
| 924 | | + err = unpack_to_rootfs((char *)initrd_start, |
| 925 | | + initrd_end - initrd_start, 1); |
| 926 | | + if (!err) { |
| 927 | | + printk(" it is\n"); |
| 928 | | + unpack_to_rootfs((char *)initrd_start, |
| 929 | | + initrd_end - initrd_start, 0); |
| 930 | | + free_initrd(); |
| 931 | | + return 0; |
| 932 | | + } |
| 933 | | + printk("it isn't (%s); looks like an initrd\n", err); |
| 934 | | + fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); |
| 935 | | + if (fd >= 0) { |
| 936 | | + sys_write(fd, (char *)initrd_start, |
| 937 | | + initrd_end - initrd_start); |
| 938 | | + sys_close(fd); |
| 939 | | + free_initrd(); |
| 940 | | + } |
| 941 | | +#else |
| 942 | | + printk(KERN_INFO "Unpacking initramfs..."); |
| 943 | | + err = unpack_to_rootfs((char *)initrd_start, |
| 944 | | + initrd_end - initrd_start, 0); |
| 945 | | + if (err) |
| 946 | | + panic(err); |
| 947 | | + printk(" done\n"); |
| 948 | | + free_initrd(); |
| 949 | | +#endif |
| 950 | | + } |
| 951 | | +#endif |
| 952 | | + return 0; |
| 953 | | +} |
| 954 | | +rootfs_initcall(populate_rootfs); |
| 1006 | | diff -urN linux-2.6.24/init/Kconfig.orig linux-2.6.24-lzma-initrd/init/Kconfig.orig |
| 1007 | | --- linux-2.6.24/init/Kconfig.orig 1970-01-01 01:00:00.000000000 +0100 |
| 1008 | | +++ linux-2.6.24-lzma-initrd/init/Kconfig.orig 2008-01-24 23:58:37.000000000 +0100 |
| 1009 | | @@ -0,0 +1,764 @@ |
| 1010 | | +config DEFCONFIG_LIST |
| 1011 | | + string |
| 1012 | | + depends on !UML |
| 1013 | | + option defconfig_list |
| 1014 | | + default "/lib/modules/$UNAME_RELEASE/.config" |
| 1015 | | + default "/etc/kernel-config" |
| 1016 | | + default "/boot/config-$UNAME_RELEASE" |
| 1017 | | + default "arch/$ARCH/defconfig" |
| 1018 | | + |
| 1019 | | +menu "General setup" |
| 1020 | | + |
| 1021 | | +config EXPERIMENTAL |
| 1022 | | + bool "Prompt for development and/or incomplete code/drivers" |
| 1023 | | + ---help--- |
| 1024 | | + Some of the various things that Linux supports (such as network |
| 1025 | | + drivers, file systems, network protocols, etc.) can be in a state |
| 1026 | | + of development where the functionality, stability, or the level of |
| 1027 | | + testing is not yet high enough for general use. This is usually |
| 1028 | | + known as the "alpha-test" phase among developers. If a feature is |
| 1029 | | + currently in alpha-test, then the developers usually discourage |
| 1030 | | + uninformed widespread use of this feature by the general public to |
| 1031 | | + avoid "Why doesn't this work?" type mail messages. However, active |
| 1032 | | + testing and use of these systems is welcomed. Just be aware that it |
| 1033 | | + may not meet the normal level of reliability or it may fail to work |
| 1034 | | + in some special cases. Detailed bug reports from people familiar |
| 1035 | | + with the kernel internals are usually welcomed by the developers |
| 1036 | | + (before submitting bug reports, please read the documents |
| 1037 | | + <file:README>, <file:MAINTAINERS>, <file:REPORTING-BUGS>, |
| 1038 | | + <file:Documentation/BUG-HUNTING>, and |
| 1039 | | + <file:Documentation/oops-tracing.txt> in the kernel source). |
| 1040 | | + |
| 1041 | | + This option will also make obsoleted drivers available. These are |
| 1042 | | + drivers that have been replaced by something else, and/or are |
| 1043 | | + scheduled to be removed in a future kernel release. |
| 1044 | | + |
| 1045 | | + Unless you intend to help test and develop a feature or driver that |
| 1046 | | + falls into this category, or you have a situation that requires |
| 1047 | | + using these features, you should probably say N here, which will |
| 1048 | | + cause the configurator to present you with fewer choices. If |
| 1049 | | + you say Y here, you will be offered the choice of using features or |
| 1050 | | + drivers that are currently considered to be in the alpha-test phase. |
| 1051 | | + |
| 1052 | | +config BROKEN |
| 1053 | | + bool |
| 1054 | | + |
| 1055 | | +config BROKEN_ON_SMP |
| 1056 | | + bool |
| 1057 | | + depends on BROKEN || !SMP |
| 1058 | | + default y |
| 1059 | | + |
| 1060 | | +config LOCK_KERNEL |
| 1061 | | + bool |
| 1062 | | + depends on SMP || PREEMPT |
| 1063 | | + default y |
| 1064 | | + |
| 1065 | | +config INIT_ENV_ARG_LIMIT |
| 1066 | | + int |
| 1067 | | + default 32 if !UML |
| 1068 | | + default 128 if UML |
| 1069 | | + help |
| 1070 | | + Maximum of each of the number of arguments and environment |
| 1071 | | + variables passed to init from the kernel command line. |
| 1072 | | + |
| 1073 | | + |
| 1074 | | +config LOCALVERSION |
| 1075 | | + string "Local version - append to kernel release" |
| 1076 | | + help |
| 1077 | | + Append an extra string to the end of your kernel version. |
| 1078 | | + This will show up when you type uname, for example. |
| 1079 | | + The string you set here will be appended after the contents of |
| 1080 | | + any files with a filename matching localversion* in your |
| 1081 | | + object and source tree, in that order. Your total string can |
| 1082 | | + be a maximum of 64 characters. |
| 1083 | | + |
| 1084 | | +config LOCALVERSION_AUTO |
| 1085 | | + bool "Automatically append version information to the version string" |
| 1086 | | + default y |
| 1087 | | + help |
| 1088 | | + This will try to automatically determine if the current tree is a |
| 1089 | | + release tree by looking for git tags that belong to the current |
| 1090 | | + top of tree revision. |
| 1091 | | + |
| 1092 | | + A string of the format -gxxxxxxxx will be added to the localversion |
| 1093 | | + if a git-based tree is found. The string generated by this will be |
| 1094 | | + appended after any matching localversion* files, and after the value |
| 1095 | | + set in CONFIG_LOCALVERSION. |
| 1096 | | + |
| 1097 | | + (The actual string used here is the first eight characters produced |
| 1098 | | + by running the command: |
| 1099 | | + |
| 1100 | | + $ git rev-parse --verify HEAD |
| 1101 | | + |
| 1102 | | + which is done within the script "scripts/setlocalversion".) |
| 1103 | | + |
| 1104 | | +config SWAP |
| 1105 | | + bool "Support for paging of anonymous memory (swap)" |
| 1106 | | + depends on MMU && BLOCK |
| 1107 | | + default y |
| 1108 | | + help |
| 1109 | | + This option allows you to choose whether you want to have support |
| 1110 | | + for so called swap devices or swap files in your kernel that are |
| 1111 | | + used to provide more virtual memory than the actual RAM present |
| 1112 | | + in your computer. If unsure say Y. |
| 1113 | | + |
| 1114 | | +config SYSVIPC |
| 1115 | | + bool "System V IPC" |
| 1116 | | + ---help--- |
| 1117 | | + Inter Process Communication is a suite of library functions and |
| 1118 | | + system calls which let processes (running programs) synchronize and |
| 1119 | | + exchange information. It is generally considered to be a good thing, |
| 1120 | | + and some programs won't run unless you say Y here. In particular, if |
| 1121 | | + you want to run the DOS emulator dosemu under Linux (read the |
| 1122 | | + DOSEMU-HOWTO, available from <http://www.tldp.org/docs.html#howto>), |
| 1123 | | + you'll need to say Y here. |
| 1124 | | + |
| 1125 | | + You can find documentation about IPC with "info ipc" and also in |
| 1126 | | + section 6.4 of the Linux Programmer's Guide, available from |
| 1127 | | + <http://www.tldp.org/guides.html>. |
| 1128 | | + |
| 1129 | | +config SYSVIPC_SYSCTL |
| 1130 | | + bool |
| 1131 | | + depends on SYSVIPC |
| 1132 | | + depends on SYSCTL |
| 1133 | | + default y |
| 1134 | | + |
| 1135 | | +config POSIX_MQUEUE |
| 1136 | | + bool "POSIX Message Queues" |
| 1137 | | + depends on NET && EXPERIMENTAL |
| 1138 | | + ---help--- |
| 1139 | | + POSIX variant of message queues is a part of IPC. In POSIX message |
| 1140 | | + queues every message has a priority which decides about succession |
| 1141 | | + of receiving it by a process. If you want to compile and run |
| 1142 | | + programs written e.g. for Solaris with use of its POSIX message |
| 1143 | | + queues (functions mq_*) say Y here. |
| 1144 | | + |
| 1145 | | + POSIX message queues are visible as a filesystem called 'mqueue' |
| 1146 | | + and can be mounted somewhere if you want to do filesystem |
| 1147 | | + operations on message queues. |
| 1148 | | + |
| 1149 | | + If unsure, say Y. |
| 1150 | | + |
| 1151 | | +config BSD_PROCESS_ACCT |
| 1152 | | + bool "BSD Process Accounting" |
| 1153 | | + help |
| 1154 | | + If you say Y here, a user level program will be able to instruct the |
| 1155 | | + kernel (via a special system call) to write process accounting |
| 1156 | | + information to a file: whenever a process exits, information about |
| 1157 | | + that process will be appended to the file by the kernel. The |
| 1158 | | + information includes things such as creation time, owning user, |
| 1159 | | + command name, memory usage, controlling terminal etc. (the complete |
| 1160 | | + list is in the struct acct in <file:include/linux/acct.h>). It is |
| 1161 | | + up to the user level program to do useful things with this |
| 1162 | | + information. This is generally a good idea, so say Y. |
| 1163 | | + |
| 1164 | | +config BSD_PROCESS_ACCT_V3 |
| 1165 | | + bool "BSD Process Accounting version 3 file format" |
| 1166 | | + depends on BSD_PROCESS_ACCT |
| 1167 | | + default n |
| 1168 | | + help |
| 1169 | | + If you say Y here, the process accounting information is written |
| 1170 | | + in a new file format that also logs the process IDs of each |
| 1171 | | + process and it's parent. Note that this file format is incompatible |
| 1172 | | + with previous v0/v1/v2 file formats, so you will need updated tools |
| 1173 | | + for processing it. A preliminary version of these tools is available |
| 1174 | | + at <http://www.physik3.uni-rostock.de/tim/kernel/utils/acct/>. |
| 1175 | | + |
| 1176 | | +config TASKSTATS |
| 1177 | | + bool "Export task/process statistics through netlink (EXPERIMENTAL)" |
| 1178 | | + depends on NET |
| 1179 | | + default n |
| 1180 | | + help |
| 1181 | | + Export selected statistics for tasks/processes through the |
| 1182 | | + generic netlink interface. Unlike BSD process accounting, the |
| 1183 | | + statistics are available during the lifetime of tasks/processes as |
| 1184 | | + responses to commands. Like BSD accounting, they are sent to user |
| 1185 | | + space on task exit. |
| 1186 | | + |
| 1187 | | + Say N if unsure. |
| 1188 | | + |
| 1189 | | +config TASK_DELAY_ACCT |
| 1190 | | + bool "Enable per-task delay accounting (EXPERIMENTAL)" |
| 1191 | | + depends on TASKSTATS |
| 1192 | | + help |
| 1193 | | + Collect information on time spent by a task waiting for system |
| 1194 | | + resources like cpu, synchronous block I/O completion and swapping |
| 1195 | | + in pages. Such statistics can help in setting a task's priorities |
| 1196 | | + relative to other tasks for cpu, io, rss limits etc. |
| 1197 | | + |
| 1198 | | + Say N if unsure. |
| 1199 | | + |
| 1200 | | +config TASK_XACCT |
| 1201 | | + bool "Enable extended accounting over taskstats (EXPERIMENTAL)" |
| 1202 | | + depends on TASKSTATS |
| 1203 | | + help |
| 1204 | | + Collect extended task accounting data and send the data |
| 1205 | | + to userland for processing over the taskstats interface. |
| 1206 | | + |
| 1207 | | + Say N if unsure. |
| 1208 | | + |
| 1209 | | +config TASK_IO_ACCOUNTING |
| 1210 | | + bool "Enable per-task storage I/O accounting (EXPERIMENTAL)" |
| 1211 | | + depends on TASK_XACCT |
| 1212 | | + help |
| 1213 | | + Collect information on the number of bytes of storage I/O which this |
| 1214 | | + task has caused. |
| 1215 | | + |
| 1216 | | + Say N if unsure. |
| 1217 | | + |
| 1218 | | +config USER_NS |
| 1219 | | + bool "User Namespaces (EXPERIMENTAL)" |
| 1220 | | + default n |
| 1221 | | + depends on EXPERIMENTAL |
| 1222 | | + help |
| 1223 | | + Support user namespaces. This allows containers, i.e. |
| 1224 | | + vservers, to use user namespaces to provide different |
| 1225 | | + user info for different servers. If unsure, say N. |
| 1226 | | + |
| 1227 | | +config PID_NS |
| 1228 | | + bool "PID Namespaces (EXPERIMENTAL)" |
| 1229 | | + default n |
| 1230 | | + depends on EXPERIMENTAL |
| 1231 | | + help |
| 1232 | | + Suport process id namespaces. This allows having multiple |
| 1233 | | + process with the same pid as long as they are in different |
| 1234 | | + pid namespaces. This is a building block of containers. |
| 1235 | | + |
| 1236 | | + Unless you want to work with an experimental feature |
| 1237 | | + say N here. |
| 1238 | | + |
| 1239 | | +config AUDIT |
| 1240 | | + bool "Auditing support" |
| 1241 | | + depends on NET |
| 1242 | | + help |
| 1243 | | + Enable auditing infrastructure that can be used with another |
| 1244 | | + kernel subsystem, such as SELinux (which requires this for |
| 1245 | | + logging of avc messages output). Does not do system-call |
| 1246 | | + auditing without CONFIG_AUDITSYSCALL. |
| 1247 | | + |
| 1248 | | +config AUDITSYSCALL |
| 1249 | | + bool "Enable system-call auditing support" |
| 1250 | | + depends on AUDIT && (X86 || PPC || PPC64 || S390 || IA64 || UML || SPARC64) |
| 1251 | | + default y if SECURITY_SELINUX |
| 1252 | | + help |
| 1253 | | + Enable low-overhead system-call auditing infrastructure that |
| 1254 | | + can be used independently or with another kernel subsystem, |
| 1255 | | + such as SELinux. To use audit's filesystem watch feature, please |
| 1256 | | + ensure that INOTIFY is configured. |
| 1257 | | + |
| 1258 | | +config AUDIT_TREE |
| 1259 | | + def_bool y |
| 1260 | | + depends on AUDITSYSCALL && INOTIFY |
| 1261 | | + |
| 1262 | | +config IKCONFIG |
| 1263 | | + tristate "Kernel .config support" |
| 1264 | | + ---help--- |
| 1265 | | + This option enables the complete Linux kernel ".config" file |
| 1266 | | + contents to be saved in the kernel. It provides documentation |
| 1267 | | + of which kernel options are used in a running kernel or in an |
| 1268 | | + on-disk kernel. This information can be extracted from the kernel |
| 1269 | | + image file with the script scripts/extract-ikconfig and used as |
| 1270 | | + input to rebuild the current kernel or to build another kernel. |
| 1271 | | + It can also be extracted from a running kernel by reading |
| 1272 | | + /proc/config.gz if enabled (below). |
| 1273 | | + |
| 1274 | | +config IKCONFIG_PROC |
| 1275 | | + bool "Enable access to .config through /proc/config.gz" |
| 1276 | | + depends on IKCONFIG && PROC_FS |
| 1277 | | + ---help--- |
| 1278 | | + This option enables access to the kernel configuration file |
| 1279 | | + through /proc/config.gz. |
| 1280 | | + |
| 1281 | | +config LOG_BUF_SHIFT |
| 1282 | | + int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" |
| 1283 | | + range 12 21 |
| 1284 | | + default 17 if S390 || LOCKDEP |
| 1285 | | + default 16 if X86_NUMAQ || IA64 |
| 1286 | | + default 15 if SMP |
| 1287 | | + default 14 |
| 1288 | | + help |
| 1289 | | + Select kernel log buffer size as a power of 2. |
| 1290 | | + Defaults and Examples: |
| 1291 | | + 17 => 128 KB for S/390 |
| 1292 | | + 16 => 64 KB for x86 NUMAQ or IA-64 |
| 1293 | | + 15 => 32 KB for SMP |
| 1294 | | + 14 => 16 KB for uniprocessor |
| 1295 | | + 13 => 8 KB |
| 1296 | | + 12 => 4 KB |
| 1297 | | + |
| 1298 | | +config CGROUPS |
| 1299 | | + bool "Control Group support" |
| 1300 | | + help |
| 1301 | | + This option will let you use process cgroup subsystems |
| 1302 | | + such as Cpusets |
| 1303 | | + |
| 1304 | | + Say N if unsure. |
| 1305 | | + |
| 1306 | | +config CGROUP_DEBUG |
| 1307 | | + bool "Example debug cgroup subsystem" |
| 1308 | | + depends on CGROUPS |
| 1309 | | + help |
| 1310 | | + This option enables a simple cgroup subsystem that |
| 1311 | | + exports useful debugging information about the cgroups |
| 1312 | | + framework |
| 1313 | | + |
| 1314 | | + Say N if unsure |
| 1315 | | + |
| 1316 | | +config CGROUP_NS |
| 1317 | | + bool "Namespace cgroup subsystem" |
| 1318 | | + depends on CGROUPS |
| 1319 | | + help |
| 1320 | | + Provides a simple namespace cgroup subsystem to |
| 1321 | | + provide hierarchical naming of sets of namespaces, |
| 1322 | | + for instance virtual servers and checkpoint/restart |
| 1323 | | + jobs. |
| 1324 | | + |
| 1325 | | +config CPUSETS |
| 1326 | | + bool "Cpuset support" |
| 1327 | | + depends on SMP && CGROUPS |
| 1328 | | + help |
| 1329 | | + This option will let you create and manage CPUSETs which |
| 1330 | | + allow dynamically partitioning a system into sets of CPUs and |
| 1331 | | + Memory Nodes and assigning tasks to run only within those sets. |
| 1332 | | + This is primarily useful on large SMP or NUMA systems. |
| 1333 | | + |
| 1334 | | + Say N if unsure. |
| 1335 | | + |
| 1336 | | +config FAIR_GROUP_SCHED |
| 1337 | | + bool "Fair group CPU scheduler" |
| 1338 | | + default y |
| 1339 | | + help |
| 1340 | | + This feature lets CPU scheduler recognize task groups and control CPU |
| 1341 | | + bandwidth allocation to such task groups. |
| 1342 | | + |
| 1343 | | +choice |
| 1344 | | + depends on FAIR_GROUP_SCHED |
| 1345 | | + prompt "Basis for grouping tasks" |
| 1346 | | + default FAIR_USER_SCHED |
| 1347 | | + |
| 1348 | | +config FAIR_USER_SCHED |
| 1349 | | + bool "user id" |
| 1350 | | + help |
| 1351 | | + This option will choose userid as the basis for grouping |
| 1352 | | + tasks, thus providing equal CPU bandwidth to each user. |
| 1353 | | + |
| 1354 | | +config FAIR_CGROUP_SCHED |
| 1355 | | + bool "Control groups" |
| 1356 | | + depends on CGROUPS |
| 1357 | | + help |
| 1358 | | + This option allows you to create arbitrary task groups |
| 1359 | | + using the "cgroup" pseudo filesystem and control |
| 1360 | | + the cpu bandwidth allocated to each such task group. |
| 1361 | | + Refer to Documentation/cgroups.txt for more information |
| 1362 | | + on "cgroup" pseudo filesystem. |
| 1363 | | + |
| 1364 | | +endchoice |
| 1365 | | + |
| 1366 | | +config CGROUP_CPUACCT |
| 1367 | | + bool "Simple CPU accounting cgroup subsystem" |
| 1368 | | + depends on CGROUPS |
| 1369 | | + help |
| 1370 | | + Provides a simple Resource Controller for monitoring the |
| 1371 | | + total CPU consumed by the tasks in a cgroup |
| 1372 | | + |
| 1373 | | +config SYSFS_DEPRECATED |
| 1374 | | + bool "Create deprecated sysfs files" |
| 1375 | | + default y |
| 1376 | | + help |
| 1377 | | + This option creates deprecated symlinks such as the |
| 1378 | | + "device"-link, the <subsystem>:<name>-link, and the |
| 1379 | | + "bus"-link. It may also add deprecated key in the |
| 1380 | | + uevent environment. |
| 1381 | | + None of these features or values should be used today, as |
| 1382 | | + they export driver core implementation details to userspace |
| 1383 | | + or export properties which can't be kept stable across kernel |
| 1384 | | + releases. |
| 1385 | | + |
| 1386 | | + If enabled, this option will also move any device structures |
| 1387 | | + that belong to a class, back into the /sys/class hierarchy, in |
| 1388 | | + order to support older versions of udev. |
| 1389 | | + |
| 1390 | | + If you are using a distro that was released in 2006 or later, |
| 1391 | | + it should be safe to say N here. |
| 1392 | | + |
| 1393 | | +config PROC_PID_CPUSET |
| 1394 | | + bool "Include legacy /proc/<pid>/cpuset file" |
| 1395 | | + depends on CPUSETS |
| 1396 | | + default y |
| 1397 | | + |
| 1398 | | +config RELAY |
| 1399 | | + bool "Kernel->user space relay support (formerly relayfs)" |
| 1400 | | + help |
| 1401 | | + This option enables support for relay interface support in |
| 1402 | | + certain file systems (such as debugfs). |
| 1403 | | + It is designed to provide an efficient mechanism for tools and |
| 1404 | | + facilities to relay large amounts of data from kernel space to |
| 1405 | | + user space. |
| 1406 | | + |
| 1407 | | + If unsure, say N. |
| 1408 | | + |
| 1409 | | +config BLK_DEV_INITRD |
| 1410 | | + bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" |
| 1411 | | + depends on BROKEN || !FRV |
| 1412 | | + help |
| 1413 | | + The initial RAM filesystem is a ramfs which is loaded by the |
| 1414 | | + boot loader (loadlin or lilo) and that is mounted as root |
| 1415 | | + before the normal boot procedure. It is typically used to |
| 1416 | | + load modules needed to mount the "real" root file system, |
| 1417 | | + etc. See <file:Documentation/initrd.txt> for details. |
| 1418 | | + |
| 1419 | | + If RAM disk support (BLK_DEV_RAM) is also included, this |
| 1420 | | + also enables initial RAM disk (initrd) support and adds |
| 1421 | | + 15 Kbytes (more on some other architectures) to the kernel size. |
| 1422 | | + |
| 1423 | | + If unsure say Y. |
| 1424 | | + |
| 1425 | | +if BLK_DEV_INITRD |
| 1426 | | + |
| 1427 | | +source "usr/Kconfig" |
| 1428 | | + |
| 1429 | | +endif |
| 1430 | | + |
| 1431 | | +config CC_OPTIMIZE_FOR_SIZE |
| 1432 | | + bool "Optimize for size (Look out for broken compilers!)" |
| 1433 | | + default y |
| 1434 | | + depends on ARM || H8300 || SUPERH || EXPERIMENTAL |
| 1435 | | + help |
| 1436 | | + Enabling this option will pass "-Os" instead of "-O2" to gcc |
| 1437 | | + resulting in a smaller kernel. |
| 1438 | | + |
| 1439 | | + WARNING: some versions of gcc may generate incorrect code with this |
| 1440 | | + option. If problems are observed, a gcc upgrade may be needed. |
| 1441 | | + |
| 1442 | | + If unsure, say N. |
| 1443 | | + |
| 1444 | | +config SYSCTL |
| 1445 | | + bool |
| 1446 | | + |
| 1447 | | +menuconfig EMBEDDED |
| 1448 | | + bool "Configure standard kernel features (for small systems)" |
| 1449 | | + help |
| 1450 | | + This option allows certain base kernel options and settings |
| 1451 | | + to be disabled or tweaked. This is for specialized |
| 1452 | | + environments which can tolerate a "non-standard" kernel. |
| 1453 | | + Only use this if you really know what you are doing. |
| 1454 | | + |
| 1455 | | +config UID16 |
| 1456 | | + bool "Enable 16-bit UID system calls" if EMBEDDED |
| 1457 | | + depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && SPARC32_COMPAT) || UML || (X86_64 && IA32_EMULATION) |
| 1458 | | + default y |
| 1459 | | + help |
| 1460 | | + This enables the legacy 16-bit UID syscall wrappers. |
| 1461 | | + |
| 1462 | | +config SYSCTL_SYSCALL |
| 1463 | | + bool "Sysctl syscall support" if EMBEDDED |
| 1464 | | + default y |
| 1465 | | + select SYSCTL |
| 1466 | | + ---help--- |
| 1467 | | + sys_sysctl uses binary paths that have been found challenging |
| 1468 | | + to properly maintain and use. The interface in /proc/sys |
| 1469 | | + using paths with ascii names is now the primary path to this |
| 1470 | | + information. |
| 1471 | | + |
| 1472 | | + Almost nothing using the binary sysctl interface so if you are |
| 1473 | | + trying to save some space it is probably safe to disable this, |
| 1474 | | + making your kernel marginally smaller. |
| 1475 | | + |
| 1476 | | + If unsure say Y here. |
| 1477 | | + |
| 1478 | | +config KALLSYMS |
| 1479 | | + bool "Load all symbols for debugging/ksymoops" if EMBEDDED |
| 1480 | | + default y |
| 1481 | | + help |
| 1482 | | + Say Y here to let the kernel print out symbolic crash information and |
| 1483 | | + symbolic stack backtraces. This increases the size of the kernel |
| 1484 | | + somewhat, as all symbols have to be loaded into the kernel image. |
| 1485 | | + |
| 1486 | | +config KALLSYMS_ALL |
| 1487 | | + bool "Include all symbols in kallsyms" |
| 1488 | | + depends on DEBUG_KERNEL && KALLSYMS |
| 1489 | | + help |
| 1490 | | + Normally kallsyms only contains the symbols of functions, for nicer |
| 1491 | | + OOPS messages. Some debuggers can use kallsyms for other |
| 1492 | | + symbols too: say Y here to include all symbols, if you need them |
| 1493 | | + and you don't care about adding 300k to the size of your kernel. |
| 1494 | | + |
| 1495 | | + Say N. |
| 1496 | | + |
| 1497 | | +config KALLSYMS_EXTRA_PASS |
| 1498 | | + bool "Do an extra kallsyms pass" |
| 1499 | | + depends on KALLSYMS |
| 1500 | | + help |
| 1501 | | + If kallsyms is not working correctly, the build will fail with |
| 1502 | | + inconsistent kallsyms data. If that occurs, log a bug report and |
| 1503 | | + turn on KALLSYMS_EXTRA_PASS which should result in a stable build. |
| 1504 | | + Always say N here unless you find a bug in kallsyms, which must be |
| 1505 | | + reported. KALLSYMS_EXTRA_PASS is only a temporary workaround while |
| 1506 | | + you wait for kallsyms to be fixed. |
| 1507 | | + |
| 1508 | | + |
| 1509 | | +config HOTPLUG |
| 1510 | | + bool "Support for hot-pluggable devices" if EMBEDDED |
| 1511 | | + default y |
| 1512 | | + help |
| 1513 | | + This option is provided for the case where no hotplug or uevent |
| 1514 | | + capabilities is wanted by the kernel. You should only consider |
| 1515 | | + disabling this option for embedded systems that do not use modules, a |
| 1516 | | + dynamic /dev tree, or dynamic device discovery. Just say Y. |
| 1517 | | + |
| 1518 | | +config PRINTK |
| 1519 | | + default y |
| 1520 | | + bool "Enable support for printk" if EMBEDDED |
| 1521 | | + help |
| 1522 | | + This option enables normal printk support. Removing it |
| 1523 | | + eliminates most of the message strings from the kernel image |
| 1524 | | + and makes the kernel more or less silent. As this makes it |
| 1525 | | + very difficult to diagnose system problems, saying N here is |
| 1526 | | + strongly discouraged. |
| 1527 | | + |
| 1528 | | +config BUG |
| 1529 | | + bool "BUG() support" if EMBEDDED |
| 1530 | | + default y |
| 1531 | | + help |
| 1532 | | + Disabling this option eliminates support for BUG and WARN, reducing |
| 1533 | | + the size of your kernel image and potentially quietly ignoring |
| 1534 | | + numerous fatal conditions. You should only consider disabling this |
| 1535 | | + option for embedded systems with no facilities for reporting errors. |
| 1536 | | + Just say Y. |
| 1537 | | + |
| 1538 | | +config ELF_CORE |
| 1539 | | + default y |
| 1540 | | + bool "Enable ELF core dumps" if EMBEDDED |
| 1541 | | + help |
| 1542 | | + Enable support for generating core dumps. Disabling saves about 4k. |
| 1543 | | + |
| 1544 | | +config BASE_FULL |
| 1545 | | + default y |
| 1546 | | + bool "Enable full-sized data structures for core" if EMBEDDED |
| 1547 | | + help |
| 1548 | | + Disabling this option reduces the size of miscellaneous core |
| 1549 | | + kernel data structures. This saves memory on small machines, |
| 1550 | | + but may reduce performance. |
| 1551 | | + |
| 1552 | | +config FUTEX |
| 1553 | | + bool "Enable futex support" if EMBEDDED |
| 1554 | | + default y |
| 1555 | | + select RT_MUTEXES |
| 1556 | | + help |
| 1557 | | + Disabling this option will cause the kernel to be built without |
| 1558 | | + support for "fast userspace mutexes". The resulting kernel may not |
| 1559 | | + run glibc-based applications correctly. |
| 1560 | | + |
| 1561 | | +config ANON_INODES |
| 1562 | | + bool |
| 1563 | | + |
| 1564 | | +config EPOLL |
| 1565 | | + bool "Enable eventpoll support" if EMBEDDED |
| 1566 | | + default y |
| 1567 | | + select ANON_INODES |
| 1568 | | + help |
| 1569 | | + Disabling this option will cause the kernel to be built without |
| 1570 | | + support for epoll family of system calls. |
| 1571 | | + |
| 1572 | | +config SIGNALFD |
| 1573 | | + bool "Enable signalfd() system call" if EMBEDDED |
| 1574 | | + select ANON_INODES |
| 1575 | | + default y |
| 1576 | | + help |
| 1577 | | + Enable the signalfd() system call that allows to receive signals |
| 1578 | | + on a file descriptor. |
| 1579 | | + |
| 1580 | | + If unsure, say Y. |
| 1581 | | + |
| 1582 | | +config TIMERFD |
| 1583 | | + bool "Enable timerfd() system call" if EMBEDDED |
| 1584 | | + select ANON_INODES |
| 1585 | | + depends on BROKEN |
| 1586 | | + default y |
| 1587 | | + help |
| 1588 | | + Enable the timerfd() system call that allows to receive timer |
| 1589 | | + events on a file descriptor. |
| 1590 | | + |
| 1591 | | + If unsure, say Y. |
| 1592 | | + |
| 1593 | | +config EVENTFD |
| 1594 | | + bool "Enable eventfd() system call" if EMBEDDED |
| 1595 | | + select ANON_INODES |
| 1596 | | + default y |
| 1597 | | + help |
| 1598 | | + Enable the eventfd() system call that allows to receive both |
| 1599 | | + kernel notification (ie. KAIO) or userspace notifications. |
| 1600 | | + |
| 1601 | | + If unsure, say Y. |
| 1602 | | + |
| 1603 | | +config SHMEM |
| 1604 | | + bool "Use full shmem filesystem" if EMBEDDED |
| 1605 | | + default y |
| 1606 | | + depends on MMU |
| 1607 | | + help |
| 1608 | | + The shmem is an internal filesystem used to manage shared memory. |
| 1609 | | + It is backed by swap and manages resource limits. It is also exported |
| 1610 | | + to userspace as tmpfs if TMPFS is enabled. Disabling this |
| 1611 | | + option replaces shmem and tmpfs with the much simpler ramfs code, |
| 1612 | | + which may be appropriate on small systems without swap. |
| 1613 | | + |
| 1614 | | +config VM_EVENT_COUNTERS |
| 1615 | | + default y |
| 1616 | | + bool "Enable VM event counters for /proc/vmstat" if EMBEDDED |
| 1617 | | + help |
| 1618 | | + VM event counters are needed for event counts to be shown. |
| 1619 | | + This option allows the disabling of the VM event counters |
| 1620 | | + on EMBEDDED systems. /proc/vmstat will only show page counts |
| 1621 | | + if VM event counters are disabled. |
| 1622 | | + |
| 1623 | | +config SLUB_DEBUG |
| 1624 | | + default y |
| 1625 | | + bool "Enable SLUB debugging support" if EMBEDDED |
| 1626 | | + depends on SLUB |
| 1627 | | + help |
| 1628 | | + SLUB has extensive debug support features. Disabling these can |
| 1629 | | + result in significant savings in code size. This also disables |
| 1630 | | + SLUB sysfs support. /sys/slab will not exist and there will be |
| 1631 | | + no support for cache validation etc. |
| 1632 | | + |
| 1633 | | +choice |
| 1634 | | + prompt "Choose SLAB allocator" |
| 1635 | | + default SLUB |
| 1636 | | + help |
| 1637 | | + This option allows to select a slab allocator. |
| 1638 | | + |
| 1639 | | +config SLAB |
| 1640 | | + bool "SLAB" |
| 1641 | | + help |
| 1642 | | + The regular slab allocator that is established and known to work |
| 1643 | | + well in all environments. It organizes cache hot objects in |
| 1644 | | + per cpu and per node queues. SLAB is the default choice for |
| 1645 | | + a slab allocator. |
| 1646 | | + |
| 1647 | | +config SLUB |
| 1648 | | + bool "SLUB (Unqueued Allocator)" |
| 1649 | | + help |
| 1650 | | + SLUB is a slab allocator that minimizes cache line usage |
| 1651 | | + instead of managing queues of cached objects (SLAB approach). |
| 1652 | | + Per cpu caching is realized using slabs of objects instead |
| 1653 | | + of queues of objects. SLUB can use memory efficiently |
| 1654 | | + and has enhanced diagnostics. |
| 1655 | | + |
| 1656 | | +config SLOB |
| 1657 | | + depends on EMBEDDED |
| 1658 | | + bool "SLOB (Simple Allocator)" |
| 1659 | | + help |
| 1660 | | + SLOB replaces the SLAB allocator with a drastically simpler |
| 1661 | | + allocator. SLOB is more space efficient than SLAB but does not |
| 1662 | | + scale well (single lock for all operations) and is also highly |
| 1663 | | + susceptible to fragmentation. SLUB can accomplish a higher object |
| 1664 | | + density. It is usually better to use SLUB instead of SLOB. |
| 1665 | | + |
| 1666 | | +endchoice |
| 1667 | | + |
| 1668 | | +endmenu # General setup |
| 1669 | | + |
| 1670 | | +config SLABINFO |
| 1671 | | + bool |
| 1672 | | + depends on PROC_FS |
| 1673 | | + depends on SLAB || SLUB |
| 1674 | | + default y |
| 1675 | | + |
| 1676 | | +config RT_MUTEXES |
| 1677 | | + boolean |
| 1678 | | + select PLIST |
| 1679 | | + |
| 1680 | | +config TINY_SHMEM |
| 1681 | | + default !SHMEM |
| 1682 | | + bool |
| 1683 | | + |
| 1684 | | +config BASE_SMALL |
| 1685 | | + int |
| 1686 | | + default 0 if BASE_FULL |
| 1687 | | + default 1 if !BASE_FULL |
| 1688 | | + |
| 1689 | | +menuconfig MODULES |
| 1690 | | + bool "Enable loadable module support" |
| 1691 | | + help |
| 1692 | | + Kernel modules are small pieces of compiled code which can |
| 1693 | | + be inserted in the running kernel, rather than being |
| 1694 | | + permanently built into the kernel. You use the "modprobe" |
| 1695 | | + tool to add (and sometimes remove) them. If you say Y here, |
| 1696 | | + many parts of the kernel can be built as modules (by |
| 1697 | | + answering M instead of Y where indicated): this is most |
| 1698 | | + useful for infrequently used options which are not required |
| 1699 | | + for booting. For more information, see the man pages for |
| 1700 | | + modprobe, lsmod, modinfo, insmod and rmmod. |
| 1701 | | + |
| 1702 | | + If you say Y here, you will need to run "make |
| 1703 | | + modules_install" to put the modules under /lib/modules/ |
| 1704 | | + where modprobe can find them (you may need to be root to do |
| 1705 | | + this). |
| 1706 | | + |
| 1707 | | + If unsure, say Y. |
| 1708 | | + |
| 1709 | | +config MODULE_UNLOAD |
| 1710 | | + bool "Module unloading" |
| 1711 | | + depends on MODULES |
| 1712 | | + help |
| 1713 | | + Without this option you will not be able to unload any |
| 1714 | | + modules (note that some modules may not be unloadable |
| 1715 | | + anyway), which makes your kernel slightly smaller and |
| 1716 | | + simpler. If unsure, say Y. |
| 1717 | | + |
| 1718 | | +config MODULE_FORCE_UNLOAD |
| 1719 | | + bool "Forced module unloading" |
| 1720 | | + depends on MODULE_UNLOAD && EXPERIMENTAL |
| 1721 | | + help |
| 1722 | | + This option allows you to force a module to unload, even if the |
| 1723 | | + kernel believes it is unsafe: the kernel will remove the module |
| 1724 | | + without waiting for anyone to stop using it (using the -f option to |
| 1725 | | + rmmod). This is mainly for kernel developers and desperate users. |
| 1726 | | + If unsure, say N. |
| 1727 | | + |
| 1728 | | +config MODVERSIONS |
| 1729 | | + bool "Module versioning support" |
| 1730 | | + depends on MODULES |
| 1731 | | + help |
| 1732 | | + Usually, you have to use modules compiled with your kernel. |
| 1733 | | + Saying Y here makes it sometimes possible to use modules |
| 1734 | | + compiled for different kernels, by adding enough information |
| 1735 | | + to the modules to (hopefully) spot any changes which would |
| 1736 | | + make them incompatible with the kernel you are running. If |
| 1737 | | + unsure, say N. |
| 1738 | | + |
| 1739 | | +config MODULE_SRCVERSION_ALL |
| 1740 | | + bool "Source checksum for all modules" |
| 1741 | | + depends on MODULES |
| 1742 | | + help |
| 1743 | | + Modules which contain a MODULE_VERSION get an extra "srcversion" |
| 1744 | | + field inserted into their modinfo section, which contains a |
| 1745 | | + sum of the source files which made it. This helps maintainers |
| 1746 | | + see exactly which source was used to build a module (since |
| 1747 | | + others sometimes change the module source without updating |
| 1748 | | + the version). With this option, such a "srcversion" field |
| 1749 | | + will be created for all modules. If unsure, say N. |
| 1750 | | + |
| 1751 | | +config KMOD |
| 1752 | | + bool "Automatic kernel module loading" |
| 1753 | | + depends on MODULES |
| 1754 | | + help |
| 1755 | | + Normally when you have selected some parts of the kernel to |
| 1756 | | + be created as kernel modules, you must load them (using the |
| 1757 | | + "modprobe" command) before you can use them. If you say Y |
| 1758 | | + here, some parts of the kernel will be able to load modules |
| 1759 | | + automatically: when a part of the kernel needs a module, it |
| 1760 | | + runs modprobe with the appropriate arguments, thereby |
| 1761 | | + loading the module if it is available. If unsure, say Y. |
| 1762 | | + |
| 1763 | | +config STOP_MACHINE |
| 1764 | | + bool |
| 1765 | | + default y |
| 1766 | | + depends on (SMP && MODULE_UNLOAD) || HOTPLUG_CPU |
| 1767 | | + help |
| 1768 | | + Need stop_machine() primitive. |
| 1769 | | + |
| 1770 | | +source "block/Kconfig" |
| 1771 | | + |
| 1772 | | +config PREEMPT_NOTIFIERS |
| 1773 | | + bool |
| | 1144 | diff -Nur linux-2.6.24.org/scripts/gen_lzma_initramfs_list.sh linux-2.6.24.new/scripts/gen_lzma_initramfs_list.sh |
| | 1145 | --- linux-2.6.20.org/scripts/gen_lzma_initramfs_list.sh 1970-01-01 07:30:00.000000000 +0730 |
| | 1146 | +++ linux-2.6.20.new/scripts/gen_lzma_initramfs_list.sh 2007-03-27 19:52:49.000000000 +0800 |
| | 1147 | @@ -0,0 +1,292 @@ |
| | 1148 | +#!/bin/bash |
| | 1149 | +# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> |
| | 1150 | +# Copyright (c) 2006 Sam Ravnborg <sam@ravnborg.org> |
| | 1151 | +# |
| | 1152 | +# Released under the terms of the GNU GPL |
| | 1153 | +# |
| | 1154 | +# Generate a cpio packed initramfs. It uses gen_init_cpio to generate |
| | 1155 | +# the cpio archive, and gzip to pack it. |
| | 1156 | +# The script may also be used to generate the inputfile used for gen_init_cpio |
| | 1157 | +# This script assumes that gen_init_cpio is located in usr/ directory |
| | 1158 | + |
| | 1159 | +# error out on errors |
| | 1160 | +set -e |
| | 1161 | + |
| | 1162 | +usage() { |
| | 1163 | +cat << EOF |
| | 1164 | +Usage: |
| | 1165 | +$0 [-o <file>] [-u <uid>] [-g <gid>] { -s | -d | <cpio_source>} ... |
| | 1166 | + -o <file> Create lzma initramfs file named <file> using |
| | 1167 | + gen_init_cpio and lzma |
| | 1168 | + -u <uid> User ID to map to user ID 0 (root). |
| | 1169 | + <uid> is only meaningful if <cpio_source> |
| | 1170 | + is a directory. |
| | 1171 | + -g <gid> Group ID to map to group ID 0 (root). |
| | 1172 | + <gid> is only meaningful if <cpio_source> |
| | 1173 | + is a directory. |
| | 1174 | + <cpio_source> File list or directory for cpio archive. |
| | 1175 | + If <cpio_source> is a .cpio file it will be used |
| | 1176 | + as direct input to initramfs. |
| | 1177 | + -s Create lzma file with small dictionary size |
| | 1178 | + -d Output the default cpio list. |
| | 1179 | + |
| | 1180 | +All options except -o and -l may be repeated and are interpreted |
| | 1181 | +sequentially and immediately. -u and -g states are preserved across |
| | 1182 | +<cpio_source> options so an explicit "-u 0 -g 0" is required |
| | 1183 | +to reset the root/group mapping. |
| | 1184 | +EOF |
| | 1185 | +} |
| | 1186 | + |
| | 1187 | +list_default_initramfs() { |
| | 1188 | + # echo usr/kinit/kinit |
| | 1189 | + : |
| | 1190 | +} |
| | 1191 | + |
| | 1192 | +default_initramfs() { |
| | 1193 | + cat <<-EOF >> ${output} |
| | 1194 | + # This is a very simple, default initramfs |
| | 1195 | + |
| | 1196 | + dir /dev 0755 0 0 |
| | 1197 | + nod /dev/console 0600 0 0 c 5 1 |
| | 1198 | + dir /root 0700 0 0 |
| | 1199 | + # file /kinit usr/kinit/kinit 0755 0 0 |
| | 1200 | + # slink /init kinit 0755 0 0 |
| | 1201 | + EOF |
| | 1202 | +} |
| | 1203 | + |
| | 1204 | +filetype() { |
| | 1205 | + local argv1="$1" |
| | 1206 | + |
| | 1207 | + # symlink test must come before file test |
| | 1208 | + if [ -L "${argv1}" ]; then |
| | 1209 | + echo "slink" |
| | 1210 | + elif [ -f "${argv1}" ]; then |
| | 1211 | + echo "file" |
| | 1212 | + elif [ -d "${argv1}" ]; then |
| | 1213 | + echo "dir" |
| | 1214 | + elif [ -b "${argv1}" -o -c "${argv1}" ]; then |
| | 1215 | + echo "nod" |
| | 1216 | + elif [ -p "${argv1}" ]; then |
| | 1217 | + echo "pipe" |
| | 1218 | + elif [ -S "${argv1}" ]; then |
| | 1219 | + echo "sock" |
| | 1220 | + else |
| | 1221 | + echo "invalid" |
| | 1222 | + fi |
| | 1223 | + return 0 |
| | 1224 | +} |
| | 1225 | + |
| | 1226 | +list_print_mtime() { |
| | 1227 | + : |
| | 1228 | +} |
| | 1229 | + |
| | 1230 | +print_mtime() { |
| | 1231 | + local my_mtime="0" |
| | 1232 | + |
| | 1233 | + if [ -e "$1" ]; then |
| | 1234 | + my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1) |
| | 1235 | + fi |
| | 1236 | + |
| | 1237 | + echo "# Last modified: ${my_mtime}" >> ${output} |
| | 1238 | + echo "" >> ${output} |
| | 1239 | +} |
| | 1240 | + |
| | 1241 | +list_parse() { |
| | 1242 | + echo "$1 \\" |
| | 1243 | +} |
| | 1244 | + |
| | 1245 | +# for each file print a line in following format |
| | 1246 | +# <filetype> <name> <path to file> <octal mode> <uid> <gid> |
| | 1247 | +# for links, devices etc the format differs. See gen_init_cpio for details |
| | 1248 | +parse() { |
| | 1249 | + local location="$1" |
| | 1250 | + local name="${location/${srcdir}//}" |
| | 1251 | + # change '//' into '/' |
| | 1252 | + name="${name//\/\///}" |
| | 1253 | + local mode="$2" |
| | 1254 | + local uid="$3" |
| | 1255 | + local gid="$4" |
| | 1256 | + local ftype=$(filetype "${location}") |
| | 1257 | + # remap uid/gid to 0 if necessary |
| | 1258 | + [ "$uid" -eq "$root_uid" ] && uid=0 |
| | 1259 | + [ "$gid" -eq "$root_gid" ] && gid=0 |
| | 1260 | + local str="${mode} ${uid} ${gid}" |
| | 1261 | + |
| | 1262 | + [ "${ftype}" == "invalid" ] && return 0 |
| | 1263 | + [ "${location}" == "${srcdir}" ] && return 0 |
| | 1264 | + |
| | 1265 | + case "${ftype}" in |
| | 1266 | + "file") |
| | 1267 | + str="${ftype} ${name} ${location} ${str}" |
| | 1268 | + ;; |
| | 1269 | + "nod") |
| | 1270 | + local dev_type= |
| | 1271 | + local maj=$(LC_ALL=C ls -l "${location}" | \ |
| | 1272 | + gawk '{sub(/,/, "", $5); print $5}') |
| | 1273 | + local min=$(LC_ALL=C ls -l "${location}" | \ |
| | 1274 | + gawk '{print $6}') |
| | 1275 | + |
| | 1276 | + if [ -b "${location}" ]; then |
| | 1277 | + dev_type="b" |
| | 1278 | + else |
| | 1279 | + dev_type="c" |
| | 1280 | + fi |
| | 1281 | + str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}" |
| | 1282 | + ;; |
| | 1283 | + "slink") |
| | 1284 | + local target=$(LC_ALL=C ls -l "${location}" | \ |
| | 1285 | + gawk '{print $11}') |
| | 1286 | + str="${ftype} ${name} ${target} ${str}" |
| | 1287 | + ;; |
| | 1288 | + *) |
| | 1289 | + str="${ftype} ${name} ${str}" |
| | 1290 | + ;; |
| | 1291 | + esac |
| | 1292 | + |
| | 1293 | + echo "${str}" >> ${output} |
| | 1294 | + |
| | 1295 | + return 0 |
| | 1296 | +} |
| | 1297 | + |
| | 1298 | +unknown_option() { |
| | 1299 | + printf "ERROR: unknown option \"$arg\"\n" >&2 |
| | 1300 | + printf "If the filename validly begins with '-', " >&2 |
| | 1301 | + printf "then it must be prefixed\n" >&2 |
| | 1302 | + printf "by './' so that it won't be interpreted as an option." >&2 |
| | 1303 | + printf "\n" >&2 |
| | 1304 | + usage >&2 |
| | 1305 | + exit 1 |
| | 1306 | +} |
| | 1307 | + |
| | 1308 | +list_header() { |
| | 1309 | + : |
| | 1310 | +} |
| | 1311 | + |
| | 1312 | +header() { |
| | 1313 | + printf "\n#####################\n# $1\n" >> ${output} |
| | 1314 | +} |
| | 1315 | + |
| | 1316 | +# process one directory (incl sub-directories) |
| | 1317 | +dir_filelist() { |
| | 1318 | + ${dep_list}header "$1" |
| | 1319 | + |
| | 1320 | + srcdir=$(echo "$1" | sed -e 's://*:/:g') |
| | 1321 | + dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null) |
| | 1322 | + |
| | 1323 | + # If $dirlist is only one line, then the directory is empty |
| | 1324 | + if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then |
| | 1325 | + ${dep_list}print_mtime "$1" |
| | 1326 | + |
| | 1327 | + echo "${dirlist}" | \ |
| | 1328 | + while read x; do |
| | 1329 | + ${dep_list}parse ${x} |
| | 1330 | + done |
| | 1331 | + fi |
| | 1332 | +} |
| | 1333 | + |
| | 1334 | +# if only one file is specified and it is .cpio file then use it direct as fs |
| | 1335 | +# if a directory is specified then add all files in given direcotry to fs |
| | 1336 | +# if a regular file is specified assume it is in gen_initramfs format |
| | 1337 | +input_file() { |
| | 1338 | + source="$1" |
| | 1339 | + if [ -f "$1" ]; then |
| | 1340 | + ${dep_list}header "$1" |
| | 1341 | + is_cpio="$(echo "$1" | sed 's/^.*\.cpio/cpio/')" |
| | 1342 | + if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then |
| | 1343 | + cpio_file=$1 |
| | 1344 | + [ ! -z ${dep_list} ] && echo "$1" |
| | 1345 | + return 0 |
| | 1346 | + fi |
| | 1347 | + if [ -z ${dep_list} ]; then |
| | 1348 | + print_mtime "$1" >> ${output} |
| | 1349 | + cat "$1" >> ${output} |
| | 1350 | + else |
| | 1351 | + cat "$1" | while read type dir file perm ; do |
| | 1352 | + if [ "$type" == "file" ]; then |
| | 1353 | + echo "$file \\"; |
| | 1354 | + fi |
| | 1355 | + done |
| | 1356 | + fi |
| | 1357 | + elif [ -d "$1" ]; then |
| | 1358 | + dir_filelist "$1" |
| | 1359 | + else |
| | 1360 | + echo " ${prog}: Cannot open '$1'" >&2 |
| | 1361 | + exit 1 |
| | 1362 | + fi |
| | 1363 | +} |
| | 1364 | + |
| | 1365 | +prog=$0 |
| | 1366 | +root_uid=0 |
| | 1367 | +root_gid=0 |
| | 1368 | +dep_list= |
| | 1369 | +cpio_file= |
| | 1370 | +cpio_list= |
| | 1371 | +output="/dev/stdout" |
| | 1372 | +output_file="" |
| | 1373 | +opt="" |
| | 1374 | + |
| | 1375 | +arg="$1" |
| | 1376 | +case "$arg" in |
| | 1377 | + "-l") # files included in initramfs - used by kbuild |
| | 1378 | + dep_list="list_" |
| | 1379 | + echo "deps_initramfs := \\" |
| | 1380 | + shift |
| | 1381 | + ;; |
| | 1382 | + "-o") # generate lzma-ed cpio image named $1 |
| | 1383 | + shift |
| | 1384 | + output_file="$1" |
| | 1385 | + cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" |
| | 1386 | + output=${cpio_list} |
| | 1387 | + shift |
| | 1388 | + ;; |
| | 1389 | +esac |
| | 1390 | +while [ $# -gt 0 ]; do |
| | 1391 | + arg="$1" |
| | 1392 | + shift |
| | 1393 | + case "$arg" in |
| | 1394 | + "-u") # map $1 to uid=0 (root) |
| | 1395 | + root_uid="$1" |
| | 1396 | + shift |
| | 1397 | + ;; |
| | 1398 | + "-g") # map $1 to gid=0 (root) |
| | 1399 | + root_gid="$1" |
| | 1400 | + shift |
| | 1401 | + ;; |
| | 1402 | + "-s") |
| | 1403 | + #opt="-d16"# Use smaller compression level |
| | 1404 | + ;; |
| | 1405 | + "-d") # display default initramfs list |
| | 1406 | + default_list="$arg" |
| | 1407 | + ${dep_list}default_initramfs |
| | 1408 | + ;; |
| | 1409 | + "-h") |
| | 1410 | + usage |
| | 1411 | + exit 0 |
| | 1412 | + ;; |
| | 1413 | + *) |
| | 1414 | + case "$arg" in |
| | 1415 | + "-"*) |
| | 1416 | + unknown_option |
| | 1417 | + ;; |
| | 1418 | + *) # input file/dir - process it |
| | 1419 | + input_file "$arg" "$#" |
| | 1420 | + ;; |
| | 1421 | + esac |
| | 1422 | + ;; |
| | 1423 | + esac |
| | 1424 | +done |
| | 1425 | + |
| | 1426 | +# If output_file is set we will generate cpio archive and lzma it |
| | 1427 | +# we are carefull to delete tmp files |
| | 1428 | +if [ ! -z ${output_file} ]; then |
| | 1429 | + if [ -z ${cpio_file} ]; then |
| | 1430 | + cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" |
| | 1431 | + usr/gen_init_cpio ${cpio_list} > ${cpio_tfile} |
| | 1432 | + else |
| | 1433 | + cpio_tfile=${cpio_file} |
| | 1434 | + fi |
| | 1435 | + rm ${cpio_list} |
| | 1436 | + lzma -z ${cpio_tfile} ${opt} -c > ${output_file} |
| | 1437 | + [ -z ${cpio_file} ] && rm ${cpio_tfile} |
| | 1438 | +fi |
| | 1439 | +exit 0 |
| | 1440 | diff -Nur linux-2.6.20-orig/usr/Makefile linux-2.6.20-new/usr/Makefile |
| | 1441 | --- linux-2.6.20-orig/usr/Makefile 2007-02-20 14:34:32.000000000 +0800 |
| | 1442 | +++ linux-2.6.20-new/usr/Makefile 2007-03-27 19:53:30.000000000 +0800 |
| | 1443 | @@ -19,6 +19,7 @@ |
| | 1444 | |
| | 1445 | hostprogs-y := gen_init_cpio |
| | 1446 | initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh |
| | 1447 | +lzma_initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_lzma_initramfs_list.sh |
| | 1448 | ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ |
| | 1449 | $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) |
| | 1450 | ramfs-args := \ |
| | 1451 | @@ -36,6 +37,14 @@ |
| | 1452 | quiet_cmd_initfs = GEN $@ |
| | 1453 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) |
| | 1454 | |
| | 1455 | +ifdef CONFIG_LZMA_INITRAM_FS_SMALLMEM |
| | 1456 | +quiet_cmd_lzma_initfs = LZRAMFS $@ |
| | 1457 | + cmd_lzma_initfs = $(lzma_initramfs) -o $@ $(ramfs-args) -s $(ramfs-input) |
| | 1458 | +else |
| | 1459 | +quiet_cmd_lzma_initfs = LZRAMFS $@ |
| | 1460 | + cmd_lzma_initfs = $(lzma_initramfs) -o $@ $(ramfs-args) $(ramfs-input) |
| | 1461 | +endif |
| | 1462 | + |
| | 1463 | targets := initramfs_data.cpio.gz |
| | 1464 | # do not try to update files included in initramfs |
| | 1465 | $(deps_initramfs): ; |
| | 1466 | @@ -48,5 +57,9 @@ |
| | 1467 | # 4) arguments to gen_initramfs.sh changes |
| | 1468 | $(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs |
| | 1469 | $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.gz.d |
| | 1470 | +ifdef CONFIG_LZMA_INITRAM_FS |
| | 1471 | + $(call if_changed,lzma_initfs) |
| | 1472 | +else |
| | 1473 | $(call if_changed,initfs) |
| | 1474 | +endif |
| | 1475 | |