From 10400569fd108be620e68f7f868f352aaed87dc7 Mon Sep 17 00:00:00 2001 From: Brad House Date: Wed, 17 Dec 2003 01:05:08 +0000 Subject: [PATCH] more generic git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@25 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- gen_initrd.sh | 48 +++++++++-- generic/linuxrc | 8 +- x86/linuxrc | 189 -------------------------------------------- x86/modules_load | 10 +-- x86_64/modules_load | 2 +- 5 files changed, 50 insertions(+), 207 deletions(-) delete mode 100644 x86/linuxrc diff --git a/gen_initrd.sh b/gen_initrd.sh index 70c67b0..ce99418 100644 --- a/gen_initrd.sh +++ b/gen_initrd.sh @@ -82,6 +82,15 @@ create_base_initrd_sys() { done } +print_list() +{ + local x + for x in ${*} + do + echo ${x} + done +} + create_initrd_modules() { if [ "${PAT}" -gt "4" ] then @@ -113,7 +122,6 @@ create_initrd_modules() { cp -ax --parents /lib/modules/${KV}/modules* ${TEMP}/initrd-temp - print_info 1 "WARNING WARNING: Brad, Dont forget to output modules files to autoload" # cat ${GK_SHARE}/${ARCH}/linuxrc | sed -e "s/%%STORAGE_MODULES%%/${STORAGE_MODULES}/" \ # -e "s/%%FIREWIRE_MODULES%%/${FIREWIRE_MODULES}/" \ # -e "s/%%ATARAID_MODULES%%/${ATARAID_MODULES}/" \ @@ -121,10 +129,40 @@ create_initrd_modules() { # -e "s/%%USB_MODULES%%/${USB_MODULES}/" \ # > ${TEMP}/initrd-temp/linuxrc - cp "${GK_SHARE}/generic/linuxrc" "${TEMP}/initrd-temp/linuxrc" - cp "${GK_SHARE}/generic/initrd.scripts" "${TEMP}/initrd-temp/etc/initrd.scripts" - cp "${GK_SHARE}/generic/initrd.defaults" "${TEMP}/initrd-temp/etc/initrd.defaults" - cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initrd-temp/sbin/modprobe" + mkdir -p "${TEMP}/initrd-temp/etc/modules" + print_list ${SCSI_MODULES} > "${TEMP}/initrd-temp/etc/modules/scsi" + print_list ${FIREWIRE_MODULES} > "${TEMP}/initrd-temp/etc/modules/firewire" + print_list ${ATARAID_MODULES} > "${TEMP}/initrd-temp/etc/modules/ataraid" + print_list ${PCMCIA_MODULES} > "${TEMP}/initrd-temp/etc/modules/pcmcia" + print_list ${USB_MODULES} > "${TEMP}/initrd-temp/etc/modules/usb" + + if [ -f "${GK_SHARE}/${ARCH}/linuxrc" ] + then + cp "${GK_SHARE}/${ARCH}/linuxrc" "${TEMP}/initrd-temp/linuxrc" + else + cp "${GK_SHARE}/generic/linuxrc" "${TEMP}/initrd-temp/linuxrc" + fi + + if [ -f "${GK_SHARE}/${ARCH}/initrd.scripts" ] + then + cp "${GK_SHARE}/${ARCH}/initrd.scripts" "${TEMP}/initrd-temp/etc/initrd.scripts" + else + cp "${GK_SHARE}/generic/initrd.scripts" "${TEMP}/initrd-temp/etc/initrd.scripts" + fi + + if [ -f "${GK_SHARE}/${ARCH}/initrd.defaults" ] + then + cp "${GK_SHARE}/${ARCH}/initrd.defaults" "${TEMP}/initrd-temp/etc/initrd.defaults" + else + cp "${GK_SHARE}/generic/initrd.defaults" "${TEMP}/initrd-temp/etc/initrd.defaults" + fi + if [ -f "${GK_SHARE}/${ARCH}/modprobe" ] + then + cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initrd-temp/sbin/modprobe" + else + cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initrd-temp/sbin/modprobe" + fi + chmod +x "${TEMP}/initrd-temp/linuxrc" chmod +x "${TEMP}/initrd-temp/etc/initrd.scripts" chmod +x "${TEMP}/initrd-temp/etc/initrd.defaults" diff --git a/generic/linuxrc b/generic/linuxrc index 90ab802..c6525b0 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -158,14 +158,14 @@ then kill_devfsd else echo "STEP 5b: setting up stuff for pivot_root" - mkdir /newroot/initrd + mkdir -p /newroot/tmp/.initrd fi echo "STEP 6: pivot_root and exec/chroot real init" cd /newroot -pivot_root . initrd +pivot_root . tmp/.initrd if [ "${USE_DEVFS_NORMAL}" -eq "1" -a "${CDROOT}" -eq "0" ] then @@ -179,8 +179,8 @@ then # Uhh, initrd is wasting memory ... let's # kill the sucker here and now! - umount /initrd - blockdev --flushbufs /dev/ram0 + # umount tmp/.initrd + # blockdev --flushbufs /dev/ram0 # at this point it lets us umount the new # devfs, don't know why, just does, stop diff --git a/x86/linuxrc b/x86/linuxrc deleted file mode 100644 index 8231e81..0000000 --- a/x86/linuxrc +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/sh -# Daniel Robbins -# Copyright 2003 Gentoo Technologies, Inc. -# Distributed under the GPL - -PATH=/usr/sbin:/usr/bin:/sbin:/bin -BACK_UP="\033[1K\033[0G" -HILITE="\033[1m" -NORMAL="\033[0m" -WARN="\033[1m" -BAD="\033[1m" -#mount -o remount,rw / -mount /proc -INITRD="true" -SCSI="yes" -CDCACHE="no" -IDEBUG="no" -FIREWIRE="no" -ATARAID="no" -PCMCIA="no" -DETECT="no" -USB="yes" -KEYMAP="no" -if [ ! -e /dev/.devfsd ] -then - #mount devfs - mount -t devfs devfs /dev -fi - -CMDLINE="`cat /proc/cmdline`" -for x in $CMDLINE -do - if [ "$x" = "doscsi" ] - then - SCSI="yes" - elif [ "$x" = "cdcache" ] - then - CDCACHE="yes" - elif [ "$x" = "idebug" ] - then - IDEBUG="yes" - fi -done - -for x in $CMDLINE -do - if [ "$x" = "dofirewire" ] - then - FIREWIRE="yes" - fi -done -for x in $CMDLINE -do - if [ "$x" = "nousb" ] - then - USB="no" - fi -done - -for x in $CMDLINE -do - if [ "$x" = "doataraid" ] - then - ATARAID="yes" - fi -done -for x in $CMDLINE -do - if [ "$x" = "dopcmcia" ] - then - PCMCIA="yes" - fi -done - -for x in $CMDLINE -do - if [ "$x" = "dokeymap" ] - then - KEYMAP="yes" - fi -done - -blurb() { - echo -ne ${HILITE}${1} -} - -backup() { - echo -ne "\033[0G\033[0K" -} -if [ -e /dev/.devfsd ] - then - RAM_DEVICE="rd" - else - RAM_DEVICE="ram0" -fi - - -# Create the new root FS - -mounted="" - -initmsg() { - echo -e "${HILITE}${*}${NORMAL}" -} - -getkeymap() { - local mykeymap - echo -ne ${HILITE} - cat /keymaps/key.lst - echo -ne ${NORMAL} - read -p "Keymap selection: " mykeymap - if [ -e /keymaps/${mykeymap}.map ] - then - echo -e "${HILITE}---- Loading ${mykeymap} keymap${NORMAL}" - loadkmap < /keymaps/${mykeymap}.map - elif [ "$mykeymap" = "" ] - then - #default keymap is "us" - echo -e "${HILITE}---- Loading default (US) keymap${NORMAL}" - loadkmap < /keymaps/us.map - else - getkeymap - fi -} - -modules_scan() { - local type - type=${1}; shift - for x in "$@" - do - blurb "---- Scanning for ${x}..." - insmod.static -f /modules/${type}/${x}.o > /dev/null 2>&1 - if [ $? -eq 0 ] - then - backup - echo -e "${GOOD}---- Detected ${x} hardware${NORMAL}" - else - backup - echo -ne "${NORMAL}" - fi - done -} -echo "${GOOD} Initial RAMDISK Loading Starting..." -# Mount the CD - -if [ "$SCSI" = "yes" ] -then -DEVICE=SCSI - echo -e "${HILITE} ---- Beginning storage detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan storage %%STORAGE_MODULES%% -fi - -if [ "$FIREWIRE" = "yes" ] -then -DEVICE=FIREWIRE - echo -e "${HILITE} ---- Beginning firewire detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan firewire %%FIREWIRE_MODULES%% -fi -if [ "$ATARAID" = "yes" ] -then -DEVICE=ATARAID - echo -e "${HILITE} ---- Beginning ata detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan ataraid %%ATARAID_MODULES%% -fi - -if [ "$PCMCIA" = "yes" ] -then -DEVICE=PCMCIA - echo -e "${HILITE} ---- Beginning pcmcia detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan %%PCMCIA_MODULES%% -fi -if [ "$USB" = "yes" ] -then -DEVICE=USB - echo -e "${HILITE} ---- Beginning usb detection${NORMAL}" - # This next "%% %%" gets sed tweaked: - modules_scan usb %%USB_MODULES%% -fi - -if [ "$KEYMAP" = "yes" ] -then -getkeymap -fi - -exit diff --git a/x86/modules_load b/x86/modules_load index be2b70a..809f4cd 100644 --- a/x86/modules_load +++ b/x86/modules_load @@ -1,4 +1,4 @@ -STORAGE_MODULES="sd_mod sg sr_mod \ +SCSI_MODULES="sd_mod sg sr_mod \ aic7xxx aic7xxx_old BusLogic \ ncr53c8xx NCR53c406a \ initio advansys aha1740 aha1542 aha152x \ @@ -17,11 +17,5 @@ ATARAID_MODULES="ataraid pdcraid hptraid" PCMCIA_MODULES="ide-cs" -USB_MODULES="usbcore ehci-hcd uhci usb-ohci hid usb-storage" - -INITRD_SIZE=5000 - -#BOOT_SPLASH_INITRD="/boot/initrd.bs" - -MRPROPER="yes" +USB_MODULES="ehci-hcd uhci usb-ohci hid usb-storage" diff --git a/x86_64/modules_load b/x86_64/modules_load index 2b6c1bf..809f4cd 100644 --- a/x86_64/modules_load +++ b/x86_64/modules_load @@ -1,4 +1,4 @@ -STORAGE_MODULES="sd_mod sg sr_mod \ +SCSI_MODULES="sd_mod sg sr_mod \ aic7xxx aic7xxx_old BusLogic \ ncr53c8xx NCR53c406a \ initio advansys aha1740 aha1542 aha152x \