faosfbi
(usa Ubuntu)
Enviado em 08/09/2011 - 11:07h
então, é isso mesmo, uma partição linux na pasta tmp/full
Vou disponibilizar meu script para que possam visualizar melhor:
#!/bin/sh
if [ $# != 1 ]; then
echo Usage: $0 \<game name\>
exit 1
fi
if [ -z $BUILD_ROOT ]; then
echo Please set BUILD_ROOT first.
exit 1
fi
GAME="$PWD/games/$1"
modprobe cryptoloop
modprobe aes
make -s -C $GAME/mbr || exit 1
rm -rf tmp/*
trap "umount mp 2>/dev/null; losetup -d /dev/loop4 2>/dev/null; losetup -d /dev/loop5 2>/dev/null" 0
echo Copying full image...
cp -a full tmp
cd tmp
if [ ! -f $GAME/play-with-keyboard.txt ]; then
echo Removing keyboard drivers...
rm -rf full/lib/modules/*/kernel/drivers/input
rm -rf full/lib/modules/*/kernel/drivers/hid
fi
if [ -f $GAME/lilo ]; then
echo Using custom lilo version...
cp $GAME/lilo full/sbin/lilo || exit 1
fi
if [ -d $GAME/lobby ]; then
echo Using custom lobby files...
cp $GAME/lobby/* full/usr/local/lobby || exit 1
fi
depmod -b full $INSTALL_MOD_PATH 2.6.24.2 || exit 1
echo Building initramfs...
pwgen -s -c -n 32 1 > full/root_key
#chroot full mkinitramfs -o /boot/initramfs 2.6.24.2
chroot full
mkinitramfs -o /home/ikm/game-images/full/boot/initramfs 2.6.38-10-generic-pae
$BUILD_ROOT/programs/protection/encrypt-initrd/encrypt-initrd full/boot/initramfs 7c.d0.60.a7.c0.14.9a.02.be.6b.7c.06.f4.9b.b0.81.37.36.27.a1.9a.f1.11.ad.b9.33.06.1c.15.dd.b0.dc.0a.9e.5c.e9.1b.14.f6.90.4d.6f.c0.bd.eb.a5.cd.81.2e.56.01.22.ea.24.63.4f.3a.8b.1b.39.f1.60.72.cf || exit 1
echo Making the flash image...
$BUILD_ROOT/programs/ptool/ptool $GAME/mbr/mbr --split flash || exit 1
echo Building boot partition...
mkdir mp
losetup /dev/loop4 flash1 || exit 1
mke2fs -q -m0 /dev/loop4 || exit 1
mount /dev/loop4 mp || exit 1
cp full/boot/initramfs mp/2
cp full/boot/bzImage mp/5
umount mp
echo Installing LILO...
losetup /dev/loop5 flash || exit 1
chroot full /bin/sh -c "mount /dev/loop4 /boot && lilo; umount /boot" || exit 1
# Encrypt the kernel and wipe out unused sectors
mount /dev/loop4 mp || exit 1
$BUILD_ROOT/programs/protection/encrypt-kernel/encrypt-kernel mp/5 || exit 1
rm -rf mp/lost+found
df -h mp/
ls -l mp/
sync
sync
sync
$BUILD_ROOT/programs/protection/wipe-unused-sectors/wipe-unused-sectors /dev/loop4 mp/* || exit 1
#umount mp # This is done by wipe-unused-sectors
# Remove all unneeded stuff
export LANG=C
chroot full dpkg -P --force-all initramfs-tools cpio klibc-utils libklibc
chroot full dpkg -P --force-all adduser apt apt-utils aptitude dmidecode dselect gzip info laptop-detect man-db nano ncurses-bin openbsd-inetd tar tasksel tasks el-data tcpd traceroute tzdata update-inetd vim-common vim-tiny binutils cron sysklogd klogd manpages
chroot full dpkg -P --force-all debconf debconf-i18n debian-archive-keyring gnupg gpgv libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl perl-base whiptail
chroot full dpkg -P --force-all dpkg
# Preserve start-stop-daemon
cp ../full/sbin/start-stop-daemon full/sbin || exit 1
rm -rf full/var/{cache,backups,log/*}
rm -rf full/var/lib/dpkg
rm -rf full/etc/apt
rm -rf full/usr/share/doc
rm -rf full/usr/share/man
rm -rf full/usr/share/locale
rm -rf full/boot
rm -rf full/etc/lilo*
rm -rf full/sbin/lilo
rm -rf full/root/.* 2>/dev/null
# Kill some init scripts
rm -f full/etc/init.d/bootmisc.sh
rm -f full/etc/init.d/*bootclean*
echo Building root partition...
losetup -d /dev/loop4
losetup -d /dev/loop5
cat full/root_key | losetup -e aes-cbc-plain -p 0 /dev/loop4 flash2 || exit 1
rm -f full/root_key
#rm -f full/splash.ppm
pwgen -s -c -n 32 1 > full/etc/data || exit 1
cp $GAME/id.txt full/etc/id
../tools/mksquashfs full /dev/loop4 -noappend || exit 1
losetup -d /dev/loop4
echo Building data partition...
echo `cat full/etc/data``cat $GAME/key.txt` | losetup -e aes-cbc-plain -p0 /dev/loop4 flash3 || exit 1
../tools/mksquashfs $GAME/content /dev/loop4 -noappend || exit 1
losetup -d /dev/loop4
losetup /dev/loop4 flash4 || exit 1
dd if=/dev/urandom of=/dev/loop4
losetup -d /dev/loop4
echo Combining the resulting flash image...
$BUILD_ROOT/programs/ptool/ptool $GAME/mbr/mbr --combine flash || exit 1
echo Flash image built successfully