Friday 12 December 2008

Install BT3 on USB with persistent changes, using Linux.

SOURCE:

http://forums.remote-exploit.org/showthread.php?t=14486
------------------------------------------------------------
Before I start, I would like to thank Pureh@te for his video tutorial that covers this. GREAT JOB

When I could not find a written Tutorial that included the persistent changes, and was done from start to finish on a Linux box, I decided to write my own so here it is.
On a side note, this is the first Tutorial I have ever written, so any feedback would be appreciated


For this Tutorial I will be installing BT3 on a 2 GB Flash Drive. Feel free to use a drive with more capacity, I recommend that you have at least 2 GB's.

Now lets get started.

Download the BT3B USB version.

Open a terminal and wget it.
Code:

wget http://www.remote-exploit.org/cgi-bin/fileget?version=bt3b-usb

I can't post links so you'll have to correct it

Once you have downloaded the file. place it in a directory of your likings and forget about it for the time being.

We will need to split our 2GB drive into 2 separate partitions. One partition will be 1.10 GB's on a FAT32 file system, and the second will be the remainder of the free space as an Ext 3 filesystem.

I will be using "fdisk, mkfs, & fsck" to setup the partitions.

Insert your drive into the nearest USB port and lets-

Create the Partitions

Open a terminal and type the following command:
Code:

fdisk /dev/sdb

You will need ROOT Privs. for most of the commands I use

This is the fdisk prompt:
Code:

Command (m for help):

To list the existing partitions type "p" and enter
Code:

Command (m for help): p

Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 132 1060258+ b W95 FAT32
/dev/sdb2 133 242 883575 83 Linux

We need to delete these partitions so type "d" and enter
You will then be asked for the partition number that you want to delete.
Code:

Command (m for help): d
Partition number (1-4):

Type the number "1" and hit enter, now repeat the process for the remaining partitions.

Once there are no partitions, the output of "p" will be:
Code:

Command (m for help): p

Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

Device Boot Start End Blocks Id System

To create a new partition type "n" and enter. This will prompt us for some details:
Code:

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-242, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-242, default 242): +1080M

Lets create the second partition
I know the first partition should be FAT32 and is clearly Linux, don't worry we are getting to that

Again type "n" and answer the questions.
Code:

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (133-242, default 133):
Using default value 133
Last cylinder or +size or +sizeM or +sizeK (133-242, default 242):
Using default value 242

Lets look at our partition layout now. Type "p" and enter.
Code:

Command (m for help): p

Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
/dev/sdb2 133 242 883575 83 Linux

Its time to change the ID of partition 1 to correspond with the Fat 32 Filesystem type that we will be using.

Type "t" and enter, then answer the questions:
Code:

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

We only need to change partition 1 because 2 is already set for Ext 3.

Now we will make the first partition bootable.

Type "a" and enter the partition number that you want bootable. in this instance it will be 1.
Code:

Command (m for help): a
Partition number (1-4): 1

One last look at our partitions before we move on, so type "p" and enter:
Code:

Command (m for help): p

Disk /dev/sdb: 1998 MB, 1998585344 bytes
255 heads, 63 sectors/track, 242 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa62da6ab

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 132 1060258+ b W95 FAT32
/dev/sdb2 133 242 883575 83 Linux

Everything looks good so lets write these changes to the drive.
Type "w" and enter

Writing the Filesystems

For this task we will be using "mkfs"

At the terminal type:
Code:

user@laptop:~$ mkfs -t vfat /dev/sdb1

Should output
Code:

mkfs.vfat 2.11 (12 Mar 2005)

Then for the second partition type:
Code:

mkfs -t ext2 /dev/sdb2

Should output
Code:

mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
56896 inodes, 226918 blocks
11345 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=234881024
7 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Its time to use "fsck" to -

Check The Filesystems

At the Terminal type:
Code:

fsck -y /dev/sdb1

Should Output:
Code:

fsck 1.40.8 (13-Mar-2008)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
/dev/sdb1: 0 files, 1/264543 clusters

Then:
Code:

fsck -y /dev/sdb2

Should Output:
Code:

fsck 1.40.8 (13-Mar-2008)
e2fsck 1.40.8 (13-Mar-2008)
/dev/sdb2: clean, 11/55328 files, 6071/220893 blocks

Thats it, the partitions are created, filesystems written, and then checked. We are ready to start installing!!!

"cd" to the directory where you have the downloaded BT3 rar file, and run unrar.
Code:

unrar x bt3b141207.rar

If you experience issues on your Distro unpacking the .rar, be sure you have unrar installed.

Once the unpacking is completed OK we need to start copying files to our drive. "cd" into the unpacked directory and copy "boot" and "BT3" directories to the first partition of your flash drive.

So type:
Code:

cp -r boot /media/disk

Then:
Code:

cp -r BT3 /media/disk

I'm using ubuntu and the flash drive is mounted in /media you will need to change this to where your drive is mounted

We need to "cd" to the first partition of the flash drive.

So type:
Code:

cd /media/disk

"cd" into the boot directory and then into the syslinux directory.
Code:

cd boot/syslinux

Here we need to change a few permissions.

In the terminal type:
Code:

chmod 777 lilo

then:
Code:

chmod 777 syslinux

Using your favorite text editor we need to modify the syslinux.cfg file. Here I will use nano.
Code:

nano syslinux.cfg

Change this line:
Code:

LABEL pchanges
MENU LABEL BT3 Graphics mode with Persistent Changes
KERNEL /boot/vmlinuz
APPEND vga=0x317 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/slax/slaxsave.dat autoexec=xconf;kdm

To:
Code:

LABEL pchanges
MENU LABEL BT3 Graphics mode with Persistent Changes
KERNEL /boot/vmlinuz
APPEND vga=0x317 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/dev/sdb2 autoexec=xconf;kdm

You can add this line to any of the boot choices, as it is you will need to boot to "BT3 Graphics mode with Persistent Changes" for the changes to be saved

We need to go back up one directory to run the bootinst.sh script
So:
Code:

cd ..

An "ls" should show:
Code:

bootinst.bat bootlilo.sh dos isolinux mt86p vesamenu.c32
bootinst.sh chain.c32 initrd.gz modules syslinux vmlinuz

Run the bootinst.sh script:
Code:

./bootinst.sh

This begins the Slax boot installer:
Code:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Welcome to Slax boot installer
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This installer will setup disk /dev/sdb1 to boot only Slax.

Warning! Master boot record (MBR) of /dev/sdb will be overwritten.
If you use /dev/sdb to boot any existing operating system, it will not work
anymore. Only Slax will boot from this device. Be careful!

Press any key to continue, or Ctrl+C to abort...

Hit any key and:
Code:

Flushing filesystem buffers, this may take a while...
Setting up MBR on /dev/sdb...
The Master Boot Record of /dev/sdb has been updated.
Activating partition /dev/sdb1...
No partition table modifications are needed.
Updating MBR on /dev/sdb...
Setting up boot record for /dev/sdb1...
Disk /dev/sdb1 should be bootable now. Installation finished.

Read the information above and then press any key to exit...

The install worked perfectly!!!!

Reboot your machine and test out the stick

If anyone has any questions or are not clear on any part of this Tutorial I will answer any of your questions to the best of my ablility.

No comments: