Add new comment

How to make custom Nook HD stock images

I've been working on various Nook HD/HD+ improvements lately and wanted to capture some instructions here so that people are able to do some of this stuff by themselves as the need arises.

B&N Nook HD and Nook HD+

I have a script that automates creation of sdcard images from B&N update zips (only tested on 2.1.x images so far) and also creates unlocked boot images to be usd for stock installs in internal memory.

To use the script you will need to have a Linux install that has mkimage and mkbootimg tools available. You will also need the script. And don't forget an update file for the version of Nook software you want to modify, get them from B&N Nook support page, they are the files that end with .npk.

You will also need "master keys" for the Nook HD+ and the Nook HD, but only if you plan to make modifications (or rooted images) for internal memory installs. Also modify STOCK_MASTER_KEY variable in the script to point at them.

  1. Create a directory in /tmp where you will be working, e.g. mkdir /tmp/repack
  2. cd /tmp/repack
  3. now unpack the update file: unzip /home/green/diskimages/NookHD+/nookhd_2_1_1_update.npk
  4. now run my script: ~/ (you can also add "nosdcard" parameter if you do not want sdcard-installable zip to be created)
  5. If all is well, the script will create two files: /tmp/ and where TARGET is either hummingbird for NookHD or ovation for Nook HD+ and VERSION is the update version number (all determined from the unpacked update content automatically)

The nookhd-unlocked-stock-emmc* files are for you to flash onto internal storage to gain root, see the script contents if you need to actually modify generated ramdisk in addition to disabling secure checks.

The nookhd-stock-sdcard* files you can install onto sdcard if you just need stock rarely and prefer to have CM or something else on the internal storage. (SDCard flashing instructions)

Here's the script content (Download script):


if [ ! -f system/build.prop ] ; then
    echo Run me in the root of unpacked stock zip!

BOARD=$(grep ro.product.device= system/build.prop | sed 's/ro.product.device=//' )
SVERSION=$(grep system/build.prop | sed 's/' )
STOCK_MASTER_KEY=~green/nookhd/stock-key.$BOARD boot.img
dd if=boot.img-kernel.gz of=/tmp/extracted-kernel bs=2368 skip=1
cat boot.img-ramdisk/default.prop | sed 's/secure=1/secure=0/' | sed 's/able=0/able=1/' | sed 's/=mtp$/=mtp,adb/' > ttt.temp
mv -f ttt.temp boot.img-ramdisk/default.prop
cd boot.img-ramdisk
# Unsecure build
rm manifest
touch manifest
find . | cpio -ov -H newc | gzip -9c > /tmp/unsecured-ramdisk.gz
cat init.omap4${BOARD}board.rc | sed 's/platform\/omap\/omap_hsmmc.1\/by-name\/system/mmcblk1p2/' | sed 's/platform\/omap\/omap_hsmmc.1\/by-name\/userdata/mmcblk1p3/' > ttt.temp
mv -f ttt.temp init.omap4${BOARD}board.rc
chmod +x init.omap4${BOARD}board.rc
find . | cpio -ov -H newc | gzip -9c > /tmp/unsecured-ramdisk-sdcard.gz
mkimage -A ARM -T RAMDisk -n Image -a 0x83000000 -C none -d /tmp/unsecured-ramdisk-sdcard.gz /tmp/unsecured-ramdisk-sdcard.ub
rm /tmp/unsecured-ramdisk-sdcard.gz
mkimage -A ARM -O linux -T kernel -C none -a 0x80010120 -e 0x80010120 -n kernel -d /tmp/extracted-kernel /tmp/kernel.ub
cd ..
mkbootimg --kernel /tmp/extracted-kernel --ramdisk /tmp/unsecured-ramdisk.gz --pagesize 4096 --base 0x80008120 --cmdline "androidboot.console=ttyO0 console=ttyO0,115200n8 vmalloc=768M init=/init rootwait omap_wdt.timer_margin=20" --ramdisk_offset 0xfffee0 -o /tmp/unsecured-kernel.fb
#rm -rf /tmp/extracted-kernel /tmp/unsecured-ramdisk.gz
cp $STOCK_MASTER_KEY /tmp/boot.img
dd if=/tmp/unsecured-kernel.fb of=/tmp/boot.img bs=1024k seek=1
rm -rf /tmp/unsecured-kernel.fb

mkdir -p emmc-kernel-zip/META-INF/com/google/android
cp META-INF/com/google/android/update-binary emmc-kernel-zip/META-INF/com/google/android/update-binary
mv /tmp/boot.img emmc-kernel-zip/boot.img

# Generate the updater script
cat > emmc-kernel-zip/META-INF/com/google/android/updater-script <<EOF
assert(getprop("ro.product.device") == "$BOARD" || getprop("")
== "$BOARD");
assert(package_extract_file("boot.img", "/tmp/boot.img"), run_program("/sbin/busybox", "dd", "if=/tmp/boot.img", "of=/dev/block/platform/omap/omap_hsmmc.1/by-name/boot", "bs=1048576"), delete("/tmp/boot.img"));


cd emmc-kernel-zip
zip -9 -r ../../nookhd-unlocked-stock-emmc-${BOARD}-${SVERSION}.zip *
cd ..
rm -rf emmc-kernel-zip

if [ "$1" == "nosdcard" ] ; then
cat META-INF/com/google/android/updater-script | sed 's/platform\/omap\/omap_hsmmc.1\/by-name\/system/mmcblk1p2/' | sed 's/ext4", "EMMC", "\/dev\/block\/platform\/omap\/omap_hsmmc.1\/by-name\/factory/vfat", "EMMC", "\/dev\/block\/mmcblk1p1/' | sed 's/\/factory/\/boot/' | sed 's/' | sed 's/' | grep -v '\(MLO\)\|\(u-boot.bin\)\|\(boot.img\)\|\(recovery.img\)' > ttt.temp
mv -f ttt.temp META-INF/com/google/android/updater-script
mv /tmp/unsecured-ramdisk-sdcard.ub ramdisk
mv /tmp/kernel.ub kernel

if [ ! -f kernel ] ; then
   echo Failed to create kernel, make sure you have mkimage in PATH
   exit 1

if [ ! -f ramdisk ] ; then
   echo Failed to create ramdisk, make sure you have cpio and mkimage in path
   exit 1

rm -rf MLO recovery.img boot.img u-boot.bin
rm -rf boot.img-kernel.gz boot.img-ramdisk.cpio.gz boot.img-ramdisk
zip -9 -r /tmp/nookhd-stock-sdcard-${BOARD}-${SVERSION}.zip *

And that was it, enjoy.


Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <p>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.