Copyright K.Unsworth and Unicorn Publications International 1990-2013 All Rights Reserved. Terms and Conditions.

My Emprex NSD-100 hack

How to get “Pale Inside” firmware into an Emprex NSD-100 printer server.


This will allow you to run Debian (etch) in tandem with the internal apps. You can even VNC to a GUI desktop.


All YOU need to do is reflash your firmware with this image


Click the image for the hex file to reflash your NDS-100


And add the “boot” script to the public share.

use-this-one-V03R14_pale.bin

A sample boot file ( Save the file , don’t cut/paste)


If you cut and paste the "boot" file in windows you will have a file with CR at the end of the lines that will stop it working


don't forget to "chmod 755 boot" to set the permissions needed.

The full details and more at


emprex.codejs.com


This is how it is done ( from my crib notes ). It looks quite straight forwards , and it is, but it took quite a bit of time and reading of other web sites. thanks to http://tinyhack.com/ for the info on how to find the start of the ramdisc. The guy at tinynack has done far more with a similar device, and this place http://emprex-nas.blogspot.co.uk/2008/08/installing-debian-in-nsd-100.html for getting me going with telnet and debian.


***********************************************

On a windows PC


load V03R14_eon.bin into hex editor . I use "hex editor neo" ( demo lasts 14 days )


search for 1f 8b 08 ,this is the header of a gzip archive. ( search in hex not ascii )


found at two places, cut at 2nd 0x0017af34 just before it says ramdisk ,cut right to the end of the file. The ramdisk isn't as big as this but when we open it up the extra bit will be left.


save as file ending in gz ie ramdiskfs.gz


I opened this file with winrar


http://www.rarlab.com/


you get a file called ramdisk ,extract and save it to a file called ramdisk some where on your pc.


with your nsd100 running and your pc looking at the samba share "public" copy to "public"


on the nsd100 this will be in

/mnt/data/public


Now login to the nsd100 via telnet

type


mknod /dev/loop0 b 7 0

mkdir /mnt/ram

mount -o loop /mnt/data/public/ramdisk /mnt/ram


edit /mnt/ram/etc/init.d/rc.sysinit ( I did this across samba as I have a share on the root and use SCiTE http://www.scintilla.org to edit the file as this does not create CR at the end of the line )


add


#start telnet demon

echo "pts/0" >> /etc/securetty

/usr/sbin/telnetd


#wait 15 seconds

sleep 15

#run script boot in public


/mnt/data/public/boot



just before this line at the end


/bin/echo "Sysinit done"


save file



umount /mnt/ram

( need to be out of /ram directory to do this.just type cd /)


cd /mnt/data/public

gzip ramdisk


to recompress. it takes 5 minutes or so just watch the telnet session for your cursor to come back. I did this on the nsd100 as I knew it would be able to decompress it later when it boots . dont do it in winrar the compression is the wrong type and will brick your nsd100.


this makes ramdisk.gz


on the windows pc copy the ramdisk.gz file back to the pc


paste this back into the flash image with hex edit neo


make sure the paste goes in at address 0x0017af34 starting with 1f 8b 08 00


and the end bytes of what you are pasting are 00 00 40 01 ( my image was abit smaller than the original )


save flash image . as V03R14_new.bin



reflash device with new patched image using the update firmware page on the nsd100 web interface.

this takes a few minutes.


it will reboot its self , you config should stay , IP address etc.


on the public share you need to add the script file "boot" . When the nsd100 boots it will look for this and run it.


here is mine


#!/bin/sh

#echo "pts/0" >> /etc/securetty

#/usr/sbin/telnetd

/mnt/data/public/debian/usr/sbin/chroot /mnt/data/public/debian /etc/init.d/ssh start


/mnt/data/public/debian/usr/sbin/chroot /mnt/data/public/debian lighttpd -f /etc/lighttpd/lighttpd.conf


/usr/sbin/setled --buzzer=1 >/dev/null

/usr/sbin/setled --buzzer=1 >/dev/null

/usr/sbin/setled --buzzer=1 >/dev/null


you dont need the telnet bit anymore as this is in the rc.sysinit.


the ssh bit and lighttpd bit are to do with debian ignore them at the moment I will do another post about them later.


the buzzer bit buzzes the buzzer 3 times when all is done to let you know it has run.


this script must have root privileges


once made go to telnet and type


chmod 755 /mnt/data/public/boot


Enjoy



Pale

How It Was Done

For the debian install see


http://emprex-nas.blogspot.co.uk/2008/08/installing-debian-in-nsd-100.html   or here