[HD2 Android Q&A, Help & Troubleshooting and Genera] HypoTurtle:
Are you sure? Only issue is NAND/DataOnExt with 2.6.x as nand boot partition is typically only 5/6MB.

Magldr boot partition can be flashed with raw image just as with clk (the partition itself might need to be reformatted first) - would flashing boot with boot.img (with offset set in mkbootimg cmdline) over come that...

The hd commands I posted should be fine - I was expecting just one value to be reported but got those two from the 3.0 kernels I checked.

The magldr check is already there (as != clk) later on >> 6MB is only in the magldr section

This would be the single script (nativesd.sh combined with the mount-type.sh's)

#!/sbin/sh

## Bootloader check (copy of checksys.sh)
echo "bootloader=MAGLDR" > /tmp/nfo.prop

output=`grep -i "clk" /proc/cmdline`
if [ -n "$output" ]; then
echo "bootloader=cLK" > /tmp/nfo.prop
fi
mkdir /NativeSD
if [ -f "/tmp/Rname.prop" ]; then
ROM_NAME='cat Rname.prop'
mount -t ext4 /dev/block/mmcblk0p2 /NativeSD
mount --bind /NativeSD/${ROM_NAME}/system /system
else
ROM_NAME=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF-1)}' | sed 's/\(\[\|\]\)//g' `
fi

mkdir /boot
mkdir /boot_dir
mount --bind /sdcard/NativeSD /boot_dir
mount --bind /sdcard/NativeSD/${ROM_NAME} /boot

## Exporting variables

type=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF)}' | sed 's/\(\[\|\]\)//g' `
bootloader=` cat '/tmp/nfo.prop' | sed 's/bootloader=//g' `

## Changing install_type to numbered value
if [ ${type}='NAND' ]; then
install_type='1'
fi
if [ ${type}='DataOnExt' ]; then
install_type='2'
fi
if [ ${type}='NativeSD' ]; then
install_type='3'
fi
if [ ${type}='DirectSD' ]; then
install_type='4'
fi

## Copying zImage from /boot_dir if one wasn't added to zip
if [ ! -f "/tmp/zImage" ]; then
cp /boot/zImage/ /tmp/zImage
fi
if [ ! -f "/tmp/initrd.gz" ]; then
cp /boot/initrd.gz/ /tmp/initrd.gz
fi

## Checking if zImage is for 3.0.x
if [ `hd /tmp/zImage | grep '1f 8b 08' | cut -d ' ' -f '1'` == `'00003f80' || '00003f70'` ]; then
dd if=/dev/zero of=/tmp/6MB bs=1M count=6
fi

DataOnExtmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
NativeSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/system /system
/bin/busybox mount --bind /NativeSD/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
direct=`mount | grep mmcblk0p3 | grep ext4`
if [ -n "$direct" ]; then
DirectSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t ext4 -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t ext4 -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
else
DirectSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t ext4 -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t f2fs -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
fi

if [ ! -f /tmp/mount-${type}.sh ]; then
cat ${${type}mount} > /tmp/mount-${type}.sh
fi

## Setting up working directory
cp /tmp/initrd.gz /tmp/initrd-${ROM_NAME}.gz
mkdir -p /tmp/work
cd /tmp/work

## Unzipping nand kernel
gzip -d -c ../initrd-${ROM_NAME}.gz | cpio -i -d
mkdir bin
cp /tmp/busybox bin/busybox
cp /tmp/e2fsck bin/e2fsck
cp /tmp/mountfs-${type}.sh mountfs-${type}.sh
chmod 0777 mountfs-${type}.sh
chmod 0777 bin/busybox
chmod 0777 bin/e2fsck

## Modifying ramdisk to not use yaffs, and use sd partitions instead.
if [ "${install_type}" -gt 2 ]; then
sed -i '/mtd@misc/s/^/#/' ueventd.htcleo.rc
sed -i '/mount yaffs2/s/^/#/
s/# #/# /g' init.rc
sed -i "s/rOm/$ROM_NAME/g" mountfs-${type}.sh
fi

## Checking if anything other than nand is to be installed
if [ "${install_type}" -gt 1 ]; then
sed -i '/on fs/ a exec /mountfs-'${type}'.sh' init.rc
sed -i "s/rOm/$ROM_NAME/g" mountfs-${type}.sh
chmod 0750 init.rc
chmod 0644 ueventd.htcleo.rc
fi

# Building new ramdisk
find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
cd ..

# Checking bootloader
if [ "${bootloader}" != "cLK" ]; then
cat initrd-done.gz >> 6MB
cp 6MB /boot/initrd.gz
cp /tmp/zImage /boot/zImage
#Checking if nand install
if [ "${install_type}" -gt 2 ]; then
cp 6MB /boot_dir/initrd.gz
cp /tmp/zImage /boot_dir/zImage
fi
else
cp initrd-done.gz /tmp/initrd.gz
chmod 0755 /tmp/mkbootimg
chmod 0755 /tmp/mkbootimg.sh
exec /tmp/mkbootimg.sh
if [ "${install_type}" -lt 3 ]; then
flash_image boot /tmp/boot.img else
flash_image sboot /tmp/boot.img
fi
fi

cp /tmp/initrd-$ROM_NAME.gz /tmp/initrd.gz
rm -r /tmp/work/*