Beaglebone Black init script for Initramfs

47 views
Skip to first unread message

Maurya

unread,
Oct 25, 2019, 2:39:36 AM10/25/19
to beagl...@googlegroups.com
Hi,

I want to run initramfs to update emmc if image available au usb storage device script as follow

///////////////////////////////Installer.sh/////////////////////////////////////

#!/bin/sh

emmc="/dev/mmcblk1"
bootpart="p1"
mpoint="";

usbdev="/dev/sda1"
egiimage="/mnt/egi/sdcard.img.bz2"
echo "egiimage=$egiimage"

if ! [ -b "$usbdev" ]
then
echo "USB Block Device not found!! $usbdev"
exit 3
else
mount /dev/sda1 /mnt/egi/
if ! [ -e "$egiimage" ]
then
umount /mnt/egi
echo "Egi Image not found!!"
exit 3

fi
fi

if [ -b "$emmc" ]
then
echo "SD card detected!!"
#dd if=$egiimage of=/dev/mmcblk1
mpoint="/dev/mmcblk1"
else
echo "SD card not detected!!"
#dd if=$egiimage of=/dev/mmcblk0
mpoint="/dev/mmcblk0"
fi

# led blink logic
bzcat $egiimage | dd of=$mpoint

////////////////////////////////////////////////////////////////////////////

Above script tested and working fine when running from command line 

For root file system I refer https://embedjournal.com/custom-rfs-beaglebone-black/

whereas I used my busybox  and cross compiler which is used to build kernel uImage.

I created soft link init in / to /bin/busybox

and added above script .Installer.sh to etc/inittab as:
----------------------------------------------------------------
null::sysinit:/bin/mount -a
null::sysinit:/bin/hostname -F /etc/hostname
null::respawn:/bin/cttyhack /bin/login root
null::restart:/sbin/reboot
null::wait:/root/Installer.sh

-------------------------------------------------------------

When usb is not connected and power up board it will be hanged at:

Freeing init memory: 8416K

My expectation is call main rootfs from /dev/mmcblk0p2 but it hangs. Even if I comment Installer.sh from etc/inittab it keep hanging.

I guess my procedure is wrong. please anyone suggest how to do it.







Reply all
Reply to author
Forward
0 new messages