View Single Post
Posts: 502 | Thanked: 366 times | Joined on Jun 2010 @ /dev/null
#10
I thought I saw there was a thread for this and it was by kingoddball but I guess I could have been completely mistaken. I have created a pwnieexpress chroot just a moment ago and I now I would like to share with the rest of the community.

Because most of what I have wrote in my second post on this thread covers all the initial areas of what you will need to do to create a chroot `container' in the first place. I will not bother re-documenting the whole thing again.

There are however ways to create a 4GB `container' without having to do excessive I/O thrashing on your poor N900. On a linux PC with say more than 4.5GB spare space (flash drives can also suffice here) you can either repartition the spare space as a temporary partition with FAT32 or if the partition is FAT32 you just need to create the `container' within that FAT32 partition and wait for the message to say `file too large' from dd. Once you have created the 4GB.img `container' for instance, you can simply compress it with say something like lzma to make the image really small. From there on you can copy the 4GB.img.lzma into various filenames of your choice as you already have a the generic `container' made.

Also creating the whole chroot can be done from the computer, though you cannot test it from your computer as the binaries are obviously compiled for ARM platform.

Now because I won't cover creating `containers' and you have ext2 `container' ready to use. We shall get right into extracting contents of pwnieexpress images into that `container' (obviously you would also need to mount the `container' as well).

For my convenience sake, you should do the whole thing as root.

First extract the contents of the tarball from their website (hosted by github ironically):
Code:
tar -zxvf pwnphone_image-7.6.2011.tar.gz
Once extracted you have two directories, one named pwnimage and the other systemBackups. Seeing that it has systemBackups directory it would be safe for one to assume that the normal (desirable) install would be to use the backupmenu route. In this case we prefer pwnieexpress to be running within the chroot environment.

We extract the contents of rootfs and optfs from the pwnieexpress's systemBackups directory into the `container'. In my case I have the `container' mounted to /mnt/maemo1 so my case would be like this:
Code:
cd systemBackups/
tar -xvf 20110704-2022-rootfs.tar -C /mnt/maemo1
mkdir /mnt/maemo1/home
tar -xvf 20110704-2022-optfs.tar -C /mnt/maemo1/home
The contents of the optfs is a little weird, so we should clean up some of the remnants of optfs being outputted into /mnt/maemo1/home:
Code:
cp -Rv /mnt/maemo1/home/usr/* /mnt/maemo1/
cp -Rv /mnt/maemo1/home/usr/.* /mnt/maemo1/
rm -rf /mnt/maemo1/home/usr
rm -rf /mnt/maemo1/lost+found
Now the rest of the steps should be fairly straight forward, we more or less copy the ideas from the install.sh provided by the pwnieexpress:
Code:
cd ..
cd home_user
cp -a .kismet/ .msf3/ .opera/ .subversion/ .wireshark/ .zenmap/ /mnt/maemo1/home/user/
cp tracker.cfg /mnt/maemo1/home/user/.config/tracker/tracker.cfg
cp -a MyDocs/qtirreco/ /mnt/maemo1/home/user/MyDocs/
cp -a MyDocs/pwnphone/ /mnt/maemo1/home/user/MyDocs/
chmod 777 /mnt/maemo1/home/user/MyDocs/pwnphone
For the entire process we have used root to do all the work, so the permissions are all screwed up within the `container'. A simple chown command will set the correct permissions up:
Code:
chown -R 29999:29999 /mnt/maemo1/home/user/*
chown -R 29999:29999 /mnt/maemo1/home/user/.*
Those who wants to package extra stuff such as the deb files provided in pwnieexpress tarball and other stuff can do so by placing them in /mnt/maemo1/home/user/MyDocs. Do note however that you only have a total of 2.5G (if you used 4GB `container').

To close the `container' we simply umount it:
Code:
umount /mnt/maemo1
__________________
 

The Following 2 Users Say Thank You to tuxsavvy For This Useful Post: