many small fixed to make it ready for an image

pull/10/head
Raphaël Vinot 2013-03-28 15:28:27 +01:00
parent 38f934d91a
commit fdba081e15
17 changed files with 67 additions and 64 deletions

View File

@ -1,20 +0,0 @@
Prerequisites
=============
Get the latest image: http://www.raspberrypi.org/downloads (the recommended one)
And write it on the SD Card:
dd bs=4M if=~/2013-02-09-wheezy-raspbian.img of=/dev/mmcblk0
Note: I had to unplug/replug the sd card in order to see the second partition.
On a debian/ubuntu host:
- http://burstcoding.blogspot.com/2012/12/qemu-user-mode-arm-for-raspbian-chroot.html (not tested)
On a gentoo host:
- app-emulation/qemu-user
Choot
=====
chroot

15
copy_to_final.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
CHROOT_PATH='/mnt/arm_rPi'
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# copy deb
cp deb/*.deb ${CHROOT_PATH}/
# prepare fs archive
tar -cvpzf backup.tar.gz -C fs/ .
tar -xzfv backup.tar.gz -C ${CHROOT_PATH}/

2
filesystem/create_user.sh → create_user.sh Normal file → Executable file
View File

@ -5,3 +5,5 @@ useradd -m kitten
echo "Cmnd_Alias GROOMER_CMDS = /home/kitten/kitten_mount_src, \
/home/kitten/kitten_mount_dst, /home/kitten/kitten_umount" >> /etc/sudoers
echo "kitten ALL=(ALL) NOPASSWD: GROOMER_CMDS" >> /etc/sudoers
# /!\ REMOVE SUDO RIGHTS TO USER pi

View File

@ -17,11 +17,9 @@ if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
if [ -e /dev/sda ]; then
if [ -e /dev/sdb ]; then
/opt/groomer/groomer.sh
/opt/groomer/init.sh
/sbin/shutdown -h now
fi
fi

View File

@ -1,5 +1,5 @@
DEV_SRC='/dev/sdf'
DEV_DST='/dev/sdg1'
DEV_SRC='/dev/sda'
DEV_DST='/dev/sdb1'
# User allowed to do the following commands without password
USERNAME='kitten'
HOME="/home/${USERNAME}"

View File

@ -12,8 +12,7 @@ fi
clean(){
echo Done, cleaning.
# Only if running on a rPi
# mount -o remount,rw /
mount -o remount,rw /
${SYNC}
# shutdown -h now
}
@ -21,7 +20,7 @@ clean(){
trap clean EXIT TERM INT
# Remount the root filesystem in RO mode
# mount -o remount,ro /
mount -o remount,ro /
su ${USERNAME} -c ./groomer.sh

9
prepare_rPI.sh Normal file → Executable file
View File

@ -1,9 +1,12 @@
#!/bin/bash
# change locales to en_US.UTF-8
dpkg-reconfigure locales
apt-get update
apt-get dist-upgrade
apt-get autoremove
apt-get install libreoffice
dpkg -i libpoppler28_0.20.5-3_armhf.deb libpoppler-private-dev_0.20.5-3_armhf.deb \
pdf2htmlex_0.8-1~git201303011406r3bc73-0ubuntu1_armhf.deb
apt-get install libreoffice libfontforge1 p7zip-full
dpkg -i libpoppler28_0.20.5-3_armhf.deb pdf2htmlex_0.8-1~git201303011406r3bc73-0ubuntu1_armhf.deb

View File

@ -1,9 +1,18 @@
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
ls /usr/bin/qemu*arm* > /dev/null 2>&1
if [ ! -e ${?} ]; then
echo "You need qemu user static binaries." 1>&2
exit 1
fi
set -e
set -x
# If you use a partition...
PARTITION_ROOTFS='/dev/mmcblk0p2'
PARTITION_BOOT='/dev/mmcblk0p1'
@ -46,9 +55,6 @@ else
exit
fi
# only needed at first chroot, but it does not hurt.
#resize2fs /dev/loop1
cp /usr/bin/qemu*arm* ${CHROOT_PATH}/usr/bin/
mount -o bind /dev ${CHROOT_PATH}/dev
@ -59,6 +65,7 @@ mount -o bind /sys ${CHROOT_PATH}/sys
mount -o bind /tmp ${CHROOT_PATH}/tmp
cp -pf /etc/resolv.conf ${CHROOT_PATH}/etc
mv ${CHROOT_PATH}/etc/ld.so.preload ${CHROOT_PATH}/etc/ld.so.preload_bkp
chroot ${CHROOT_PATH}

View File

@ -1,26 +1,16 @@
dd if=/dev/zero bs=1024k count=2048 >> 2013-02-09-wheezy-raspbian.img
Add empty space to the image
============================
fdisk 2013-02-09-wheezy-raspbian.img
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Add 2Gb
Command (m for help): p
> dd if=/dev/zero bs=1024k count=2048 >> 2013-02-09-wheezy-raspbian.img
Expend partition size
=====================
> fdisk 2013-02-09-wheezy-raspbian.img
Command (m for help): *p*
Disk 2013-02-09-wheezy-raspbian.img: 4087 MB, 4087349248 bytes
255 heads, 63 sectors/track, 496 cylinders, total 7983104 sectors
@ -31,24 +21,33 @@ Disk identifier: 0x00014d34
Device Boot Start End Blocks Id System
2013-02-09-wheezy-raspbian.img1 8192 122879 57344 c W95 FAT32 (LBA)
2013-02-09-wheezy-raspbian.img2 122880 3788799 1832960 83 Linux
2013-02-09-wheezy-raspbian.img2 *122880* 3788799 1832960 83 Linux
Command (m for help): d
Partition number (1-4): 2
Command (m for help): *d*
Partition number (1-4): *2*
Command (m for help): n
Command (m for help): *n*
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (2048-7983103, default 2048): 122880
Select (default p):
Partition number (1-4, default 2):
First sector (2048-7983103, default 2048): *122880*
Last sector, +sectors or +size{K,M,G} (122880-7983103, default 7983103):
Using default value 7983103
Command (m for help): w
Command (m for help): *w*
The partition table has been altered!
Syncing disks.
Resize partition
================
> df | grep /mnt/arm
/dev/loop2 3927752 1955672 1794172 53% /mnt/arm_rPi
/dev/loop3 57288 18960 38328 34% /mnt/arm_rPi/boot
sudo resize2fs /dev/loop2