From 63f15a3047ada562ac258b395948e9051523ff5e Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Tue, 14 Aug 2012 16:03:50 -0500 Subject: [PATCH] mx6q_sabrelite: device now boots, installs, etc... (mmc/serial/ethernet only) Signed-off-by: Robert Nelson --- mk_mmc.sh | 45 ++++++++++++++++++++++++++++++++-------- scripts/debian-finish.sh | 13 +++++++++--- scripts/ubuntu-finish.sh | 13 +++++++++--- 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/mk_mmc.sh b/mk_mmc.sh index 4c1ffa1..dcf4eb7 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -601,19 +601,31 @@ function boot_uenv_txt_template { ;; mx6q_sabrelite) cat >> ${TEMPDIR}/bootscripts/netinstall.cmd <<-__EOF__ + initrd_high=0xffffffff + fdt_high=0xffffffff + dtb_file=${dtb_file} + + xyz_mmcboot=run xyz_load_image; run xyz_load_initrd; run xyz_load_dtb; echo Booting from mmc ... + + deviceargs=setenv device_args + loaduimage=run xyz_mmcboot; run deviceargs; run mmcargs; ${boot} ${kernel_addr} ${initrd_addr}:\${initrd_size} ${dtb_addr} __EOF__ + cat >> ${TEMPDIR}/bootscripts/normal.cmd <<-__EOF__ + initrd_high=0xffffffff + fdt_high=0xffffffff + dtb_file=${dtb_file} + + xyz_mmcboot=run xyz_load_image; run xyz_load_initrd; run xyz_load_dtb; echo Booting from mmc ... + + optargs=VIDEO_CONSOLE + deviceargs=setenv device_args + loaduimage=run xyz_mmcboot; run deviceargs; run mmcargs; ${boot} ${kernel_addr} ${initrd_addr}:\${initrd_size} ${dtb_addr} __EOF__ - cat > ${TEMPDIR}/bootscripts/6q_bootscript.cmd <<-__EOF__ - set bootargs $bootargs video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24 - set bootargs $bootargs video=mxcfb1:dev=ldb,LDBXGA, if=RGB666 - set bootargs $bootargs root=/dev/mmcblk0p1 rootwait fixrtc ; - ext2load mmc 1:1 ${kernel_addr} uImage.net && ext2load mmc 1:1 ${initrd_addr} uInitrd.net && ext2load mmc 1:1 ${dtb_addr} /dtbs/${dtb_file} && bootm ${kernel_addr} ${initrd_addr} ${dtb_addr}; - __EOF__ - cat ${TEMPDIR}/bootscripts/6q_bootscript.cmd - mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "bootscript" -d ${TEMPDIR}/bootscripts/6q_bootscript.cmd ${TEMPDIR}/bootscripts/6q_bootscript + + ;; esac } @@ -1192,6 +1204,18 @@ function populate_boot { echo "-----------------------------" fi + if [ "${boot_scr_wrapper}" ] ; then + cat > ${TEMPDIR}/bootscripts/loader.cmd <<-__EOF__ + echo "boot.scr -> uEnv.txt wrapper..." + setenv boot_fstype ${boot_fstype} + \${boot_fstype}load mmc \${mmcdev}:\${mmcpart} \${loadaddr} uEnv.txt + env import -t \${loadaddr} \${filesize} + run loaduimage + __EOF__ + mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "wrapper" -d ${TEMPDIR}/bootscripts/loader.cmd ${TEMPDIR}/disk/boot.scr + sudo cp -v ${TEMPDIR}/disk/boot.scr ${TEMPDIR}/disk/backup/boot.scr + 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 @@ -1204,7 +1228,6 @@ function populate_boot { echo "-----------------------------" cat ${TEMPDIR}/bootscripts/normal.cmd rm -rf ${TEMPDIR}/bootscripts/normal.cmd || true - cp -v ${TEMPDIR}/bootscripts/* ${TEMPDIR}/disk/ echo "-----------------------------" cp -v "${DIR}/dl/${DISTARCH}/${ACTUAL_DEB_FILE}" ${TEMPDIR}/disk/ @@ -1219,6 +1242,7 @@ function populate_boot { dtb_addr=${dtb_addr} dtb_file=${dtb_file} startup_script=${startup_script} + boot_image=${boot} __EOF__ @@ -1546,6 +1570,7 @@ function check_uboot_type { unset need_dtbs KERNEL_SEL="STABLE" boot="bootz" + unset boot_scr_wrapper case "${UBOOT_TYPE}" in beagle_bx) @@ -1736,6 +1761,7 @@ function check_uboot_type { BOOTLOADER="MX6Q_SABRELITE_D" SERIAL="ttymxc1" is_imx + boot="bootm" USE_UIMAGE=1 unset bootloader_location unset spl_name @@ -1749,6 +1775,7 @@ function check_uboot_type { SERIAL_MODE=1 boot_fstype="ext2" need_dtbs=1 + boot_scr_wrapper=1 startup_script="6q_bootscript" ;; *) diff --git a/scripts/debian-finish.sh b/scripts/debian-finish.sh index 44905ce..656025c 100644 --- a/scripts/debian-finish.sh +++ b/scripts/debian-finish.sh @@ -21,6 +21,10 @@ rm -f /boot/uboot/initrd.net || true rm -f /boot/uboot/boot.scr || true rm -f /boot/uboot/uEnv.txt || true +if [ -f "/boot/uboot/backup/boot.scr" ] ; then + mv /boot/uboot/backup/boot.scr /boot/uboot/boot.scr +fi + if [ -f "/boot/uboot/backup/normal.txt" ] ; then sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/backup/normal.txt sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/backup/normal.txt @@ -31,9 +35,12 @@ fi dpkg -x /boot/uboot/linux-image-*_1.0*_arm*.deb / update-initramfs -c -k `uname -r` -mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uboot/uInitrd -load_addr=$(cat /boot/uboot/SOC.sh | grep load_addr | awk -F"=" '{print $2}') -mkimage -A arm -O linux -T kernel -C none -a ${load_addr} -e ${load_addr} -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uboot/uImage +boot_image=$(cat /boot/uboot/SOC.sh | grep boot_image | awk -F"=" '{print $2}') +if [ "x${boot_image}" == "xbootm" ] ; then + mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uboot/uInitrd + load_addr=$(cat /boot/uboot/SOC.sh | grep load_addr | awk -F"=" '{print $2}') + mkimage -A arm -O linux -T kernel -C none -a ${load_addr} -e ${load_addr} -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uboot/uImage +fi cp /boot/vmlinuz-`uname -r` /boot/uboot/zImage cp /boot/initrd.img-`uname -r` /boot/uboot/initrd.img diff --git a/scripts/ubuntu-finish.sh b/scripts/ubuntu-finish.sh index 757299e..c457f5c 100644 --- a/scripts/ubuntu-finish.sh +++ b/scripts/ubuntu-finish.sh @@ -55,6 +55,10 @@ if [ -f /boot/uboot/backup/u-boot.imx ] ; then dd if=/boot/uboot/backup/u-boot.imx of=/dev/mmcblk0 seek=1 bs=1024 fi +if [ -f "/boot/uboot/backup/boot.scr" ] ; then + mv /boot/uboot/backup/boot.scr /boot/uboot/boot.scr +fi + if [ -f "/boot/uboot/backup/normal.txt" ] ; then sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /boot/uboot/backup/normal.txt sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /boot/uboot/backup/normal.txt @@ -73,9 +77,12 @@ apt-get -y autoremove || true dpkg -x /boot/uboot/linux-image-*_1.0*_arm*.deb / update-initramfs -c -k `uname -r` -mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uboot/uInitrd -load_addr=$(cat /boot/uboot/SOC.sh | grep load_addr | awk -F"=" '{print $2}') -mkimage -A arm -O linux -T kernel -C none -a ${load_addr} -e ${load_addr} -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uboot/uImage +boot_image=$(cat /boot/uboot/SOC.sh | grep boot_image | awk -F"=" '{print $2}') +if [ "x${boot_image}" == "xbootm" ] ; then + mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uboot/uInitrd + load_addr=$(cat /boot/uboot/SOC.sh | grep load_addr | awk -F"=" '{print $2}') + mkimage -A arm -O linux -T kernel -C none -a ${load_addr} -e ${load_addr} -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uboot/uImage +fi cp /boot/vmlinuz-`uname -r` /boot/uboot/zImage cp /boot/initrd.img-`uname -r` /boot/uboot/initrd.img