Debian LiveCD: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
Line 97: Line 97:
cd initramfs
cd initramfs
mkdir -p bin dev etc lib/modules/3.4.9 mnt proc sbin sys usr
mkdir -p bin dev etc lib/modules/3.4.9 mnt proc sbin sys usr
cp linux-3.4.9-build/lib/modules/3.4.9/kernel/fs/fat/fat.ko lib/modules/3.4.9/
sgps3rom
cp linux-3.4.9-build/lib/modules/3.4.9/kernel/fs/fat/vfat.ko lib/modules/3.4.9/
for mod in fat vfat isofs crc-ccitt crc-itu-t lzo_compress udf squashfs overlayfs ps3_gelic sg ps3rom usb-common usbcore ehci-hcd ohci-hcd usb-storage; do
    path=`find  /home/glevand/linux-3.4.9-build/lib/modules/3.4.9 -name $mod.ko`
    cp $path lib/modules/3.4.9/
done
 
ls -l lib/modules/3.4.9/
-rw-r--r-- 1 glevand users  131740 Aug 18 17:21 crc-ccitt.ko
-rw-r--r-- 1 glevand users  131796 Aug 18 17:21 crc-itu-t.ko
-rw-r--r-- 1 glevand users  914251 Aug 18 17:21 ehci-hcd.ko
-rw-r--r-- 1 glevand users 1321852 Aug 18 17:21 fat.ko
-rw-r--r-- 1 glevand users 1045485 Aug 18 17:21 isofs.ko
-rw-r--r-- 1 glevand users  137185 Aug 18 17:21 lzo_compress.ko
-rw-r--r-- 1 glevand users  620232 Aug 18 17:21 ohci-hcd.ko
-rw-r--r-- 1 glevand users  694777 Aug 18 17:21 overlayfs.ko
-rw-r--r-- 1 glevand users  964496 Aug 18 17:21 ps3_gelic.ko
-rw-r--r-- 1 glevand users  288568 Aug 18 17:21 ps3rom.ko
-rw-r--r-- 1 glevand users  547467 Aug 18 17:21 sg.ko
-rw-r--r-- 1 glevand users 1863204 Aug 18 17:21 squashfs.ko
-rw-r--r-- 1 glevand users 2534095 Aug 18 17:21 udf.ko
-rw-r--r-- 1 glevand users  130878 Aug 18 17:21 usb-common.ko
-rw-r--r-- 1 glevand users 1708601 Aug 18 17:21 usb-storage.ko
-rw-r--r-- 1 glevand users 3527536 Aug 18 17:21 usbcore.ko
-rw-r--r-- 1 glevand users  318531 Aug 18 17:21 vfat.ko
</pre>
</pre>



Revision as of 14:22, 18 August 2012

Introduction

  • Sometimes we need to boot Linux without HDD e.g. if you want to experiment with HDD encryption, enable/disable it without causing damage to your data. For such cases we need a LiveCD which doesn't mount HDD at boot.

Creating Initial System with debootstrap

apt-get install debootstrap

mkdir livecd

debootstrap --arch powerpc squeeze /root/livecd http://ftp.us.debian.org/debian

# Grab a beer and reverse some PS3 stuff in the meantime :)

# Enter chroot environment

mount -t proc none /root/livecd/proc
mount --rbind /dev /root/livecd/dev
LANG=C chroot /root/livecd /bin/bash

export TERM=xterm-color

echo "debian" > /etc/hostname

dpkg-reconfigure tzdata

# Configure network interfaces

cat /etc/network/interfaces
---
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-ssid ssid
    wpa-psk psk
-EOF-

# Configure APT

cat /etc/apt/sources.list
---

deb http://ftp.us.debian.org/debian squeeze main
deb-src http://ftp.us.debian.org/debian squeeze main

deb http://security.debian.org squeeze/updates main
deb-src http://security.debian.org squeeze/updates main
-EOF-

aptitude update

aptitude install locales
dpkg-reconfigure locales
aptitude install console-data
dpkg-reconfigure console-data

tasksel install standard
aptitude install binutils gcc make git vim openssh-server sudo wpasupplicant libssl-dev
aptitude  install gcc-spu g++-spu newlib-spu spu-tools

# Make SSH server start at boot so we could ssh to our LiveCD

update-rc.d ssh defaults

aptitude clean

Creating Root Filesystem

cd /root/livecd
mksquashfs * ../root.sfs

Modifying Root Filesystem

cd /root
unsquashfs root.sfs
cd squashfs-root

# Make your changes

mksquashfs * ../root-changed.sfs

Initramfs

mkdir initramfs
cd initramfs
mkdir -p bin dev etc lib/modules/3.4.9 mnt proc sbin sys usr
sgps3rom
for mod in fat vfat isofs crc-ccitt crc-itu-t lzo_compress udf squashfs overlayfs ps3_gelic sg ps3rom usb-common usbcore ehci-hcd ohci-hcd usb-storage; do
    path=`find  /home/glevand/linux-3.4.9-build/lib/modules/3.4.9 -name $mod.ko`
    cp $path lib/modules/3.4.9/
done

ls -l lib/modules/3.4.9/
-rw-r--r-- 1 glevand users  131740 Aug 18 17:21 crc-ccitt.ko
-rw-r--r-- 1 glevand users  131796 Aug 18 17:21 crc-itu-t.ko
-rw-r--r-- 1 glevand users  914251 Aug 18 17:21 ehci-hcd.ko
-rw-r--r-- 1 glevand users 1321852 Aug 18 17:21 fat.ko
-rw-r--r-- 1 glevand users 1045485 Aug 18 17:21 isofs.ko
-rw-r--r-- 1 glevand users  137185 Aug 18 17:21 lzo_compress.ko
-rw-r--r-- 1 glevand users  620232 Aug 18 17:21 ohci-hcd.ko
-rw-r--r-- 1 glevand users  694777 Aug 18 17:21 overlayfs.ko
-rw-r--r-- 1 glevand users  964496 Aug 18 17:21 ps3_gelic.ko
-rw-r--r-- 1 glevand users  288568 Aug 18 17:21 ps3rom.ko
-rw-r--r-- 1 glevand users  547467 Aug 18 17:21 sg.ko
-rw-r--r-- 1 glevand users 1863204 Aug 18 17:21 squashfs.ko
-rw-r--r-- 1 glevand users 2534095 Aug 18 17:21 udf.ko
-rw-r--r-- 1 glevand users  130878 Aug 18 17:21 usb-common.ko
-rw-r--r-- 1 glevand users 1708601 Aug 18 17:21 usb-storage.ko
-rw-r--r-- 1 glevand users 3527536 Aug 18 17:21 usbcore.ko
-rw-r--r-- 1 glevand users  318531 Aug 18 17:21 vfat.ko

Linux 3 Kernel

  • We need a Linux 3 kernel with overlayfs support so we could create a tmpfs over our read-only base filesystem.
  • At the moment overlayfs is not supported on Linux 3.5 so it leaves us with Linux 3.4 which doesn't really matter because all my Linux 3 drivers are supported on Linux 3.4 just fine.
  • Furthermore, we want to compile PS3 HDD driver as module because in this case we can easily change HDD region flags.

Links