Or Continue to Thread: NT: Build root filesystem
Find Your Device:
21st June 2011, 06:00 PM
jocala's Avatar
OP Senior Member
Flag Ocala
Thanks Meter: 2,098
 
2,359 posts
Join Date:Joined: Jul 2010
Donate to Me
More
NT: Build root filesystem
Extracting the N2 root filesystem and adding rc.local

These instructions assume using a linux console.

The root filesystem lives in a u-boot/PPCboot ramdisk. These instructions tell you how to extract it.

Boot your nt with the "rooted forever" sdcard while connected with usb.

Make a copy of the boot partition. After this you may reboot your nt normally.

$ tar -cf boot.tar boot/

$ tar xvf boot.tar

$ cd boot

Extract the uRamdisk file. first 64 bytes is the u-boot header, we need to skip it.

$ dd if=URamdisk bs=64 skip=1 of=ramdisk.gz

ramdisk.gz now contains the root file system.

Copy ramdisk.gz to a work directory, then extract it:

gunzip -v ramdisk.gz
cpio -iv < ramdisk


The root file system will populate your work dir. Delete the ramdisk file. You can now make changes to the root file system.

The change I'm going to make is a simple one: adding the ability to run an rc.local file at boot.

edit the init.rc file in your work directory, adding at the bottom:

Code:
service rclocal /etc/rc.local
    enabled
    user root
    oneshot
rebuilding the uRamdisk file is simple, once you know how (thanks to JesusFreke for pointing me in the right direction). cd into your working directory, issue these commands:

Code:
find . -regex "./.*"| cpio -ov -H newc | gzip > ../ramdisk.gz 
mkimage  -A ARM -T RAMDisk -n Image -d ../ramdisk.gz ../uRamdisk
A script with the the commands above is attached. Also attached is a rooted uRamdisk with the rc.local ability already build in. To replace the uRamdisk file, boot with your "Rooted Forever" sdcard, and copy the uRamdisk file to the nook's boot directory.

What's this good for? That's up to you. I'm using it to automatically start dropbear so I can ssh in my Nooks and also use rsync to keep them synced with my ebook library. This is also one of the steps in building a kernel for the Nook ST.
Attached Files
File Type: zip mkuramdisk.zip - [Click for QR Code] (287 Bytes, 75 views)
File Type: zip uRamdisk.zip - [Click for QR Code] (181.9 KB, 81 views)
Last edited by jocala; 23rd June 2011 at 03:06 AM.
The Following 2 Users Say Thank You to jocala For This Useful Post: [ View ]