#!/bin/bash # # /linuxrc: init script to load initrd kernel modules # # # 02-Nov-04 amo Create a minimal initrd.gz to load the rootfs.gz as / # # # Define the path # PATH="/sbin:/bin:/usr/sbin:/usr/bin" # # function docmd { cmd="$1" # echo "" echo "$cmd" $cmd # } # docmd # # # Remove for "chroot xxx /linuxrc" testing # ---------------------------------- # mount -n proc /proc -t proc # # # Load the kernel modules if any # # for module in /lib/modules/`uname -r`/*.*o ; do # insmod $module # done # # # Mount the compact flash ( CF:/boot/rootfs.gz ) # ----------------------------------------------- docmd "mount /dev/hda1 /mnt/hda" # # # for debugging # ------------- # docmd "df" # docmd "ls -laR /dev /mnt" # # # Copy the rootfs ( / ) into memory # --------------------------- # docmd "dd if=/mnt/hda/boot/rootfs of=/dev/ram0 bs=1k" # # unmount the compact flash docmd "umount /dev/hda1" # # # Run linux in /dev/ram # --------------------- # docmd "mount -o rw,remount /dev/ram0 /" # # # Execute from ramdisk ( memory ) # -------------------- # docmd "chroot /" # # # End of file