This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 debian/changelog                      |    5 +-
 platforms/common-yum/exclude          |    2 +
 platforms/common-yum/initramfs/disk   |   80 ++++++++++
 platforms/common-yum/initramfs/init   |    3 +
 platforms/common-yum/initramfs/init.1 |  125 ++++++++++++++++
 platforms/common-yum/initramfs/nand   |    8 +
 platforms/common-yum/initramfs/usb    |   76 ++++++++++
 platforms/common-yum/install.sh       |  255 +++++++++++++++++++++++++++++++++
 platforms/common-yum/nand.sh          |  121 ++++++++++++++++
 9 files changed, 673 insertions(+), 2 deletions(-)

New commits:
commit 261edb5770245c1f3c2b9fab842881624e591116
Author: Prajwal Mohan <[EMAIL PROTECTED]>
Date:   Tue Aug 5 17:01:20 2008 -0700

    Checking in scripts for initrd


Diff in this email is a maximum of 400 lines.
diff --git a/debian/changelog b/debian/changelog
index d7780f6..174f1a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -91,9 +91,10 @@ moblin-image-creator (0.45) UNRELEASED; urgency=low
 
   [ Prajwal Mohan ]
   * Fixing bug in applying hd_kernel_cmd_line
-  * Fixing update-grub path 
+  * Fixing update-grub path
+  * Checking in scripts for initrd 
 
- -- Prajwal Mohan <[EMAIL PROTECTED]>  Fri, 01 Aug 2008 11:35:06 -0700
+ -- Prajwal Mohan <[EMAIL PROTECTED]>  Tue, 05 Aug 2008 17:00:54 -0700
 
 moblin-image-creator (0.44) gaston; urgency=low
 
