diff options
author | Achim Gottinger <achim@gentoo.org> | 2000-12-02 05:29:18 +0000 |
---|---|---|
committer | Achim Gottinger <achim@gentoo.org> | 2000-12-02 05:29:18 +0000 |
commit | c5c4f4f1acff0272f41734591ba6f54e79f524a4 (patch) | |
tree | d93a2c955f0950f63866b8b22af025950f215d0d /sys-apps | |
parent | *** empty log message *** (diff) | |
download | gentoo-2-c5c4f4f1acff0272f41734591ba6f54e79f524a4.tar.gz gentoo-2-c5c4f4f1acff0272f41734591ba6f54e79f524a4.tar.bz2 gentoo-2-c5c4f4f1acff0272f41734591ba6f54e79f524a4.zip |
*** empty log message ***
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/bootdisk/files/linuxrc.c | 2 | ||||
-rw-r--r-- | sys-apps/bootdisk/files/loop.h | 127 | ||||
-rwxr-xr-x | sys-apps/bootdisk/files/mkcd.sh | 58 |
3 files changed, 162 insertions, 25 deletions
diff --git a/sys-apps/bootdisk/files/linuxrc.c b/sys-apps/bootdisk/files/linuxrc.c index 7cdfea43b3af..98f8b442f3fd 100644 --- a/sys-apps/bootdisk/files/linuxrc.c +++ b/sys-apps/bootdisk/files/linuxrc.c @@ -8,8 +8,8 @@ #include <getopt.h> #include <errno.h> #include <sys/ioctl.h> -#include <linux/loop.h> #include <linux/fs.h> +#include "loop.h" #define NUMDRIVES (6) diff --git a/sys-apps/bootdisk/files/loop.h b/sys-apps/bootdisk/files/loop.h new file mode 100644 index 000000000000..f8287319e0c1 --- /dev/null +++ b/sys-apps/bootdisk/files/loop.h @@ -0,0 +1,127 @@ +#ifndef _LINUX_LOOP_H +#define _LINUX_LOOP_H + +#include <linux/kdev_t.h> + +/* + * include/linux/loop.h + * + * Written by Theodore Ts'o, 3/29/93. + * + * Copyright 1993 by Theodore Ts'o. Redistribution of this file is + * permitted under the GNU Public License. + */ + +#define LO_NAME_SIZE 64 +#define LO_KEY_SIZE 32 + +#ifdef __KERNEL__ + +struct loop_device { + int lo_number; + struct dentry *lo_dentry; + int lo_refcnt; + kdev_t lo_device; + int lo_offset; + int lo_encrypt_type; + int lo_encrypt_key_size; + int lo_flags; + int (*transfer)(struct loop_device *, int cmd, + char *raw_buf, char *loop_buf, int size, + int real_block); + char lo_name[LO_NAME_SIZE]; + char lo_encrypt_key[LO_KEY_SIZE]; + __u32 lo_init[2]; + uid_t lo_key_owner; /* Who set the key */ + int (*ioctl)(struct loop_device *, int cmd, + unsigned long arg); + + struct file * lo_backing_file; + void *key_data; + char key_reserved[48]; /* for use by the filter modules */ +}; + +typedef int (* transfer_proc_t)(struct loop_device *, int cmd, + char *raw_buf, char *loop_buf, int size, + int real_block); + +#endif /* __KERNEL__ */ + +/* + * Loop flags + */ +#define LO_FLAGS_DO_BMAP 0x00000001 +#define LO_FLAGS_READ_ONLY 0x00000002 + +/* + * Note that this structure gets the wrong offsets when directly used + * from a glibc program, because glibc has a 32bit dev_t. + * Prevent people from shooting in their own foot. + */ + +/* + * This uses kdev_t because glibc currently has no appropiate + * conversion version for the loop ioctls. + * The situation is very unpleasant + */ + +struct loop_info { + int lo_number; /* ioctl r/o */ + dev_t lo_device; /* ioctl r/o */ + unsigned long lo_inode; /* ioctl r/o */ + dev_t lo_rdevice; /* ioctl r/o */ + int lo_offset; + int lo_encrypt_type; + int lo_encrypt_key_size; /* ioctl w/o */ + int lo_flags; /* ioctl r/o */ + char lo_name[LO_NAME_SIZE]; + unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ + unsigned long lo_init[2]; + char reserved[4]; +}; + +/* + * Loop filter types + */ + +#define LO_CRYPT_NONE 0 +#define LO_CRYPT_XOR 1 +#define LO_CRYPT_DES 2 +#define LO_CRYPT_FISH2 3 /* Brand new Twofish encryption */ +#define LO_CRYPT_BLOW 4 +#define LO_CRYPT_CAST128 5 +#define LO_CRYPT_IDEA 6 +#define LO_CRYPT_DUMMY 9 +#define LO_CRYPT_SKIPJACK 10 +#define MAX_LO_CRYPT 20 + +#ifdef __KERNEL__ +/* Support for loadable transfer modules */ +struct loop_func_table { + int number; /* filter type */ + int (*transfer)(struct loop_device *lo, int cmd, + char *raw_buf, char *loop_buf, int size, + int real_block); + int (*init)(struct loop_device *, struct loop_info *); + /* release is called from loop_unregister_transfer or clr_fd */ + int (*release)(struct loop_device *); + int (*ioctl)(struct loop_device *, int cmd, unsigned long arg); + /* lock and unlock manage the module use counts */ + void (*lock)(struct loop_device *); + void (*unlock)(struct loop_device *); +}; + +int loop_register_transfer(struct loop_func_table *funcs); +int loop_unregister_transfer(int number); + +#endif +/* + * IOCTL commands --- we will commandeer 0x4C ('L') + */ + +#define LOOP_SET_FD 0x4C00 +#define LOOP_CLR_FD 0x4C01 +#define LOOP_SET_STATUS 0x4C02 +#define LOOP_GET_STATUS 0x4C03 + +#endif diff --git a/sys-apps/bootdisk/files/mkcd.sh b/sys-apps/bootdisk/files/mkcd.sh index 0763668e5946..ac18028b5a85 100755 --- a/sys-apps/bootdisk/files/mkcd.sh +++ b/sys-apps/bootdisk/files/mkcd.sh @@ -7,6 +7,9 @@ then fi export PORTDIR=/usr/portage +export BOOTIMG=${ROOT}/bootcd +export INITDISK=${ROOT}/initdisk + if [ ! -d "${PORTDIR}/gentoo-x86/sys-apps/bootdisk" ] then @@ -30,7 +33,9 @@ doexes() { done } -cd ${ROOT} +dodirs ${BOOTIMG} ${INITDISK} + +cd ${BOOTIMG} echo "Creating basic dirs" @@ -40,7 +45,7 @@ dodirs bin dev initrd lib mnt proc sbin usr echo "Creating initdisk stuff in initrd first" echo "Creating /initrd dirs" -cd ${ROOT}/initrd +cd ${BOOTIMG}/initrd dodirs dev distcd lib etc root tmp var @@ -48,7 +53,7 @@ touch distcd echo "Creating /inird devices" -cd ${ROOT}/initrd/dev +cd ${BOOTIMG}/initrd/dev for i in console fd0 fd0u1440 hd[abcd] initctl loop0 ram0 scd[01] tty[01] do cp -a /dev/$i . @@ -57,15 +62,16 @@ done mkdir pts echo "Populating /initrd/etc" -cd ${ROOT}/initrd/etc +cd ${BOOTIMG}/initrd/etc cp -af ${PORTDIR}/gentoo-x86/sys-apps/bootdisk/files/etc/* . find . -type d -name "CVS" -exec rm -r {} \; +touch ld.so.conf echo "Creating linuxrc" -cd ${ROOT}/initrd +cd ${BOOTIMG}/initrd gcc -s -o linuxrc ${PORTDIR}/gentoo-x86/sys-apps/bootdisk/files/linuxrc.c -cd ${ROOT}/initrd/var +cd ${BOOTIMG}/initrd/var dodirs log run touch log/wtmp touch run/utmp @@ -73,7 +79,7 @@ touch run/utmp echo "Creating links to initrd" -cd ${ROOT} +cd ${BOOTIMG} for i in etc root tmp var do @@ -81,7 +87,7 @@ do done echo "Creating devices" -cd ${ROOT}/dev +cd ${BOOTIMG}/dev ln -s ../initrd/pts pts ln -sf ../initrd/dev/initctl . ln -sf ../initrd/dev/tty1 . @@ -98,13 +104,13 @@ ln -s ram0 ram mknod initrd b 1 250 echo "Creating /mnt dirs" -cd ${ROOT}/mnt +cd ${BOOTIMG}/mnt dodirs floppy gentoo ram ln -s ../initrd/distcd . -cd ${ROOT}/bin +cd ${BOOTIMG}/bin echo "Populating /bin" doexes bash cat chgrp chmod chown cp df du hostname kill ln login \ @@ -114,13 +120,14 @@ ln -s bash sh echo "Populating /sbin" -cd ${ROOT}/sbin +cd ${BOOTIMG}/sbin doexes agetty depmod e2fsck fdisk halt ifconfig init insmod \ ldconfig lilo ln lsmod mke2fs mkraid mkreiserfs mkswap \ - portmap raidstart reboot reiserfsck resize2fs resize_reiserfs \ + portmap raidstart reboot resize2fs \ route sfdisk shutdown touch +# reiserfsck and resize_reiserfs does not exist in 2.4 ln -s insmod modprobe ln -s mkraid raid0run @@ -131,22 +138,22 @@ ln -s raidstart raidstop cp /usr/portage/gentoo-x86/autoinstaller.sh . echo "Creating /usr dirs" -cd ${ROOT}/usr +cd ${BOOTIMG}/usr dodirs bin lib sbin share echo "Populating /usr/bin" -cd ${ROOT}/usr/bin +cd ${BOOTIMG}/usr/bin doexes awk bzip2 cut expr fdformat ftp grep gzip joe killall ldd \ loadkeys most rm rmdir scp sed ssh tar top vi echo "Populating /usr/sbin" -cd ${ROOT}/usr/sbin +cd ${BOOTIMG}/usr/sbin doexes rc-update echo "Populating /usr/share" -cd ${ROOT}/usr/share +cd ${BOOTIMG}/usr/share echo "keymaps" cp -af /usr/share/keymaps . @@ -156,9 +163,9 @@ echo "terminfo" cp -af /usr/share/terminfo . echo "Populating /lib/modules" -cd ${ROOT}/lib +cd ${BOOTIMG}/lib cp -af /lib/modules . -cd ${ROOT}/lib/modules/2* +cd ${BOOTIMG}/lib/modules/2* for i in modules.* do rm $i @@ -166,7 +173,7 @@ do done echo "Populating /usr/lib/security" -cd ${ROOT}/usr/lib +cd ${BOOTIMG}/usr/lib mkdir security @@ -177,19 +184,19 @@ do echo "Finding required libs for $j" - myfiles=`find ${ROOT}$j -print | /usr/lib/portage/bin/find-requires | grep -v "/bin/bash" | grep -v "/bin/sh"` + myfiles=`find ${BOOTIMG}$j -print | /usr/lib/portage/bin/find-requires | grep -v "/bin/bash" | grep -v "/bin/sh"` for i in $myfiles do if [ -f /lib/$i ] then - cp /lib/$i ${ROOT}/lib/$i - strip ${ROOT}/lib/$i + cp /lib/$i ${BOOTIMG}/lib/$i + strip ${BOOTIMG}/lib/$i else if [ -f /usr/lib/$i ] then - cp /usr/lib/$i ${ROOT}/usr/lib/$i - strip ${ROOT}/usr/lib/$i + cp /usr/lib/$i ${BOOTIMG}/usr/lib/$i + strip ${BOOTIMG}/usr/lib/$i else echo "$i not found !" fi @@ -197,3 +204,6 @@ do done done + +ldconfig -r ${BOOTIMG} +mv ${BOOTIMG}/initrd/* ${INITDISK} |