Ok, I've consolidated information from here and there into following scripts.
viewtopic.php?t=281
viewtopic.php?t=503
viewtopic.php?t=779
Pre-requisite:
1. XBox with > 137Gb Hard-drive
2. Hard-drive partition to F+G drive
3. Current rootfs is in E drive
4. Your G partition (hda56) is empty or can be wipe out completely. Beware following script WILL delete your G partition!
There are alltogether 6 files needed to make the G-drive native install work.
1. disk.swap (28 bytes)
2. disk.root (27 bytes)
3. make.partition.sh (1813 bytes)
4. update.initrd.sh (1303 bytes)
5. xfer.content.sh (797 bytes)
6. update.fstab.sh (876 bytes)
Step 1. Login as root. Transfer these files to /tmp folder.
Step 2. If you created these files in Windows and ftp to your xbox, changes are those files will still retain the DOS format and script will not run or run with error. One way to confirm is do "ls -l" and the filesize should be as above.
If the filesize is different, use the following command to covert the format:
Code: Select all
#cd /tmp
#col -b < disk.swap > disk.swap1; mv disk.swap1 disk.swap
#col -b < disk.root > disk.root1; mv disk.root1 disk.root
#col -b < make.partition.sh > make.partition.sh1; mv make.partition.sh1 make.partition.sh
#col -b < update.initrd.sh > update.initrd.sh1; mv update.initrd.sh1 update.initrd.sh
#col -b < xfer.content.sh > xfer.content.sh1; mv xfer.content.sh1 xfer.content.sh
#col -b < update.fstab.sh > update.fstab.sh1; mv update.fstab.sh1 update.fstab.sh
Step 3. Make all the sh files executeble.
Code: Select all
#chmod 755 make.partition.sh
#chmod 755 update.initrd.sh
#chmod 755 xfer.content.sh
#chmod 755 update.fstab.sh
Step 4. Make the partition, point of no return
Step 5. Transfer the content from rootfs to new hda2
Step 6. Update the initrd.gz
Step 7. Lastly, edit the fstab to use the new hda2 as root and hda1 as swap
If you are familiar with linux shell environment, you can always execute the embedded command manually in sequence if in doubt. Some scripts are not fool-prove (error checking and such). Of course we can always combine them all into one script but I'll leave it at current state more as illustration purpose for those who wish to understand what goes on at each stage.
----------------------------------------------------------------------------------
File#1: disk.swap (
viewtopic.php?t=281)
File#2: disk.root (
viewtopic.php?t=281)
File#3: make.partition.sh (
viewtopic.php?t=281)
Code: Select all
#!/bin/bash
###
# Settings for fdisk when making swap, then root partitions
###
DISKSWAP=/tmp/disk.swap
DISKROOT=/tmp/disk.root
DEVICE="/dev/hda"
###
# Start block for the end of the standard 137gb hdd
###
START=268435456
SWAPSIZE="+256M"
###
# Options for deleting all possible partitions from the drive
###
echo -e "d\n1\nd\n2\nd\n10\nd\n9\nd\n8\nd\n7\nd\n6\nd\n5\nd\n3\nd\n4\nw" > /tmp/make.disk
###
# Zero out the partition table
###
echo "(1/5) Zeroing partition table ..."
dd if=/dev/zero of=/dev/hda seek=$START bs=512 count=1 > /dev/null 2>&1
fdisk $DEVICE < /tmp/make.disk > /dev/null 2>&1
###
# Get the information needed to make the swap partition
###
echo "(2/5) Creating swap partition as /dev/hda1 ..."
sed -e "s/@SIZE@/$SWAPSIZE/g" -e "s/@START@/$START/g" < $DISKSWAP > /tmp/make.disk
fdisk -u $DEVICE < /tmp/make.disk > /dev/null 2>&1
rm -f /tmp/make.disk
###
# Get the information needed to make the root partition
###
echo "(3/5) Creating root partition as /dev/hda2 ..."
START=`fdisk -u -l ${DEVICE} | grep ${DEVICE}1 | awk -F' ' '{ print $3; }'`
START=`expr $START + 1`
sed -e "s/@SIZE@//g" -e "s/@START@/$START/g" < $DISKROOT > /tmp/make.disk
fdisk -u $DEVICE < /tmp/make.disk > /dev/null 2>&1
rm -f /tmp/make.disk
###
# Initialize the swap partition
###
echo "(4/5) Initialize swap partition ..."
mkswap /dev/ide/host0/bus0/target0/lun0/part1 1> /dev/null 2> /dev/null
if [ $? != "0" ]; then
/bin/led rxrx
clear
echo "An error occurred, halting"
echo "[Error making swap]"
exit
fi
###
# Format the root partition
###
echo "(5/5) Format root partition ..."
yes | /sbin/mkreiserfs /dev/ide/host0/bus0/target0/lun0/part2 1> /dev/null 2> /dev/null
if [ $? != "0" ]; then
/bin/led rxrx
clear
echo "An error occurred, halting"
echo "[Error making root filesystem]"
exit
fi
echo "Done ..."
File#4: xfer.content.sh (
viewtopic.php?t=281)
Code: Select all
#!/bin/bash
#####################
# Transfer partition content from rootfs to new hda2
#####################
echo "(1/3) Mounting partition..."
# mount the new hda2
mkdir /mnt/hda2
mount -t reiserfs /dev/hda2 /mnt/hda2
# mount the current rootfs as loopback
mkdir /mnt/rootfs
mount -o loop /mnt/fatx/e/rootfs /mnt/rootfs
# copy from rootfs to hda2
echo "(2/3) Start copying content. This should take approximately 5-10 minutes..."
cp -ax /mnt/rootfs/* /mnt/hda2/
# check filecount
cd /mnt/rootfs
TOTAL1=`find . -type f -print | wc -l`
cd /mnt/hda2
TOTAL2=`find . -type f -print | wc -l`
echo "Total file count in rootfs : $TOTAL1"
echo "Total file count in hda2 : $TOTAL2"
# clean up
echo "(3/3) Cleaning up..."
cd /mnt
umount hda2
rmdir hda2
umount rootfs
rmdir rootfs
echo "Done..."
File#5: update.initrd.sh
Code: Select all
#!/bin/bash
######################
echo "(1/3) Mounting initrd.gz ..."
#####################
# Copy out the initrd.gz
cp /mnt/fatx/e/initrd.gz /tmp
# Unzip it
gunzip /tmp/initrd.gz
# Mount as loopback
mkdir /mnt/initrd
mount -o loop /tmp/initrd /mnt/initrd
######################
echo "(2/3) Updating linuxrc ..."
#####################
# Update linuxrc to boot from part2
cd /mnt/initrd
# comment out mounting of e drive
sed -e "s~mount -t fatx /dev/ide/host0/bus0/target0/lun0/part50 /cdrom~#mount -t fatx /dev/ide/host0/bus0/target0/lun0/part50 /cdrom~" < linuxrc > linuxrc1
# comment out mounting of rootfs from e drive
# add mount rootfs directly from hda2
sed -e "s~mount -o loop /cdrom/rootfs /ram~#mount -o loop /cdrom/rootfs /ram\nmount -t reiserfs /dev/ide/host0/bus0/target0/lun0/part2 /ram~" < linuxrc1 > linuxrc
rm linuxrc1
cd /
######################
echo "(3/3) Zip back new initrd.gz ..."
#####################
# Umount so we can zip it again
umount /mnt/initrd
# Zip it back
gzip /tmp/initrd
# Back up original initrd.gz
mv /mnt/fatx/e/initrd.gz /mnt/fatx/e/oldinitrd.gz
# Copy in the new initrd.gz
mv /tmp/initrd.gz /mnt/fatx/e
# Cleanup
rmdir /mnt/initrd
######################
echo "Original initrd.gz renamed to oldinitrd.gz."
echo "Done ..."
#####################
File#6: update.fstab.sh
Code: Select all
#!/bin/bash
#####################
# Update the new fstab to boot from hda2 and use hda1 as swap
#####################
# mount the new hda2
mkdir /mnt/hda2
mount -t reiserfs /dev/hda2 /mnt/hda2
cd /mnt/hda2/etc
# replace original /dev/loop/0 with /dev/hda2
sed -e "s~/dev/loop/0[ \t]*/[ \t]*reiserfs[ \t]*defaults,errors=remount-ro[ \t]*0[ \t]*1~\n#/dev/loop/0 / reiserfs defaults,errors=remount-ro 0 1\n/dev/hda2 / reiserfs defaults,errors=remount-ro 0 1\n~" < fstab > fstab1
# replace original swap on fatx/e/swap with /dev/hda1
sed -e "s~/mnt/fatx/e/swap[ \t]*none[ \t]*swap[ \t]*sw[ \t]*0[ \t]*0~\n#/mnt/fatx/e/swap none swap sw 0 0\n/dev/hda1 none swap sw 0 0\n~" < fstab1 > fstab
rm fstab1
# clean up
cd /mnt
umount hda2
rmdir hda2
######################
echo "fstab in /dev/hda2 updated."
echo "Gentoox will use new partition after reboot."
#####################