@ -1208,155 +1208,156 @@ populate_boot () {
echo "Populating Boot Partition"
echo "Populating Boot Partition"
echo "-----------------------------"
echo "-----------------------------"
partprobe ${ media }
if [ ! -d ${ TEMPDIR } /disk ] ; then
if [ ! -d ${ TEMPDIR } /disk ] ; then
mkdir -p ${ TEMPDIR } /disk
mkdir -p ${ TEMPDIR } /disk
fi
fi
if mount -t ${ mount_partition_format } ${ media_prefix } 1 ${ TEMPDIR } /disk; then
partprobe ${ media }
mkdir -p ${ TEMPDIR } /disk/backup
if ! mount -t ${ mount_partition_format } ${ media_prefix } 1 ${ TEMPDIR } /disk; then
mkdir -p ${ TEMPDIR } /disk/dtbs
echo "-----------------------------"
echo " Unable to mount ${ media_prefix } 1 at ${ TEMPDIR } /disk to complete populating Boot Partition "
echo "Please retry running the script, sometimes rebooting your system helps."
echo "-----------------------------"
exit
fi
if [ ! " ${ bootloader_installed } " ] ; then
mkdir -p ${ TEMPDIR } /disk/backup || true
if [ " ${ spl_name } " ] ; then
mkdir -p ${ TEMPDIR } /disk/dtbs || true
if [ -f ${ TEMPDIR } /dl/${ MLO } ] ; then
cp -v ${ TEMPDIR } /dl/${ MLO } ${ TEMPDIR } /disk/${ spl_name }
cp -v ${ TEMPDIR } /dl/${ MLO } ${ TEMPDIR } /disk/backup/${ spl_name }
echo "-----------------------------"
fi
fi
if [ " ${ boot_name } " ] ; then
if [ ! " ${ bootloader_installed } " ] ; then
if [ -f ${ TEMPDIR } /dl/${ UBOOT } ] ; then
if [ " ${ spl_name } " ] ; then
cp -v ${ TEMPDIR } /dl/${ UBOOT } ${ TEMPDIR } /disk/${ boot_name }
if [ -f ${ TEMPDIR } /dl/${ MLO } ] ; then
cp -v ${ TEMPDIR } /dl/${ UBOOT} ${ TEMPDIR } /disk/backup/${ boot _name}
cp -v ${ TEMPDIR } /dl/${ MLO } ${ TEMPDIR } /disk/${ spl_name }
echo "-----------------------------"
cp -v ${ TEMPDIR } /dl/${ MLO } ${ TEMPDIR } /disk/backup/${ spl_name }
fi
echo "-----------------------------"
fi
fi
fi
fi
if [ -f ${ TEMPDIR } /kernel/boot/vmlinuz-* ] ; then
if [ " ${ boot_name } " ] ; then
LINUX_VER = $( ls ${ TEMPDIR } /kernel/boot/vmlinuz-* | awk -F'vmlinuz-' '{print $2}' )
if [ -f ${ TEMPDIR } /dl/${ UBOOT } ] ; then
echo "Copying Kernel images:"
cp -v ${ TEMPDIR } /dl/${ UBOOT } ${ TEMPDIR } /disk/${ boot_name }
mkimage -A arm -O linux -T kernel -C none -a ${ conf_zreladdr } -e ${ conf_zreladdr } -n ${ LINUX_VER } -d ${ TEMPDIR } /kernel/boot/vmlinuz-* ${ TEMPDIR } /disk/uImage.net
cp -v ${ TEMPDIR } /dl/${ UBOOT } ${ TEMPDIR } /disk/backup/${ boot_name }
cp -v ${ TEMPDIR } /kernel/boot/vmlinuz-* ${ TEMPDIR } /disk/zImage.net
echo "-----------------------------"
cp -v ${ TEMPDIR } /kernel/boot/vmlinuz-* ${ TEMPDIR } /disk/${ fki_vmlinuz }
echo "-----------------------------"
fi
if [ -f ${ TEMPDIR } /initrd.mod.gz ] ; then
#This is 20+ MB in size, just copy one..
echo "Copying Kernel initrds:"
if [ ${ mkimage_initrd } ] ; then
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ${ TEMPDIR } /initrd.mod.gz ${ TEMPDIR } /disk/uInitrd.net
else
cp -v ${ TEMPDIR } /initrd.mod.gz ${ TEMPDIR } /disk/initrd.net
fi
fi
echo "-----------------------------"
fi
fi
fi
if [ " ${ ACTUAL_DTB_FILE } " ] ; then
if [ -f ${ TEMPDIR } /kernel/boot/vmlinuz-* ] ; then
echo "Copying Device Tree Files:"
LINUX_VER = $( ls ${ TEMPDIR } /kernel/boot/vmlinuz-* | awk -F'vmlinuz-' '{print $2}' )
if [ " x ${ conf_boot_fstype } " = "xfat" ] ; then
echo "Copying Kernel images:"
tar xfvo " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DTB_FILE } " -C ${ TEMPDIR } /disk/dtbs
mkimage -A arm -O linux -T kernel -C none -a ${ conf_zreladdr } -e ${ conf_zreladdr } -n ${ LINUX_VER } -d ${ TEMPDIR } /kernel/boot/vmlinuz-* ${ TEMPDIR } /disk/uImage.net
else
cp -v ${ TEMPDIR } /kernel/boot/vmlinuz-* ${ TEMPDIR } /disk/zImage.net
tar xfv " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DTB_FILE } " -C ${ TEMPDIR } /disk/dtbs
cp -v ${ TEMPDIR } /kernel/boot/vmlinuz-* ${ TEMPDIR } /disk/${ fki_vmlinuz }
fi
echo "-----------------------------"
cp -v " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DTB_FILE } " ${ TEMPDIR } /disk/
fi
echo "-----------------------------"
fi
if [ " ${ conf_uboot_bootscript } " ] ; then
if [ -f ${ TEMPDIR } /initrd.mod.gz ] ; then
cat > ${ TEMPDIR } /bootscripts/loader.cmd <<-__EOF__
#This is 20+ MB in size, just copy one..
echo " ${ conf_uboot_bootscript } -> uEnv.txt wrapper... "
echo "Copying Kernel initrds:"
#boundarydevices.com uses disk over mmcdev
if [ ${ mkimage_initrd } ] ; then
if test -n \$ disk; then
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ${ TEMPDIR } /initrd.mod.gz ${ TEMPDIR } /disk/uInitrd.net
setenv mmcdev \$ disk
else
setenv mmcpart 1
cp -v ${ TEMPDIR } /initrd.mod.gz ${ TEMPDIR } /disk/initrd.net
fi
${ conf_fileload } mmc \$ { mmcdev} :\$ { mmcpart} \$ { loadaddr} uEnv.txt
env import -t \$ { loadaddr} \$ { filesize}
run uenvcmd
__EOF__
cat ${ TEMPDIR } /bootscripts/loader.cmd
echo "-----------------------------"
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "wrapper" -d ${ TEMPDIR } /bootscripts/loader.cmd ${ TEMPDIR } /disk/${ conf_uboot_bootscript }
cp -v ${ TEMPDIR } /disk/${ conf_uboot_bootscript } ${ TEMPDIR } /disk/backup/${ conf_uboot_bootscript }
fi
fi
echo "Copying uEnv.txt based boot scripts to Boot Partition"
echo "Net Install Boot Script:"
cp -v ${ TEMPDIR } /bootscripts/netinstall.cmd ${ TEMPDIR } /disk/uEnv.txt
echo "-----------------------------"
cat ${ TEMPDIR } /bootscripts/netinstall.cmd
rm -rf ${ TEMPDIR } /bootscripts/netinstall.cmd || true
echo "-----------------------------"
echo "-----------------------------"
echo "Normal Boot Script:"
fi
cp -v ${ TEMPDIR } /bootscripts/normal.cmd ${ TEMPDIR } /disk/backup/normal.txt
if [ " ${ ACTUAL_DTB_FILE } " ] ; then
echo "Copying Device Tree Files:"
if [ " x ${ conf_boot_fstype } " = "xfat" ] ; then
tar xfvo " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DTB_FILE } " -C ${ TEMPDIR } /disk/dtbs
else
tar xfv " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DTB_FILE } " -C ${ TEMPDIR } /disk/dtbs
fi
cp -v " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DTB_FILE } " ${ TEMPDIR } /disk/
echo "-----------------------------"
echo "-----------------------------"
cat ${ TEMPDIR } /bootscripts/normal.cmd
fi
rm -rf ${ TEMPDIR } /bootscripts/normal.cmd || true
if [ " ${ conf_uboot_bootscript } " ] ; then
cat > ${ TEMPDIR } /bootscripts/loader.cmd <<-__EOF__
echo " ${ conf_uboot_bootscript } -> uEnv.txt wrapper... "
#boundarydevices.com uses disk over mmcdev
if test -n \$ disk; then
setenv mmcdev \$ disk
setenv mmcpart 1
fi
${ conf_fileload } mmc \$ { mmcdev} :\$ { mmcpart} \$ { loadaddr} uEnv.txt
env import -t \$ { loadaddr} \$ { filesize}
run uenvcmd
__EOF__
cat ${ TEMPDIR } /bootscripts/loader.cmd
echo "-----------------------------"
echo "-----------------------------"
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "wrapper" -d ${ TEMPDIR } /bootscripts/loader.cmd ${ TEMPDIR } /disk/${ conf_uboot_bootscript }
cp -v ${ TEMPDIR } /disk/${ conf_uboot_bootscript } ${ TEMPDIR } /disk/backup/${ conf_uboot_bootscript }
fi
cp -v " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DEB_FILE } " ${ TEMPDIR } /disk/
echo "Copying uEnv.txt based boot scripts to Boot Partition"
cp -v ${ TEMPDIR } /kernel/${ linux_version } -modules.tar.gz ${ TEMPDIR } /disk/
echo "Net Install Boot Script:"
cp -v ${ TEMPDIR } /bootscripts/netinstall.cmd ${ TEMPDIR } /disk/uEnv.txt
#This should be compatible with hwpacks variable names..
echo "-----------------------------"
#https://code.launchpad.net/~linaro-maintainers/linaro-images/
cat ${ TEMPDIR } /bootscripts/netinstall.cmd
cat > ${ TEMPDIR } /disk/SOC.sh <<-__EOF__
rm -rf ${ TEMPDIR } /bootscripts/netinstall.cmd || true
#!/bin/sh
echo "-----------------------------"
format = 1.0
echo "Normal Boot Script:"
board = ${ conf_board }
cp -v ${ TEMPDIR } /bootscripts/normal.cmd ${ TEMPDIR } /disk/backup/normal.txt
echo "-----------------------------"
bootloader_location = ${ bootloader_location }
cat ${ TEMPDIR } /bootscripts/normal.cmd
dd_spl_uboot_seek = ${ dd_spl_uboot_seek }
rm -rf ${ TEMPDIR } /bootscripts/normal.cmd || true
dd_spl_uboot_bs = ${ dd_spl_uboot_bs }
echo "-----------------------------"
dd_uboot_seek = ${ dd_uboot_seek }
dd_uboot_bs = ${ dd_uboot_bs }
conf_bootcmd = ${ conf_bootcmd }
boot_fstype = ${ conf_boot_fstype }
serial_tty = ${ SERIAL }
loadaddr = ${ conf_loadaddr }
initrdaddr = ${ conf_initrdaddr }
zreladdr = ${ conf_zreladdr }
fdtaddr = ${ conf_fdtaddr }
fdtfile = ${ conf_fdtfile }
usbnet_mem = ${ usbnet_mem }
cp -v " ${ DIR } /dl/ ${ DISTARCH } / ${ ACTUAL_DEB_FILE } " ${ TEMPDIR } /disk/
cp -v ${ TEMPDIR } /kernel/${ linux_version } -modules.tar.gz ${ TEMPDIR } /disk/
__EOF__
#This should be compatible with hwpacks variable names..
#https://code.launchpad.net/~linaro-maintainers/linaro-images/
cat > ${ TEMPDIR } /disk/SOC.sh <<-__EOF__
#!/bin/sh
format = 1.0
board = ${ conf_board }
echo "Debug:"
bootloader_location = ${ bootloader_location }
cat ${ TEMPDIR } /disk/SOC.sh
dd_spl_uboot_seek = ${ dd_spl_uboot_seek }
dd_spl_uboot_bs = ${ dd_spl_uboot_bs }
dd_uboot_seek = ${ dd_uboot_seek }
dd_uboot_bs = ${ dd_uboot_bs }
echo "Debug: Adding Useful scripts from: https://github.com/RobertCNelson/tools"
conf_bootcmd = ${ conf_bootcmd }
echo "-----------------------------"
boot_fstype = ${ conf_boot_fstype }
mkdir -p ${ TEMPDIR } /disk/tools
git clone git://github.com/RobertCNelson/tools.git ${ TEMPDIR } /disk/tools || true
echo "-----------------------------"
cd ${ TEMPDIR } /disk
serial_tty = ${ SERIAL }
sync
loadaddr = ${ conf_loadaddr }
cd " ${ DIR } " /
initrdaddr = ${ conf_initrdaddr }
zreladdr = ${ conf_zreladdr }
fdtaddr = ${ conf_fdtaddr }
fdtfile = ${ conf_fdtfile }
echo "Debug: Contents of Boot Partition"
usbnet_mem = ${ usbnet_mem }
echo "-----------------------------"
ls -lh ${ TEMPDIR } /disk/
echo "-----------------------------"
umount ${ TEMPDIR } /disk || true
__EOF__
echo "Debug:"
cat ${ TEMPDIR } /disk/SOC.sh
echo "Debug: Adding Useful scripts from: https://github.com/RobertCNelson/tools"
echo "-----------------------------"
mkdir -p ${ TEMPDIR } /disk/tools
git clone git://github.com/RobertCNelson/tools.git ${ TEMPDIR } /disk/tools || true
echo "-----------------------------"
cd ${ TEMPDIR } /disk
sync
cd " ${ DIR } " /
echo "Debug: Contents of Boot Partition"
echo "-----------------------------"
ls -lh ${ TEMPDIR } /disk/
echo "-----------------------------"
umount ${ TEMPDIR } /disk || true
echo "Finished populating Boot Partition"
echo "-----------------------------"
echo "Finished populating Boot Partition"
echo "-----------------------------"
else
echo "-----------------------------"
echo " Unable to mount ${ media_prefix } 1 at ${ TEMPDIR } /disk to complete populating Boot Partition "
echo "Please retry running the script, sometimes rebooting your system helps."
echo "-----------------------------"
exit
fi
echo "mk_mmc.sh script complete"
echo "mk_mmc.sh script complete"
echo " Script Version git: ${ GIT_VERSION } "
echo " Script Version git: ${ GIT_VERSION } "
echo "-----------------------------"
echo "-----------------------------"