diff --git a/platforms/common-yum/exclude b/platforms/common-yum/exclude
new file mode 100644
index 0000000..cd3d05e
--- /dev/null
+++ b/platforms/common-yum/exclude
@@ -0,0 +1,2 @@
+boot
+usr/sbin/policy-rc.d
diff --git a/platforms/common-yum/initramfs/disk 
b/platforms/common-yum/initramfs/disk
new file mode 100755
index 0000000..ae1aec6
--- /dev/null
+++ b/platforms/common-yum/initramfs/disk
@@ -0,0 +1,80 @@
+#!/bin/sh
+# Unified squash Hard Disk filesystem mounting           -*- shell-script -*-
+
+mountroot ()
+{
+    CFG_FILE=/etc/moblin-initramfs.cfg
+    if [ -f ${CFG_FILE} ]
+    then
+       . ${CFG_FILE}
+    else
+       echo "Did not find config file: ${CFG_FILE}"
+       sleep 5
+       halt
+    fi
+    # squashfs enabled?
+    if [ "${use_squashfs}" -eq 1 ]
+    then
+       echo "Using squashfs..."
+       mkdir -p /container
+       mkdir -p /squashmnt
+       mkdir -p /persistmnt
+    else
+       echo "NOT using squashfs..."
+    fi
+
+    # Find the boot disk
+    while true; do
+      for device in 'hda' 'hdb' 'sda' 'sdb'; do
+        echo "checking device /dev/${device}"
+        if [ -e /sys/block/${device}/removable ]; then
+           if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then
+              echo "found harddisk at /dev/${device}"
+              found="yes"
+              break
+           fi
+         fi
+      done
+      if [ "$found" = "yes" ]; then
+        break;
+      fi
+      /bin/sleep 5
+    done
+    # try to resume first
+    echo "Attempting to resume from hibernation..."
+    #/bin/resume /dev/${device}3
+
+    # if the resume succeeded then we won't get to here, so if we have got here
+    # then resume did NOT succeed, which is okay.
+    echo "Will mount root from /dev/${device}"
+    if [ "${use_squashfs}" -eq 1 ]
+    then
+       # We are using squashfs
+       echo "Setting up our squashfs and ext3fs unionfs system..."
+       mount -t ext3 -o ro /dev/${device}1 /container
+       while [ ! -e "/container/rootfs.img" ]
+       do
+           echo "Did not find /container/rootfs.img"
+           echo "sleeping for 0.5 seconds..."
+           /bin/sleep 0.5
+           echo "Mounting: mount -o ro /dev/${device}1 /container"
+           mount -t ext3 -o ro /dev/${device}1 /container
+       done
+       mount -o ro,loop -t squashfs /container/rootfs.img /squashmnt
+       mount -t ext3 -o rw,noatime,nodiratime /dev/${device}2 /persistmnt
+       mount -t unionfs -o dirs=/persistmnt=rw:/squashmnt=ro none ${rootmnt}
+    else
+       # We are NOT using squashfs
+       echo "mounting root partition, NOT using squashfs"   
+       mount -t ext3 -o rw,noatime,nodiratime /dev/${device}2 ${rootmnt}
+       while [ ! -e "${rootmnt}/bin" ]
+       do
+           echo "Did not find ${rootmnt}/bin"
+           echo "sleeping for 2 seconds..."
+           /bin/sleep 2
+           echo "Mounting: mount -o rw,noatime,nodiratime /dev/${device}2 
${rootmnt}"
+           mount -t ext3 -o rw,noatime,nodiratime /dev/${device}2 ${rootmnt}
+       done
+       mount -t ext3 -o rw,noatime,nodiratime /dev/${device}1 ${rootmnt}/boot 
+    fi
+}
diff --git a/platforms/common-yum/initramfs/init 
b/platforms/common-yum/initramfs/init
new file mode 100755
index 0000000..99a8265
--- /dev/null
+++ b/platforms/common-yum/initramfs/init
@@ -0,0 +1,3 @@
+#!/bin/sh
+export RUNLEVEL=3
+exec /bin/sh /init.1
diff --git a/platforms/common-yum/initramfs/init.1 
b/platforms/common-yum/initramfs/init.1
new file mode 100755
index 0000000..6d87efb
--- /dev/null
+++ b/platforms/common-yum/initramfs/init.1
@@ -0,0 +1,125 @@
+#!/bin/sh
+
+RUNLEVEL=3
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ln -s /bin/busybox /bin/umount
+export PATH
+
+echo Mounting proc filesystem
+mount -t proc /proc /proc
+
+echo Mounting sysfs filesystem
+mount -t sysfs /sys /sys
+
+echo Creating /tmp
+mount -t tmpfs /tmp /tmp
+
+echo Creating /dev
+mount -o mode=0755 -t tmpfs /dev /dev
+mkdir /dev/pts
+mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
+mkdir /dev/shm
+mkdir /dev/mapper
+
+echo Creating initial device nodes
+mdev -s
+
+export rootmnt=/root
+
+for x in $(cat /proc/cmdline); do
+       case $x in
+       init=*)
+               init=${x#init=}
+               ;;
+       root=*)
+               ROOT=${x#root=}
+               case $ROOT in
+               LABEL=*)
+                       ROOT="/dev/disk/by-label/${ROOT#LABEL=}"
+                       ;;
+               UUID=*)
+                       ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
+                       ;;
+               /dev/nfs)
+                       BOOT=nfs
+                       ;;
+               esac
+               ;;
+       rootflags=*)
+               ROOTFLAGS="-o ${x#rootflags=}"
+               ;;
+       rootfstype=*)
+               ROOTFSTYPE="${x#rootfstype=}"
+               ;;
+       rootdelay=*)
+               ROOTDELAY="${x#rootdelay=}"
+               ;;
+       loop=*)
+               LOOP="${x#loop=}"
+               ;;
+       loopflags=*)
+               LOOPFLAGS="-o ${x#loopflags=}"
+               ;;
+       loopfstype=*)
+               LOOPFSTYPE="${x#loopfstype=}"
+               ;;
+       cryptopts=*)
+               cryptopts="${x#cryptopts=}"
+               ;;
+       nfsroot=*)
+               NFSROOT="${x#nfsroot=}"
+               ;;
+       netboot=*)
+               NETBOOT="${x#netboot=}"
+               ;;
+       ip=*)
+               IPOPTS="${x#ip=}"
+               ;;
+       boot=*)
+               BOOT=${x#boot=}
+               ;;
+       resume=*)
+               RESUME="${x#resume=}"
+               ;;
+       noresume)
+               NORESUME=y
+               ;;
+       panic=*)
+               panic="${x#panic=}"
+               ;;
+       quiet)
+               quiet=y
+               ;;
+       ro)
+               readonly=y
+               ;;
+       rw)
+               readonly=n
+               ;;
+       debug)
+               debug=y
+               exec >/tmp/initramfs.debug 2>&1
+               set -x
+               ;;
+       debug=*)
+               debug=y
+               set -x
+               ;;
+       break=*)
+               break=${x#break=}
+               ;;
+       break)
+               break=premount
+               ;;
+       esac
+done
+echo 'Mounting Root Filesystem ...'
+. /${BOOT}
+mountroot
+cd ${rootmnt}
+exec chroot . /bin/sh <<EOF
+    mount -t proc /proc /proc
+    mount -t sysfs /sys /sys
+    exec /sbin/init $RUNLEVEL
+EOF
+
diff --git a/platforms/common-yum/initramfs/nand 
b/platforms/common-yum/initramfs/nand
new file mode 100755
index 0000000..c541e48
--- /dev/null
+++ b/platforms/common-yum/initramfs/nand
@@ -0,0 +1,8 @@
+#!/bin/sh
+# nand filesystem mounting               -*- shell-script -*-
+# current is only the hack shell inside the initrd
+
+mountroot ()
+{
+    /bin/sh
+}
diff --git a/platforms/common-yum/initramfs/usb 
b/platforms/common-yum/initramfs/usb
new file mode 100755
index 0000000..7107264
--- /dev/null
+++ b/platforms/common-yum/initramfs/usb
@@ -0,0 +1,76 @@
+#!/bin/bash
+#liveusb filesystem mounting
+
+mountroot()
+{      
+       CFG_FILE=/etc/moblin-initramfs.cfg
+       if [ -f ${CFG_FILE} ]
+       then
+               . ${CFG_FILE}
+       else
+               echo "Did not find config file: ${CFG_FILE}"
+               sleep 5
+       fi
+
+       mkdir -p /container
+       mkdir -p /squashmnt
+       mkdir -p /persistmnt
+
+       # Find the USB flash drive
+       while : ; do   
+               for device in 'sda' 'sdb' 'sdc' 'sdd'; do
+                       echo "checking device /dev/${device} for installation 
source..."
+                       mdev -s
+                       if mount /dev/${device} /mnt
+                       then 
+                               if [ -f /mnt/rootfs.img ] ; then
+                                       echo "Found Boot drive at 
/dev/${device}"
+                                       found="yes"
+                               fi
+                               umount /dev/${device}
+                       fi
+                       if [ "$found" = "yes" ]; then
+                               break;
+                       fi
+                       echo "/dev/${device} does not contain a rootfs"
+               done
+
+               if [ "$found" = "yes" ]; then
+                       break;
+               fi
+               echo "Sleeping for 5 seconds"
+               /bin/sleep 5
+               echo "Sleeping finished"
+       done
+
+       mdev -s
+
+       echo "will mount root from /dev/${device}"
+       mount -o rw /dev/${device} /container 2> /dev/null
+
+       while [ ! -e "/container/rootfs.img" ]; do
+               echo 'wait mounting usb...' 
+               /bin/sleep 1
+               mount -o rw /dev/${device} /container 2> /dev/null
+       done
+
+       mount -o ro,loop -t squashfs /container/rootfs.img /squashmnt
+
+       if [ -f /container/ext3fs.img ]; then
+               mount -o rw,loop,noatime,nodiratime /container/ext3fs.img 
/persistmnt
+       else
+               mount -t tmpfs -o noatime,nodiratime none /persistmnt
+       fi
+       echo ${rootmnt}
+       mount -t unionfs -o dirs=/persistmnt=rw:/squashmnt=ro none ${rootmnt}
+       if [ -f /container/install.sh ]; then
+               mkdir -p ${rootmnt}/tmp/install
+               mount --bind /dev ${rootmnt}/dev
+               mount --bind /sys ${rootmnt}/sys
+               mount --bind /container ${rootmnt}/tmp/install
+               cp /container/install.sh ${rootmnt}
+               cp /container/install.cfg ${rootmnt}
+               chroot ${rootmnt} /install.sh
+       fi
+}
+
diff --git a/platforms/common-yum/install.sh b/platforms/common-yum/install.sh
new file mode 100755
index 0000000..aa62b20
--- /dev/null
+++ b/platforms/common-yum/install.sh
@@ -0,0 +1,255 @@
+#!/bin/bash
+
+# This is the script that will be placed onto the USB flash drive, that will
+# run on bootup to install the software onto the device.
+
+# I want us to error out if we use an undefined variable, so we will catch 
errors.
+set -u
+
+# Read in our config file, if it exists
+if [ -f /install.cfg ]
+then
+    echo "Sourcing ./install.cfg"
+    . /install.cfg
+else
+    echo "ERROR: ./install.cfg not found!"
+    echo "In script: $0 $*"
+    sleep 10
+    halt
+fi
+
+#################### usplash functions start 
####################################
+SPLASHWRITE=0
+# Determine if we have usplash_write available
+type usplash_write > /dev/null 2>&1 && SPLASHWRITE=1
+
+# Disable usplash, since we want text mode
+SPLASHWRITE=0
+
+# show the progress at status bar.
+# $1 = 0-100
+splash_progress(){
+    splash_write "PROGRESS $1"
+    return 0
+}
+# display the text no matter whether verbose is set or not
+splash_display(){
+    echo "$@"
+    splash_write "TEXT-URGENT $@"
+    return 0
+}
+# set the splash delay time
+splash_delay(){
+    splash_write "TIMEOUT $1"
+    return 0
+}
+# call the usplash_write command, if enabled
+splash_write(){
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits

Reply via email to