User:Quozl/Remastering: Difference between revisions
Jump to navigation
Jump to search
(Created page with 'Remastering a .zd4 file without having to make a build. Useful for XO-1.75 when no ARM build machinery is on your side of a slow pipe. <pre> # the build number we are basing on…') |
No edit summary |
||
Line 2: | Line 2: | ||
<pre> |
<pre> |
||
#!/bin/bash |
|||
set -evx |
|||
# the build number we are basing on |
# the build number we are basing on |
||
BUILD= |
BUILD=12 |
||
IMAGE=os$BUILD.img |
IMAGE=os$BUILD.img |
||
Line 25: | Line 28: | ||
ROOT=/mnt/root/versions/run/$BUILD/ |
ROOT=/mnt/root/versions/run/$BUILD/ |
||
USER=/mnt/root/home/olpc/ |
USER=/mnt/root/home/olpc/ |
||
# turn off runin fscheck, it will fail once we change things |
|||
⚫ | |||
# provide local kernel |
# provide local kernel |
||
Line 31: | Line 37: | ||
# force initial runin |
# force initial runin |
||
⚫ | |||
# touch $ROOT/runin/quick |
# touch $ROOT/runin/quick |
||
Line 42: | Line 47: | ||
chmod o-rwx,g-rwx $SSH_CONFIG/authorized_keys |
chmod o-rwx,g-rwx $SSH_CONFIG/authorized_keys |
||
# save some space and therefore time |
# save some space and therefore compression and fs-update time |
||
rm -rf $USER/Activities/Wikipedia* |
# rm -rf $USER/Activities/Wikipedia* |
||
rm -rf $USER/Activities/Scratch* |
# rm -rf $USER/Activities/Scratch* |
||
rm -rf $USER/Library/* |
# rm -rf $USER/Library/* |
||
# enable sshd on start |
# enable sshd on start |
||
Line 56: | Line 61: | ||
touch /etc/rc.local.quozl |
touch /etc/rc.local.quozl |
||
fi |
fi |
||
(sleep 13 && touch /var/run/powerd-inhibit-suspend/1) < /dev/null > /dev/null & |
|||
EOF |
EOF |
||
chmod +x $ROOT/etc/rc.local |
chmod +x $ROOT/etc/rc.local |
||
Line 66: | Line 70: | ||
config_PLUGGED_TIME_SLEEP="3600" |
config_PLUGGED_TIME_SLEEP="3600" |
||
EOF |
EOF |
||
# disable idle suspend |
|||
# touch $ROOT/etc/powerd/flags/inhibit-suspend |
|||
# associate to local wireless |
# associate to local wireless |
Revision as of 03:36, 23 November 2011
Remastering a .zd4 file without having to make a build. Useful for XO-1.75 when no ARM build machinery is on your side of a slow pipe.
#!/bin/bash set -evx # the build number we are basing on BUILD=12 IMAGE=os$BUILD.img # convert the .zd file into a disk image zdextract < os$BUILD.zd4 > $IMAGE # build a random fill pattern for later use dd if=/dev/urandom of=$IMAGE.fill bs=4096 count=1 2>/dev/null # dump the partition table in case it ever changes parted $IMAGE "unit B print" # connect the partitions to loopback block devices losetup -o 4194304 /dev/loop0 $IMAGE losetup -o 71303168 /dev/loop1 $IMAGE # mount the two filesystems mkdir -p /mnt/root /mnt/boot mount /dev/loop1 /mnt/root mount /dev/loop0 /mnt/boot ROOT=/mnt/root/versions/run/$BUILD/ USER=/mnt/root/home/olpc/ # turn off runin fscheck, it will fail once we change things rm -f $ROOT/runin/runin-fscheck # provide local kernel rsync -av /tmp/xo/bootpart/boot/* /mnt/boot/boot/ rsync -av /tmp/xo/lib/modules ${ROOT}/lib/ # force initial runin # touch $ROOT/runin/quick # open to your key SSH_CONFIG=/mnt/root/home/root/.ssh mkdir --mode=g-rwx,o-rwx $SSH_CONFIG cat << EOF > $SSH_CONFIG/authorized_keys (put your key here) EOF chmod o-rwx,g-rwx $SSH_CONFIG/authorized_keys # save some space and therefore compression and fs-update time # rm -rf $USER/Activities/Wikipedia* # rm -rf $USER/Activities/Scratch* # rm -rf $USER/Library/* # enable sshd on start cat <<EOF > $ROOT/etc/rc.local #!/bin/sh touch /var/lock/subsys/local if [[ ! -f /etc/rc.local.quozl ]]; then service sshd start chkconfig sshd on touch /etc/rc.local.quozl fi EOF chmod +x $ROOT/etc/rc.local # reduce powerd enthusiasm cat <<EOF >> $ROOT/etc/powerd/powerd.conf config_PLUGGED_TIME_DIM="15" config_PLUGGED_TIME_BLANK="30" config_PLUGGED_TIME_SLEEP="3600" EOF # disable idle suspend # touch $ROOT/etc/powerd/flags/inhibit-suspend # associate to local wireless mkdir -p $USER/.sugar/default/nm/ chown -R 500:500 $USER/.sugar cat <<EOF > $USER/.sugar/default/nm/connections.cfg [Auto qz] type = 802-11-wireless ssid = qz uuid = 757dc7687efb4e7250f4eb6697568482ae948526 autoconnect = True timestamp = 1321510400 EOF # dismount the filesystem umount /mnt/boot umount /mnt/root rmdir /mnt/root /mnt/boot # fill the free blocks, to ensure sparse output fill-free-blocks -v /dev/loop0 $IMAGE.fill until losetup -d /dev/loop0; do sleep 0.1; done fill-free-blocks -v /dev/loop1 $IMAGE.fill until losetup -d /dev/loop1; do sleep 0.1; done # compress back to .zd format zhashfs 0x20000 sha256 $IMAGE fs.zsp fs.zd