From 1a72982e160ab633820e4de04023b5a963c2bceb Mon Sep 17 00:00:00 2001 From: Jose V Beneyto Date: Fri, 1 Nov 2013 12:04:59 +0000 Subject: [PATCH] Synced changes with initramfs.git --- Makefile | 1 + filesystem/rc | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3f08178..6f91338 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,7 @@ $(WORK)/initrd.gz: check-root busybox dialog $(WORK)/mnt $(TOPDIR)/filesystem $( install -v -m 0400 $(TOPDIR)/filesystem/shadow $(WORK)/mnt/etc install -v -m 0755 $(TOPDIR)/filesystem/rc $(WORK)/mnt/etc && \ install -v -m 0755 $(TOPDIR)/filesystem/{setup,setup-chroot,crux} $(WORK)/mnt/usr/bin && \ + ln -s bin/busybox $(WORK)/mnt/init /sbin/ldconfig -r $(WORK)/mnt umount -v $(WORK)/mnt cd $(WORK) && gzip -v initrd diff --git a/filesystem/rc b/filesystem/rc index 42b03d9..5b19485 100755 --- a/filesystem/rc +++ b/filesystem/rc @@ -31,7 +31,6 @@ checkReturn() { find_and_mount_media() { echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..." mkdir -p /media - CRUXMEDIA="" MMC_DEVICES="`grep -E 'mmcblk0p' /proc/partitions | awk '{ print $4 }'`" BLOCK_DEVICES="`grep -E '[sh]d' /proc/partitions | awk '{ print $4 }'`" for DEV in $MMC_DEVICES $BLOCK_DEVICES @@ -44,7 +43,6 @@ find_and_mount_media() { if [ -e /media/crux-media ] then echo ", CRUX media." - CRUXMEDIA=$DEV ln -s $DEV /dev/media break else @@ -105,6 +103,26 @@ echo "" exec >/dev/console &1 +# premature mount /proc since we need some rw operations +echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting " +echo -e -n "${BOLD}${GREEN}/proc${NORM}" +mount -t proc proc /proc + +if grep -q "debug" /proc/cmdline +then + DEBUG=1 +fi + +# dont show kernel printk messages +PRINTK="`cat /proc/sys/kernel/printk`" +if [ -z $DEBUG ] +then + echo "0" > /proc/sys/kernel/printk +fi + +echo -e ", ${BOLD}${GREEN}/sys${NORM}." +mount -t sysfs sysfs /sys + echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting filesystems... " mount -a && \ mount -o remount,rw / @@ -141,10 +159,18 @@ echo -e -n " ${BOLD}${BLUE}*${NORM} Saving boot messages... " dmesg > /var/log/boot checkReturn +# run mdev again to fix issues with mmc devices. yeah, it is weird but worked +mdev -s + echo -e " ${BOLD}${BLUE}*${NORM} Trying to find and mount the media installer..." find_and_mount_media -if grep -q debug /proc/cmdline; then +# debug could be necessary when are working with a new device and/or features +# and for a weird reason you can't see any output message on the console. +# You can create a debug.sh script at topdir of your install media and redirect +# the output to a file to inspect later +if [ ! -z $DEBUG ]; +then echo -e -n " ${BOLD}${BLUE}*${NORM} Loading debug script..." /media/debug.sh checkReturn @@ -154,4 +180,7 @@ echo echo "The system is coming up. Please wait." echo +# restore kernel printk status +echo "$PRINTK" > /proc/sys/kernel/printk + # End of file -- 2.26.2