├── marketing └── slides_vga │ ├── A.png │ ├── B.png │ ├── C.png │ ├── D.png │ ├── E.png │ ├── F.png │ └── G.png ├── misc ├── Raspberry_Pi_Logo.png └── Raspberry_Pi_Logo.svg ├── helper ├── config ├── extras └── export_img_over_nfs ├── LICENSE ├── qa_checklist.mkd ├── grow_image ├── shrink_image ├── f2fsify ├── wheezy-stage0 ├── wheezy-stage4-lxde-edu ├── README.mkd ├── setup_spindle_environment ├── wheezy-stage1 ├── wheezy-stage4-lxde ├── wheezy-stage2 ├── common └── wheezy-stage3 /marketing/slides_vga/A.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/marketing/slides_vga/A.png -------------------------------------------------------------------------------- /marketing/slides_vga/B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/marketing/slides_vga/B.png -------------------------------------------------------------------------------- /marketing/slides_vga/C.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/marketing/slides_vga/C.png -------------------------------------------------------------------------------- /marketing/slides_vga/D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/marketing/slides_vga/D.png -------------------------------------------------------------------------------- /marketing/slides_vga/E.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/marketing/slides_vga/E.png -------------------------------------------------------------------------------- /marketing/slides_vga/F.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/marketing/slides_vga/F.png -------------------------------------------------------------------------------- /marketing/slides_vga/G.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/marketing/slides_vga/G.png -------------------------------------------------------------------------------- /misc/Raspberry_Pi_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RPi-Distro/spindle/HEAD/misc/Raspberry_Pi_Logo.png -------------------------------------------------------------------------------- /helper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -e 7 | 8 | . ./common 9 | 10 | if [ $# -ne 0 ]; then 11 | set -x 12 | "$@" 13 | fi 14 | -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | RASPBIAN=1 7 | 8 | if [ -n "$RASPBIAN" ]; then 9 | TGT_ARCH=armhf 10 | DEB_MIRROR=http://archive.raspbian.org/raspbian/ 11 | else 12 | TGT_ARCH=armel 13 | #DEB_MIRROR=http://ftp.uk.debian.org/debian 14 | DEB_MIRROR=http://www-uxsup.csx.cam.ac.uk/pub/linux/debian 15 | fi 16 | NBD_DEV=/dev/nbd0 17 | BOOT_DEV="$NBD_DEV"p1 18 | ROOT_DEV="$NBD_DEV"p2 19 | 20 | IMGFORMAT=qed 21 | SDSIZE=3125M 22 | 23 | # Changing these isn't currently supported 24 | WORKDIR=work 25 | OUTDIR=out 26 | -------------------------------------------------------------------------------- /extras/export_img_over_nfs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | # NOTE: this script is rather hacky, in that you probably want to run it 7 | # outside of the schroot set up for spindle...Ideally we'd be booting with an 8 | # nbd rootfs anyway, so this is just a stopgap 9 | set -ex 10 | 11 | . ./common 12 | 13 | [ "$1" ] || die "No image name given" 14 | [ -b "$NBD_DEV" ] || die "nbd device '%s' does not exist. Try sudo modprobe nbd max_part=16" "$NBD_DEV" 15 | dotask schroot -c spindle -- qemu-img create -f qed -b $1 nfs.qed 16 | mkdir -p nfs_export 17 | dotask sudo schroot -c spindle -- qemu-nbd --nocache -v -c /dev/nbd0 nfs.qed & 18 | sleep 5 19 | dotask sudo mount /dev/nbd0p2 nfs_export # have to do it outside of schroot! 20 | NFS_PATH=$(readlink -m nfs_export) 21 | dotask sudo exportfs -v -i -o async,rw,no_root_squash ":$NFS_PATH" 22 | while true; do 23 | sleep 60 24 | done 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Spindle is licensed under the terms of the MIT license reproduced below. 2 | 3 | ##################################################### 4 | 5 | Copyright (c) 2012 Alex Bradbury 6 | 7 | Permission is hereby granted, free of charge, to any person 8 | obtaining a copy of this software and associated documentation 9 | files (the "Software"), to deal in the Software without 10 | restriction, including without limitation the rights to use, 11 | copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the 13 | Software is furnished to do so, subject to the following 14 | conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | OTHER DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /qa_checklist.mkd: -------------------------------------------------------------------------------- 1 | # QA checklist 2 | This document contains a list of things which should be tested before 3 | releasing a distribution image as 'finished'. 4 | 5 | ## Platform specific 6 | * The latest version of the 'firmware' is included 7 | * /dev/vchiq is owned by group 'video' 8 | 9 | ## Basic configuration 10 | * ifplugd is installed and properly configured 11 | * A default user has been created 12 | * If a desktop environment is installed, it defaults to Raspberry Pi branding 13 | * sshd either starts at boot or is trivial to enable (and this mechanism has 14 | been tested) 15 | * An NTP daemon is installed and configured 16 | * eth0 isn't renamed when the same SD card is put in a different Raspberry Pi 17 | * sudo is installed and configured 18 | * ssh host keys have been removed and will be generated on first boot or first 19 | invocation of sshd 20 | * `apt-get clean` has been run to remove cached packages 21 | 22 | ## Functionality tests for desktop images 23 | * When plugging in a USB memory stick, it is automatically mounted 24 | * Wireless dongles with free firmware work out of the box 25 | * The default browser works for GMail and other JavaScript-heavy sites 26 | * `/opt/vc/bin/tvservice` has been verified to work 27 | * Verify after installing gparted it can be launched from the graphical menu 28 | and that in pcmanfm 'open folder as root' works (checks PolicyKit 29 | configuration). 30 | * Run fsck on the root partition to ensure the image generation process 31 | produced a clean filesystem 32 | -------------------------------------------------------------------------------- /grow_image: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | # TODO: this script is very rough and ready. Currently grows an image to ~4GiB 7 | 8 | set -x 9 | 10 | if [ $(id -u) -ne 0 ]; then 11 | printf "Script must be run as root\n" 12 | exit 1 13 | fi 14 | 15 | if [ ! "$1" ]; then 16 | printf "Usage: ./grow_image IMAGEFILE\n" 17 | exit 1 18 | fi 19 | IMAGEFILE="$1" 20 | 21 | # Grow the image file 22 | dd of="$IMAGEFILE" bs=1 seek=3700M count=0 23 | 24 | # Just use losetup to create a loopback device. fdisk will operate on files, 25 | # but it complains about the number of cylinders not being set 26 | 27 | LOOP_DEV=$(losetup -f) 28 | 29 | losetup -v $LOOP_DEV "$IMAGEFILE" 30 | 31 | # Partition resizing code same as in http://github.com/asb/raspi-config 32 | PART_START=$(parted "$IMAGEFILE" -ms unit s p | grep "^2" | cut -f 2 -d:) 33 | if [ ! "$PART_START" ]; then 34 | printf "Failed to extract root partition offset\n" 35 | fi 36 | fdisk -cu $LOOP_DEV < rootfs.tar.gz 53 | umount rootfs 54 | 55 | # Make the f2fs rootfs 56 | mkfs.f2fs $LOOP_DEV 57 | mount $LOOP_DEV rootfs 58 | tar -xvf rootfs.tar.gz 59 | sed -i rootfs/etc/fstab -e "s/ext4/f2fs/" 60 | cat rootfs/etc/fstab 61 | umount rootfs 62 | losetup -d $LOOP_DEV 63 | 64 | # Fix cmdline.txt on boot partition 65 | losetup --offset "$BOOT_START_BYTES" -v $LOOP_DEV "$IMAGEFILE" 66 | mkdir -p boot 67 | mount $LOOP_DEV boot 68 | sed -i boot/cmdline.txt -e "s/ext4/f2fs/" 69 | cat boot/cmdline.txt 70 | umount boot 71 | losetup -d $LOOP_DEV 72 | 73 | printf "Done!\n" 74 | -------------------------------------------------------------------------------- /wheezy-stage0: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -e 7 | 8 | . ./common 9 | 10 | CURIMG=stage0.$IMGFORMAT 11 | 12 | create_partition_table() { 13 | # TODO: partition sizes shouldn't be hard-coded 14 | sudo parted $1 < /etc/udev/rules.d/40-scratch.rules 32 | ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0003", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" 33 | EOF1 34 | # Requested for raspberry filling 35 | apt-get install -y python3-numpy 36 | 37 | # Install pypy 38 | if [ "$(dpkg --print-architecture)" = armhf ]; then 39 | apt-get install -y pypy-upstream 40 | fi 41 | 42 | apt-get install -y python3-pifacecommon python3-pifacedigitalio \ 43 | python3-pifacedigital-scratch-handler python-pifacecommon python-pifacedigitalio 44 | 45 | 46 | if [ "$(dpkg --print-architecture)" = armhf ]; then 47 | apt-get install -y java-common oracle-java8-jdk 48 | apt-get install -y minecraft-pi python-minecraftpi 49 | fi 50 | 51 | EOF 52 | } 53 | 54 | install_wolfram() { 55 | onvm_chroot sh -l -ex - <<\EOF 56 | apt-get update 57 | debconf-set-selections < 80 | Homepage: 81 | -------------------------------------------------------------------------------- /setup_spindle_environment: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -e 7 | 8 | SCHROOT_SPINDLE_CONF=/etc/schroot/chroot.d/spindle 9 | ETC_SCHROOT_SPINDLE=/etc/schroot/spindle 10 | 11 | if [ $(id -u) -ne 0 ]; then 12 | printf "Script must be run as root\n" 13 | exit 1 14 | fi 15 | 16 | show_usage() { 17 | printf "./setup_spindle_environment DIRNAME\n" 18 | } 19 | 20 | ensure_installed() { 21 | for PKG in "$@"; do 22 | dpkg --get-selections "$PKG" | grep -q "[[:space:]]install$" || apt-get install "$PKG" || die "Failed to install $PKG" 23 | done 24 | } 25 | 26 | [ "$1" ] || show_usage 27 | TARGET_DIR=$(readlink -m "$1") 28 | 29 | . ./common 30 | 31 | ensure_installed schroot debootstrap debian-archive-keyring 32 | 33 | ask_yn y "About to set up chroot in '%s'. Ok?" "$TARGET_DIR" || die "You said no. Exiting" 34 | read_val USERS "${USERS-$SUDO_USER}" "What user should be able to schroot?" 35 | [ -z "$USERS" ] && die "You didn't list any users" 36 | 37 | if [ -e "$SCHROOT_SPINDLE_CONF" ]; then 38 | ask_yn y "Overwrite existing config '$SCHROOT_SPINDLE_CONF'?" || die "You said no. Exiting" 39 | rm -rf "$ETC_SCHROOT_SPINDLE" 40 | fi 41 | 42 | mkdir -p $(dirname "$SCHROOT_SPINDLE_CONF") 43 | cat << EOF > "$SCHROOT_SPINDLE_CONF" || die "Failed to configure schroot" 44 | [spindle] 45 | type=directory 46 | description=Debian jessie for spindle 47 | directory=$TARGET_DIR 48 | preserve-environment=true 49 | profile=spindle 50 | users=$USERS 51 | groups=$USERS 52 | root-groups=root 53 | EOF 54 | 55 | printf "\nCreated %s:\n\n" "$SCHROOT_SPINDLE_CONF" 56 | cat "$SCHROOT_SPINDLE_CONF" 57 | printf "\n" 58 | 59 | if [ ! -e $ETC_SCHROOT_SPINDLE ]; then 60 | if [ -e /etc/schroot/default ]; then 61 | cp -a /etc/schroot/default $ETC_SCHROOT_SPINDLE 62 | else 63 | ## Should work for schroot 1.4 as in Ubuntu 10.04 64 | mkdir $ETC_SCHROOT_SPINDLE 65 | for FN in copyfiles mount nssdatabases; do 66 | cp -a /etc/schroot/${FN}-defaults $ETC_SCHROOT_SPINDLE/$FN 67 | done 68 | mv $ETC_SCHROOT_SPINDLE/mount $ETC_SCHROOT_SPINDLE/fstab 69 | fi 70 | fi 71 | 72 | cat << EOF > $ETC_SCHROOT_SPINDLE/config 73 | # Filesystems to mount inside the chroot. 74 | FSTAB="$ETC_SCHROOT_SPINDLE/fstab" 75 | 76 | # Files to copy from the host system into the chroot. 77 | COPYFILES="$ETC_SCHROOT_SPINDLE/copyfiles" 78 | 79 | # System NSS databases to copy into the chroot. 80 | NSSDATABASES="$ETC_SCHROOT_SPINDLE/nssdatabases" 81 | EOF 82 | 83 | # We want rbind of /home for cases where /home is provided by autofs 84 | # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648459 85 | sed $ETC_SCHROOT_SPINDLE/fstab -e "s|^\(/home.*\),bind\(.*\)|\1,rbind\2|" > $ETC_SCHROOT_SPINDLE/fstab.new || true 86 | mv $ETC_SCHROOT_SPINDLE/fstab.new $ETC_SCHROOT_SPINDLE/fstab || true 87 | # Delete rather than comment out, as schroot 1.4 has no support for comments 88 | # in nssdatabases 89 | sed -i $ETC_SCHROOT_SPINDLE/nssdatabases -e "/^passwd$/d" 90 | sed -i $ETC_SCHROOT_SPINDLE/nssdatabases -e "/^shadow$/d" 91 | sed -i $ETC_SCHROOT_SPINDLE/nssdatabases -e "/^group$/d" 92 | 93 | debootstrap \ 94 | --include="qemu,bash-completion,augeas-tools,debootstrap,less,\ 95 | sudo,parted,openssh-client,e2fsprogs,dosfstools,squashfs-tools,bzip2,git,zerofree" \ 96 | jessie "$TARGET_DIR" http://http.debian.net/debian || die "Debootstrap failed" 97 | 98 | # Copy passwd/shadow/group databases 99 | getent passwd > "$TARGET_DIR/etc/passwd" 100 | getent shadow > "$TARGET_DIR/etc/shadow" 101 | getent group > "$TARGET_DIR/etc/group" 102 | 103 | # Disable launch of services in chroot 104 | printf '#!/bin/sh\nexit 101\n' > "$TARGET_DIR"/usr/sbin/policy-rc.d 105 | chmod 755 "$TARGET_DIR"/usr/sbin/policy-rc.d 106 | 107 | # Make sure sudo is enabled within chroot 108 | chmod +w "$TARGET_DIR"/etc/sudoers 109 | echo "%admin ALL=(ALL) ALL" >> "$TARGET_DIR"/etc/sudoers 110 | chmod -w "$TARGET_DIR"/etc/sudoers 111 | 112 | printf "Please enter the password you would like for your schroot user (needed for sudo)\n" 113 | schroot -c spindle --directory=/tmp passwd $USERS 114 | 115 | printf "\nchroot created at '%s'. Use \`schroot -c spindle\` to enter it\n" "$TARGET_DIR" 116 | FINISHED_SUCCESSFULLY=1 117 | -------------------------------------------------------------------------------- /wheezy-stage1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -e 7 | 8 | . ./common 9 | 10 | CURIMG=stage1.$IMGFORMAT 11 | 12 | # Security for these keys doesn't matter: just using ssh as it's convenient 13 | # It's not easy to disable authentication, so just use passwordless keys. 14 | 15 | # could be generated with dropbearkey -t dss -f 16 | # ./etc/dropbear/dropbear_dss_host_key and base64 encoding the result 17 | DROPBEAR_DSS_KEY=$(cat < qemu_rootfs/etc/dropbear/dropbear_dss_host_key && 68 | printf "%s" "$PRIVATE_SSH_KEY" > qemu_arm_key && 69 | chmod 600 qemu_arm_key && 70 | printf "%s" "$PUBLIC_SSH_KEY" > qemu_arm_key.pub && 71 | cp -a qemu_arm_key.pub qemu_rootfs/root 72 | } 73 | 74 | INIT_SH=$(cat <<\EOF 75 | #!/bin/sh 76 | 77 | export HOME=/home/root 78 | 79 | mount -t proc proc proc 80 | mount -t sysfs sys sys 81 | mount -t devtmpfs dev dev 82 | mkdir -p dev/pts 83 | mount -t devpts dev/pts dev/pts 84 | 85 | export PS1='($HOST) \w \$ ' 86 | 87 | export PATH 88 | 89 | ifconfig eth0 10.0.2.15 90 | route add default gw 10.0.2.2 91 | 92 | [ "$(date +%s)" -lt 1000 ] && rdate 10.0.2.2 # or time-b.nist.gov 93 | 94 | mount -t tmpfs /tmp /tmp 95 | 96 | mount -o noatime /dev/sdb2 /mnt 97 | [ -d /mnt/tmp ] && mount --bind /tmp /mnt/tmp 98 | 99 | mount -t tmpfs /home /home 100 | mkdir -p /home/root 101 | cd $HOME 102 | 103 | mkdir -p /home/root/.ssh 104 | cp -a /root/qemu_arm_key.pub /home/root/.ssh/authorized_keys 105 | chmod 600 /home/root/.ssh/authorized_keys 106 | dropbear -E -s 107 | exec /sbin/oneit -c /dev/ttyAMA0 /bin/ash 108 | EOF 109 | ) 110 | 111 | replace_init_sh() { 112 | printf "%s" "$INIT_SH" > qemu_rootfs/sbin/init.sh 113 | } 114 | 115 | do_second_stage_debootstrap() { 116 | onvm_chroot sh -ex - < /etc/udev/rules.d/10-local-rpi.rules 127 | EOF 128 | } 129 | 130 | cd $WORKDIR 131 | dotask branch_image ../$OUTDIR/stage0.$IMGFORMAT $CURIMG 132 | dotask download_if_necessary http://asbradbury.org/tmp/raspi/simple-root-filesystem-armv6l.tar.bz2 133 | dotask download_if_necessary http://asbradbury.org/tmp/raspi/system-image-armv6l.tar.bz2 134 | dotask download_if_necessary http://asbradbury.org/tmp/raspi/dropbearmulti-armv6l 135 | [ -f zImage ] || tar -xf system-image-armv6l.tar.bz2 --strip-components=1 system-image-armv6l/zImage 136 | tar -xvf simple-root-filesystem-armv6l.tar.bz2 137 | rm -rf qemu_rootfs 138 | mv simple-root-filesystem-armv6l qemu_rootfs 139 | dotask setup_dropbear 140 | dotask replace_init_sh 141 | dotask mksquashfs qemu_rootfs qemu_rootfs.sqf -noappend -all-root 142 | dotask run_qemu $CURIMG 143 | dotask do_second_stage_debootstrap 144 | #dotask configure_udev 145 | dotask shutdown_qemu 146 | dotask finish_image 147 | -------------------------------------------------------------------------------- /wheezy-stage4-lxde: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -ex 7 | 8 | . ./common 9 | 10 | CURIMG=stage4-lxde.$IMGFORMAT 11 | 12 | install_packages() { 13 | # we may want to break out DEBIAN_FRONTEND=noninteractive 14 | ssh_in_to_qemu chroot /mnt sh -l -ex - < /etc/apt/sources.list.d/collabora.list 43 | apt-key add - <yes|no|" 117 | 118 | apt-get install -y raspberrypi-artwork 119 | # change background 120 | update-alternatives --install /usr/share/images/desktop-base/desktop-background \ 121 | desktop-background /usr/share/raspberrypi-artwork/raspberry-pi-logo.png 100 122 | PCMANFMCFG=/etc/xdg/pcmanfm/LXDE/pcmanfm.conf 123 | sed "$PCMANFMCFG" -i -e 's/^wallpaper_mode.*/wallpaper_mode=3/' 124 | sed "$PCMANFMCFG" -i -e 's/^desktop_bg.*/desktop_bg=#ffffff/' 125 | 126 | # while we're at it, let's not use xdg-su which Debian doesn't even provide 127 | sed "$PCMANFMCFG" -i -e 's/^su_cmd.*/su_cmd=gksu %s/' 128 | EOF 129 | } 130 | 131 | setup_automounting() { 132 | onvm_chroot sh -l -e <<\EOF1 133 | apt-get install -y udisks 134 | cat < /etc/polkit-1/localauthority/50-local.d/55-storage.pkla 135 | [Storage Permissions] 136 | Identity=unix-group:plugdev 137 | Action=org.freedesktop.udisks.filesystem-mount;org.freedesktop.udisks.drive-eject;org.freedesktop.udisks.drive-detach;org.freedesktop.udisks.luks-unlock;org.freedesktop.udisks.inhibit-polling;org.freedesktop.udisks.drive-set-spindown 138 | ResultAny=yes 139 | ResultActive=yes 140 | ResultInactive=no 141 | EOF2 142 | EOF1 143 | } 144 | 145 | install_and_configure_lightdm() { 146 | onvm_chroot sh -l -e <<\EOF 147 | apt-get install --no-install-recommends -y lightdm gnome-themes-standard-data gnome-icon-theme 148 | apt-get install -y policykit-1 149 | update-rc.d lightdm disable 2 150 | sed -i /etc/lightdm/lightdm-gtk-greeter.conf -e "s/^background.*/background=#ffffff/" 151 | # TODO: maybe change the computer icon to the Raspberry Pi logo? See 152 | # https://wiki.archlinux.org/index.php/LightDM#Changing_the_Icon 153 | 154 | # Source /etc/profile and ~/.profile through XSession.d to ensure PATH is set 155 | # properly when lightdm is used. 156 | cat <<\EOF1 > /etc/X11/Xsession.d/75source-profile 157 | [ -f /etc/profile ] && . /etc/profile 158 | [ -f "$HOME/.profile" ] && . "$HOME/.profile" 159 | EOF1 160 | EOF 161 | } 162 | 163 | install_qt5() { 164 | onvm_chroot sh -l -e <<\EOF 165 | apt-get update 166 | apt-get install --allow-unauthenticated -y qt50-snapshot qt50-quick-particle-examples 167 | EOF 168 | } 169 | 170 | cd $WORKDIR 171 | dotask branch_image ../$OUTDIR/stage3.$IMGFORMAT $CURIMG 172 | dotask run_qemu $CURIMG 173 | dotask mount_apt_cache 174 | dotask disable_starting_services 175 | dotask install_packages 176 | dotask configure_gksu 177 | [ -n "$RASPBIAN" ] && dotask install_omxplayer 178 | dotask configure_lxde 179 | dotask install_and_configure_lightdm 180 | dotask setup_automounting 181 | #[ -z "$RASPBIAN" ] && dotask install_qt5 182 | [ -n "$RASPBIAN" ] && dotask install_wayland 183 | dotask save_space_using_hardlink 184 | dotask allow_starting_services 185 | dotask update_issue 186 | dotask fingerprint_debian 187 | dotask shutdown_qemu 188 | dotask finish_image 189 | -------------------------------------------------------------------------------- /misc/Raspberry_Pi_Logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /wheezy-stage2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -ex 7 | 8 | . ./common 9 | 10 | CURIMG=stage2.$IMGFORMAT 11 | 12 | # Make changes to /etc/skel before we start adding new users 13 | modify_etc_skel() { 14 | onvm_chroot sh -l -ex - <<\EOF 15 | # Essentially the same as the default debian one, but enable color by default 16 | # and slightly tweak PS1 17 | cat <<\EOF1 > /etc/skel/.bashrc 18 | # ~/.bashrc: executed by bash(1) for non-login shells. 19 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 20 | # for examples 21 | 22 | # If not running interactively, don't do anything 23 | [ -z "$PS1" ] && return 24 | 25 | # don't put duplicate lines or lines starting with space in the history. 26 | # See bash(1) for more options 27 | HISTCONTROL=ignoreboth 28 | 29 | # append to the history file, don't overwrite it 30 | shopt -s histappend 31 | 32 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 33 | HISTSIZE=1000 34 | HISTFILESIZE=2000 35 | 36 | # check the window size after each command and, if necessary, 37 | # update the values of LINES and COLUMNS. 38 | shopt -s checkwinsize 39 | 40 | # If set, the pattern "**" used in a pathname expansion context will 41 | # match all files and zero or more directories and subdirectories. 42 | #shopt -s globstar 43 | 44 | # make less more friendly for non-text input files, see lesspipe(1) 45 | #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 46 | 47 | # set variable identifying the chroot you work in (used in the prompt below) 48 | if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then 49 | debian_chroot=$(cat /etc/debian_chroot) 50 | fi 51 | 52 | # set a fancy prompt (non-color, unless we know we "want" color) 53 | case "$TERM" in 54 | xterm-color) color_prompt=yes;; 55 | esac 56 | 57 | # uncomment for a colored prompt, if the terminal has the capability; turned 58 | # off by default to not distract the user: the focus in a terminal window 59 | # should be on the output of commands, not on the prompt 60 | force_color_prompt=yes 61 | 62 | if [ -n "$force_color_prompt" ]; then 63 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 64 | # We have color support; assume it's compliant with Ecma-48 65 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 66 | # a case would tend to support setf rather than setaf.) 67 | color_prompt=yes 68 | else 69 | color_prompt= 70 | fi 71 | fi 72 | 73 | if [ "$color_prompt" = yes ]; then 74 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] ' 75 | else 76 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 77 | fi 78 | unset color_prompt force_color_prompt 79 | 80 | # If this is an xterm set the title to user@host:dir 81 | case "$TERM" in 82 | xterm*|rxvt*) 83 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 84 | ;; 85 | *) 86 | ;; 87 | esac 88 | 89 | # enable color support of ls and also add handy aliases 90 | if [ -x /usr/bin/dircolors ]; then 91 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 92 | alias ls='ls --color=auto' 93 | #alias dir='dir --color=auto' 94 | #alias vdir='vdir --color=auto' 95 | 96 | alias grep='grep --color=auto' 97 | alias fgrep='fgrep --color=auto' 98 | alias egrep='egrep --color=auto' 99 | fi 100 | 101 | # some more ls aliases 102 | #alias ll='ls -l' 103 | #alias la='ls -A' 104 | #alias l='ls -CF' 105 | 106 | # Alias definitions. 107 | # You may want to put all your additions into a separate file like 108 | # ~/.bash_aliases, instead of adding them here directly. 109 | # See /usr/share/doc/bash-doc/examples in the bash-doc package. 110 | 111 | if [ -f ~/.bash_aliases ]; then 112 | . ~/.bash_aliases 113 | fi 114 | 115 | # enable programmable completion features (you don't need to enable 116 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 117 | # sources /etc/bash.bashrc). 118 | if [ -f /etc/bash_completion ] && ! shopt -oq posix; then 119 | . /etc/bash_completion 120 | fi 121 | EOF1 122 | EOF 123 | } 124 | 125 | # For now we add a root password (this is a totally minimal system). It should be 126 | # disabled at a later stage 127 | configure_users() { 128 | onvm_chroot sh -l -ex - < /etc/fstab 138 | proc /proc proc defaults 0 0 139 | /dev/mmcblk0p1 /boot vfat defaults 0 2 140 | /dev/mmcblk0p2 / ext4 defaults,noatime 0 1 141 | EOF2 142 | # Automatically repair if fsck finds issues 143 | sed -i /etc/default/rcS -e "s/^#FSCKFIX=no/FSCKFIX=yes/" 144 | EOF1 145 | } 146 | 147 | configure_sources_list() { 148 | SECTIONS="main contrib non-free" 149 | if [ -n "$RASPBIAN" ]; then 150 | SECTIONS="$SECTIONS rpi" 151 | fi 152 | onvm_chroot sh -l -e - < /etc/apt/sources.list 154 | printf "# Uncomment line below then 'apt-get update' to enable 'apt-get source'\n" >> /etc/apt/sources.list 155 | printf "#deb-src $DEB_MIRROR wheezy $SECTIONS\n" >> /etc/apt/sources.list 156 | EOF 157 | } 158 | 159 | configure_network_interfaces() { 160 | onvm_chroot sh -l -e - <<\EOF1 161 | cat < /etc/network/interfaces 162 | auto lo 163 | 164 | iface lo inet loopback 165 | iface eth0 inet dhcp 166 | EOF2 167 | # Use the qemu default nameserver 168 | printf "nameserver 10.0.2.3\n" > /etc/resolv.conf 169 | EOF1 170 | } 171 | 172 | configure_hostname() { 173 | onvm_chroot sh -l -e - < /etc/hostname 175 | printf "127.0.1.1\traspberrypi\n" >> /etc/hosts 176 | EOF 177 | } 178 | 179 | disable_eth_and_wlan_renaming() { 180 | onvm_chroot sh -l -e - <> /etc/inittab 193 | printf "T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100\n" >> /etc/inittab 194 | EOF 195 | } 196 | 197 | adjust_motd() { 198 | onvm_chroot sh -l -e <<\EOF1 199 | cat <> /etc/motd.tail 200 | 201 | Type 'startx' to launch a graphical session 202 | 203 | EOF2 204 | EOF1 205 | } 206 | 207 | install_firmware() { 208 | onvm_chroot sh -l -e - < /etc/apt/sources.list.d/raspi.list 210 | echo "deb http://archive.raspberrypi.org/debian/ wheezy main staging" > /etc/apt/sources.list.d/raspi.list 211 | apt-key add - < /boot/cmdline.txt 247 | cat < /boot/config.txt 248 | # For more options and information see 249 | # http://www.raspberrypi.org/documentation/configuration/config-txt.md 250 | # Some settings may impact device functionality. See link above for details 251 | 252 | # uncomment if you get no picture on HDMI for a default "safe" mode 253 | #hdmi_safe=1 254 | 255 | # uncomment this if your display has a black border of unused pixels visible 256 | # and your display can output without overscan 257 | #disable_overscan=1 258 | 259 | # uncomment the following to adjust overscan. Use positive numbers if console 260 | # goes off screen, and negative if there is too much border 261 | #overscan_left=16 262 | #overscan_right=16 263 | #overscan_top=16 264 | #overscan_bottom=16 265 | 266 | # uncomment to force a console size. By default it will be display's size minus 267 | # overscan. 268 | #framebuffer_width=1280 269 | #framebuffer_height=720 270 | 271 | # uncomment if hdmi display is not detected and composite is being output 272 | #hdmi_force_hotplug=1 273 | 274 | # uncomment to force a specific HDMI mode (this will force VGA) 275 | #hdmi_group=1 276 | #hdmi_mode=1 277 | 278 | # uncomment to force a HDMI mode rather than DVI. This can make audio work in 279 | # DMT (computer monitor) modes 280 | #hdmi_drive=2 281 | 282 | # uncomment to increase signal to HDMI, if you have interference, blanking, or 283 | # no display 284 | #config_hdmi_boost=4 285 | 286 | # uncomment for composite PAL 287 | #sdtv_mode=2 288 | 289 | #uncomment to overclock the arm. 700 MHz is the default. 290 | #arm_freq=800 291 | 292 | # Uncomment some or all of these to enable the optional hardware interfaces 293 | #dtparam=i2c_arm=on 294 | #dtparam=i2s=on 295 | #dtparam=spi=on 296 | 297 | # Uncomment this to enable the lirc-rpi module 298 | #dtoverlay=lirc-rpi 299 | 300 | # Additional overlays and parameters are documented /boot/overlays/README 301 | 302 | EOF1 303 | # cat < /etc/modprobe.d/raspi-blacklist.conf 304 | # # blacklist spi and i2c by default (many users don't need them) 305 | 306 | # blacklist spi-bcm2708 307 | # blacklist i2c-bcm2708 308 | # blacklist snd-soc-pcm512x 309 | # blacklist snd-soc-wm8804 310 | # EOF2 311 | cat < /etc/modprobe.d/ipv6.conf 312 | # Don't load ipv6 by default 313 | alias net-pf-10 off 314 | #alias ipv6 off 315 | EOF3 316 | EOF 317 | } 318 | 319 | # Relies on the fact my repo was already added in install_firmware 320 | install_raspi_config() { 321 | onvm_chroot sh -l -e - <<\EOF 322 | apt-get install -y raspi-config 323 | # Automatically log in on tty1 until raspi-config configures it to do 324 | # otherwise 325 | sed -i /etc/inittab -e "s|^\(1:2345.*getty.*tty1.*\)|\ 326 | #\1 # RPICFG_TO_ENABLE\n1:2345:respawn:/bin/login -f root tty1 /dev/tty1 2>\&1 # RPICFG_TO_DISABLE|" 327 | EOF 328 | } 329 | 330 | # Deprecated in favour of using the Debian packaging 331 | download_and_extract_firmware_if_necessary() { 332 | if ! [ -d firmware ]; then 333 | git clone git://github.com/raspberrypi/firmware.git 334 | fi 335 | } 336 | 337 | cd $WORKDIR 338 | dotask branch_image ../$OUTDIR/stage1.$IMGFORMAT $CURIMG 339 | dotask run_qemu $CURIMG 340 | dotask mount_apt_cache 341 | dotask disable_starting_services 342 | dotask modify_etc_skel 343 | dotask configure_users 344 | dotask configure_fstab 345 | dotask configure_sources_list 346 | dotask configure_network_interfaces 347 | dotask configure_hostname 348 | dotask disable_eth_and_wlan_renaming 349 | dotask configure_inittab 350 | dotask adjust_motd 351 | dotask install_firmware 352 | dotask install_raspi_config 353 | dotask update_issue 354 | dotask allow_starting_services 355 | dotask shutdown_qemu 356 | #dotask download_and_extract_firmware_if_necessary 357 | sudo -v 358 | # We have to copy the /boot from root partition to boot partition. Temporary 359 | # hack 360 | dotask attach_image_to_nbd $CURIMG $NBD_DEV 361 | mkdir -p boot 362 | dotask sudo mount $BOOT_DEV boot 363 | mkdir -p rootfs 364 | dotask sudo mount $ROOT_DEV rootfs 365 | dotask sudo mv rootfs/boot/* boot 366 | universal_cleanup 367 | dotask finish_image 368 | -------------------------------------------------------------------------------- /common: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -e 7 | 8 | . ./config 9 | 10 | run_qemu() { 11 | rm fifo.out fifo.in || true 12 | mkfifo fifo.out fifo.in 13 | qemu-system-arm -M versatilepb -cpu arm1136-r2 -m 256 -monitor none -display none -vga none -no-reboot \ 14 | -kernel zImage -hda qemu_rootfs.sqf -drive file=$1,index=1,media=disk,cache=unsafe \ 15 | -drive file=wheezy_apt_cache.$IMGFORMAT,index=2,media=disk,cache=unsafe \ 16 | -append "root=/dev/sda rw init=/sbin/init.sh panic=1 PATH=/bin:/sbin console=ttyAMA0 HOST=armv6l"\ 17 | -net nic,model=rtl8139 -net user -redir tcp:22000::22 -daemonize -serial pipe:fifo \ 18 | -pidfile qemu.pid 19 | sleep 10 20 | } 21 | 22 | ssh_in_to_qemu() { 23 | ssh -i qemu_arm_key -p 22000 -lroot localhost "$@" 24 | } 25 | 26 | scp_in_to_qemu() { 27 | scp -i qemu_arm_key -P 22000 "$1" root@localhost:"$2" 28 | } 29 | 30 | scp_r_from_qemu() { 31 | scp -r -i qemu_arm_key -P 22000 root@localhost:"$1" "$2" 32 | } 33 | 34 | onvm_chroot() { 35 | ssh_in_to_qemu chroot /mnt "$@" 36 | } 37 | 38 | shutdown_qemu() { 39 | ssh_in_to_qemu "sync && umount -a" || true 40 | echo "exit" > fifo.in 41 | sleep 5 42 | if [ -e qemu.pid ]; then 43 | QEMU_PID=$(cat qemu.pid) 44 | while [ -n "$QEMU_PID" ]; do 45 | set +e 46 | kill -0 $QEMU_PID 2>/dev/null 47 | if [ $? -eq 0 ]; then 48 | printf "Qemu pid %s not finished yet. Waiting\n" "$QEMU_PID" 49 | sleep 1 50 | else 51 | QEMU_PID="" 52 | fi 53 | set -e 54 | done 55 | fi 56 | rm fifo.in 57 | rm fifo.out 58 | # sleep 15 59 | } 60 | 61 | attach_image_to_nbd() { 62 | # use -v as we seem to have problems otherwise... 63 | sudo qemu-nbd --nocache -v -c $2 $1 & 64 | sleep 5 65 | } 66 | 67 | detach_image_from_nbd() { 68 | sudo qemu-nbd -d $1 69 | } 70 | 71 | inspect_image() { 72 | cd work 73 | qemu-img create -f $IMGFORMAT -b ../$1 temp.$IMGFORMAT 74 | # Sigh http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=390433 75 | trap '[ -p fifo.in ] && shutdown_qemu' EXIT 76 | trap '[ -p fifo.in ] && shutdown_qemu; trap - INT; kill -INT $$' INT 77 | run_qemu temp.$IMGFORMAT 78 | ssh_in_to_qemu # -t chroot /mnt bash -l 79 | shutdown_qemu 80 | cd $OLDPWD 81 | } 82 | 83 | branch_image() { 84 | qemu-img create -f $IMGFORMAT -b $1 $2 85 | } 86 | 87 | write_image() { 88 | attach_image_to_nbd $1 /dev/nbd0 && 89 | sudo dd if=/dev/nbd0 of=$2 bs=4M && 90 | detach_image_from_nbd /dev/nbd0 91 | } 92 | 93 | convert_image() { 94 | qemu-img convert -f $IMGFORMAT -O raw $1 $2 95 | } 96 | 97 | export_image_for_release() { 98 | cd work 99 | qemu-img create -f $IMGFORMAT -b ../$1 temp.$IMGFORMAT 100 | run_qemu temp.$IMGFORMAT 101 | # Change mirror in sources.list to our preferred one. This will go horribly 102 | # wrong if there is more than one entry in sources.list 103 | onvm_chroot sh -l -ex <<\EOF 104 | if grep armhf /etc/rpi-issue; then 105 | sed -i /etc/apt/sources.list -e "s|^deb [^ ]*|deb http://mirrordirector.raspbian.org/raspbian/|" 106 | else 107 | sed -i /etc/apt/sources.list -e "s|^deb [^ ]*|deb http://http.debian.net/debian|" 108 | fi 109 | cp /usr/share/doc/raspi-config/sample_profile_d.sh /etc/profile.d/raspi-config.sh 110 | apt-get update 111 | # Default to a known-good nameserver 112 | printf "nameserver 8.8.8.8\n" > /etc/resolv.conf 113 | /etc/init.d/fake-hwclock stop # save current time 114 | #rm /usr/bin/raspi-config 115 | #cd /usr/bin 116 | #wget https://raw.github.com/asb/raspi-config/master/raspi-config 117 | #chmod +x raspi-config 118 | cat < /etc/apt/sources.list.d/raspi.list 119 | deb http://archive.raspberrypi.org/debian/ wheezy main 120 | # Uncomment line below then 'apt-get update' to enable 'apt-get source' 121 | #deb-src http://archive.raspberrypi.org/debian/ wheezy main 122 | EOF1 123 | apt-get update 124 | EOF 125 | shutdown_qemu 126 | attach_image_to_nbd temp.$IMGFORMAT /dev/nbd0 127 | sudo zerofree -v /dev/nbd0p2 128 | mkdir -p rootfs boot 129 | sudo mount $BOOT_DEV boot 130 | sudo mount $ROOT_DEV rootfs 131 | sudo cp rootfs/etc/rpi-issue boot/issue.txt 132 | sudo wget http://asbradbury.org/tmp/raspi/oracle_license.txt -O boot/LICENSE.oracle 133 | [ -n "$RASPBIAN" ] && sudo mv rootfs/etc/ld.so.preload.disable rootfs/etc/ld.so.preload 134 | if [ -n "$NOOBS" ]; then 135 | mkdir -p ../noobs 136 | sudo tar -C boot -cpJf ../noobs/boot.tar.xz . 137 | sudo tar -C rootfs -cpJf ../noobs/root.tar.xz . 138 | cat <<\EOF > ../noobs/partition_setup.sh 139 | #!/bin/sh 140 | 141 | set -ex 142 | 143 | if [ -z "$part1" ] || [ -z "$part2" ]; then 144 | printf "Error: missing environment variable part1 or part2\n" 1>&2 145 | exit 1 146 | fi 147 | 148 | mkdir -p /tmp/1 /tmp/2 149 | 150 | mount "$part1" /tmp/1 151 | mount "$part2" /tmp/2 152 | 153 | sed /tmp/1/cmdline.txt -i -e "s|root=/dev/[^ ]*|root=${part2}|" 154 | sed /tmp/2/etc/fstab -i -e "s|^.* / |${part2} / |" 155 | sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |" 156 | 157 | umount /tmp/1 158 | umount /tmp/2 159 | EOF 160 | cat <<\EOF > ../noobs/partitions.json 161 | { 162 | "partitions": [ 163 | { 164 | "label": "boot", 165 | "filesystem_type": "FAT", 166 | "partition_size_nominal": 60, 167 | "want_maximised": false, 168 | "uncompressed_tarball_size": 19 169 | }, 170 | { 171 | "label": "root", 172 | "filesystem_type": "ext4", 173 | "partition_size_nominal": 2500, 174 | "want_maximised": true, 175 | "mkfs_options": "-O ^huge_file", 176 | "uncompressed_tarball_size": 2280 177 | } 178 | ] 179 | } 180 | EOF 181 | 182 | cat <<\EOF > ../noobs/flavours.json 183 | { 184 | "flavours": [ 185 | { 186 | "name": "Raspbian - Boot to Scratch", 187 | "description": "A version of Raspbian that boots straight into Scratch" 188 | }, 189 | { 190 | "name": "Raspbian", 191 | "description": "A Debian wheezy port, optimised for the Raspberry Pi" 192 | } 193 | ] 194 | } 195 | EOF 196 | 197 | cat <<\EOF > ../noobs/os.json 198 | { 199 | "name": "Raspbian", 200 | "version": "wheezy", 201 | "release_date": "2015-05-05", 202 | "kernel": "3.18", 203 | "description": "A community-created port of Debian wheezy, optimised for the Raspberry Pi" 204 | } 205 | EOF 206 | 207 | cat <<\EOF > ../noobs/release_notes.txt 208 | 2015-05-05: 209 | * Updated UI changes 210 | * Updated firmware 211 | * Install raspberrypi-net-mods 212 | * Install avahi-daemon 213 | * Add user pi to new i2c and spi groups 214 | * Modified udev rules for i2c and spi devices 215 | 2015-02-16: 216 | * Newer firmware with various fixes 217 | * New Sonic Pi release 218 | * Pi2 compatible RPi.GPIO 219 | * Updated Wolfram Mathematica 220 | 2015-01-31: 221 | * Support for Pi2 222 | * Newer firmware 223 | * New Sonic Pi release 224 | * Updated Scratch 225 | * New Wolfram Mathematica release 226 | * Updated Epiphany 227 | 2014-12-24: 228 | * Fix regression with omission of python-pygame 229 | 2014-12-22: 230 | * New firmware with variosu fixes and improvements 231 | * New UI configuration for lxde 232 | * Various package updates 233 | * python3-pygame preinstalled 234 | * 'nuscratch', scratch running on the Cog StackVM 235 | * Misc other changes 236 | 2014-09-09: 237 | * New firmware with various fixes and improvements 238 | * Minecraft Pi pre-installed 239 | * Sonic Pi upgraded to 2.0 240 | * Include Epiphany browser work from Collabora 241 | * Switch to Java 8 from Java 7 242 | * Updated Mathematica 243 | * Misc minor configuration changes 244 | 2014-06-20: 245 | * New firmware with various fixes, and kernel bugfix 246 | 2014-06-02: 247 | * Many, many firmware updates with major USB improvements 248 | * pyserial installed by default 249 | * picamera installed by default 250 | 2014-01-07: 251 | * Firmware updated 252 | * Some space saved on the root filesystem 253 | 2013-12-20: 254 | * Firmware updated, includes V4L2 fixes 255 | * Update omxplayer 256 | 2013-12-18: 257 | * Firmware updated and now using kernel 3.10. Many, many improvements 258 | * fbturbo XOrg driver is now included and enabled by default. Thanks to 259 | ssvb https://github.com/ssvb/xf86-video-fbturbo 260 | * Update Scratch image with further bug fixes 261 | * Include Wolfram Mathematica 262 | * Update to PyPy 2.2 263 | * Update omxplayer 264 | * Include v4l-utils for use with experimental V4L2 Raspberry Pi camera driver 265 | * Update squeak-vm to fix issues with loading JPEGs 266 | 2013-09-25: 267 | * Update Scratch image for further performance improvements 268 | * Include Oracle JDK 269 | * At least a 4GiB SD card is now required (see above) 270 | * Include PyPy 2.1 271 | * Include base piface packages 272 | * Update raspi-config to include bugfix for inheriting language settings 273 | from NOOBS 274 | 2013-09-10: 275 | * Updated to current top of tree firmware 276 | * Update squeak-vm, including fastblit optimised for the Raspbery Pi 277 | * Include Sonic Pi and a fixed jackd2 package 278 | * Support boot to Scratch 279 | * Inherit keyboard and language settings from NOOBS 280 | EOF 281 | tar -C ../marketing -cf ../noobs/marketing.tar . 282 | fi 283 | sleep 10 284 | sudo umount $BOOT_DEV 285 | sudo umount $ROOT_DEV 286 | detach_image_from_nbd /dev/nbd0 287 | convert_image temp.$IMGFORMAT ../$2 288 | universal_cleanup 289 | } 290 | 291 | disable_starting_services() { 292 | ssh_in_to_qemu chroot /mnt sh -ex - < /usr/sbin/policy-rc.d 295 | chmod 755 /usr/sbin/policy-rc.d 296 | EOF 297 | } 298 | 299 | allow_starting_services() { 300 | ssh_in_to_qemu chroot /mnt sh -ex - < /etc/rpi-issue 330 | EOF 331 | } 332 | 333 | # Create a list of all installed packages, all manually installed packages and 334 | # the debconf selections 335 | fingerprint_debian() { 336 | FNGPRNT_DIR="$CURIMG.fingerprint" && 337 | onvm_chroot sh -l -e < dpkg_selections 341 | dpkg -l > dpkg_l 342 | apt-mark showauto > apt-mark_showauto 343 | debconf-get-selections > debconf_selections 344 | EOF 345 | scp_r_from_qemu "/mnt/tmp/$FNGPRNT_DIR" . && 346 | cd "$FNGPRNT_DIR" && 347 | grep "[[:space:]]install$" dpkg_selections | cut -f1 | sort apt-mark_showauto - | uniq -u > manually_installed_packages && 348 | cd "$OLDPWD" 349 | } 350 | 351 | finish_image() { 352 | chmod -w $CURIMG && 353 | mkdir -p ../$OUTDIR && 354 | mv -f $CURIMG ../$OUTDIR && 355 | if [ -d "$CURIMG.fingerprint" ]; then 356 | rm -rf "../$OUTDIR/$CURIMG.fingerprint" && 357 | mv "$CURIMG.fingerprint" ../$OUTDIR 358 | fi && 359 | FINISHED_SUCCESSFULLY=1 && 360 | printf "Completed script successfully\n" 361 | } 362 | 363 | # Usage: ask_yn default prompt [printf_args...] 364 | # Read a Yes / No user response. If $ASK_YN_USE_DEFAULT is set, assume the 365 | # default. Return of 0 indicates a yes, and non-zero is no. 366 | ask_yn() { 367 | OPT="y/n" 368 | case "$1" in 369 | y*|Y*) OPT="Y/n"; RET=0;; 370 | n*|N*) OPT="y/N"; RET=1;; 371 | *) die "Programmer error: invalid argument to ask_yn" 372 | esac 373 | shift 374 | if [ "$ASK_YN_USE_DEFAULT" ]; then 375 | return $RET 376 | else 377 | PROMPT=$1 378 | shift 379 | printf "$PROMPT [$OPT]: " "$@" && read YN 380 | case "$YN" in 381 | y*|Y*) return 0;; 382 | n*|N*) return 1;; 383 | "") return $RET 384 | esac 385 | fi 386 | } 387 | 388 | # Usage: read_val var default prompt [printf_args...] 389 | read_val() { 390 | RV_VAR=$1 391 | RV_DEFAULT=$2 392 | RV_PROMPT=$3 393 | shift 3 394 | printf "$RV_PROMPT [$RV_DEFAULT]: " "$@" && read RV_VAL 395 | [ -z "$RV_VAL" ] && RV_VAL=$RV_DEFAULT 396 | eval "$RV_VAR=\$RV_VAL" 397 | } 398 | 399 | die() { 400 | FMTSTR=$1 401 | shift 402 | printf "Died: $FMTSTR\n" "$@" >&2 403 | exit 1 404 | } 405 | 406 | # do a task 407 | # Inspects $DOTASK_MODE to see if the user: 408 | # e*: wants to have the command echoed 409 | # q*: wants to be questioned as to whether to run, skip or quit. 410 | # If the task fails it asks the user whether to quit (default: y), or if 411 | # $DOTASK_QUIT_ON_FAILURE is set then quit without asking the user. 412 | dotask() { 413 | case "$DOTASK_MODE" in 414 | e*) printf "Run: '%s'\n" "$*"; false;; 415 | q*) printf "Run: '%s' [Y/n/q] ? " "$*" && read SHOULD_RUN; 416 | case "$SHOULD_RUN" in 417 | n*|N*|s*|S*) printf "Skip '%s'\n" "$*";; 418 | q*|Q*) die "Exit at user request";; 419 | *) false;; 420 | esac;; 421 | *) false;; 422 | esac || "$@" || { RC=$? 423 | [ -z "$DOTASK_QUIT_ON_FAILURE" ] && printf "'%s' failed (returned $RC) - Quit? [Y/n] : " "$*" && read YN 424 | case "$YN" in n*|N*) true ;; *) die "Failed while performing task: %s" "$*";; esac; 425 | } 426 | } 427 | 428 | 429 | FINISHED_SUCCESSFULLY=0 430 | CLEANED_UP=0 431 | WAS_TRAPPED=0 432 | 433 | # Sigh http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=390433 434 | trap 'WAS_TRAPPED=1; universal_cleanup' EXIT 435 | trap 'WAS_TRAPPED=1; universal_cleanup; trap - INT; kill -INT $$' INT 436 | 437 | universal_cleanup() { 438 | set +e 439 | if [ $CLEANED_UP -ne 1 ]; then 440 | printf "Initiating cleanup\n" 441 | trap - INT 442 | trap - EXIT 443 | [ -p fifo.in ] && shutdown_qemu 444 | [ -b "$BOOT_DEV" ] && sudo umount $BOOT_DEV 445 | [ -b "$ROOT_DEV" ] && sudo umount $ROOT_DEV 446 | [ -b "$NBD_DEV" ] && sudo umount $NBD_DEV 447 | [ -b "$NBD_DEV" ] && detach_image_from_nbd $NBD_DEV 448 | fi 449 | if [ $WAS_TRAPPED -eq 1 ] && [ $FINISHED_SUCCESSFULLY -eq 0 ]; then 450 | printf "Did not complete script successfully\n" 451 | fi 452 | set -e 453 | } 454 | -------------------------------------------------------------------------------- /wheezy-stage3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of spindle http://asbradbury.org/projects/spindle 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | set -ex 7 | 8 | . ./common 9 | 10 | WORKDIR=work 11 | OUTDIR=out 12 | CURIMG=stage3.$IMGFORMAT 13 | 14 | configure_apt() { 15 | onvm_chroot sh -l -ex - <<\EOF 16 | cat <<\EOF1 > /etc/apt/apt.conf.d/50raspi 17 | # never use pdiffs. Current implementation is very slow on low-powered devices 18 | Acquire::PDiffs "0"; 19 | 20 | # download up to 5 pdiffs: 21 | #Acquire::PDiffs::FileLimit "5"; 22 | EOF1 23 | EOF 24 | } 25 | 26 | set_debconf_selections() { 27 | ssh_in_to_qemu chroot /mnt sh -l -ex - < 59 | locales locales/locales_to_be_generated multiselect en_GB.UTF-8 UTF-8 60 | # Keyboard model: 61 | # Choices: 62 | keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC 63 | # Users allowed to start the X server: 64 | # Choices: Root Only, Console Users Only, Anybody 65 | x11-common x11-common/xwrapper/allowed_users select Anybody 66 | # Compose key: 67 | # Choices: No compose key, Right Alt (AltGr), Right Control, Right Logo key, Menu key, Left Logo key, Caps Lock 68 | keyboard-configuration keyboard-configuration/compose select No compose key 69 | # Country of origin for the keyboard: 70 | # Choices: 71 | keyboard-configuration keyboard-configuration/layout select English (UK) 72 | # for internal use 73 | keyboard-configuration keyboard-configuration/layoutcode string gb 74 | # Keymap to use: 75 | # Choices: 76 | keyboard-configuration keyboard-configuration/xkb-keymap select British English 77 | # Choices: English (UK), English (UK) - English (UK\, Colemak), English (UK) - English (UK\, Dvorak), English (UK) - English (UK\, Dvorak with UK punctuation), English (UK) - English (UK\, extended WinKeys), English (UK) - English (UK\, international with dead keys), English (UK) - English (UK\, Macintosh), English (UK) - English (UK\, Macintosh international), Other 78 | keyboard-configuration keyboard-configuration/variant select English (UK) 79 | # Geographic area: 80 | # Choices: Africa, America, Antarctica, Australia, Arctic, Asia, Atlantic, Europe, Indian, Pacific, SystemV, US, Etc 81 | tzdata tzdata/Areas select Etc 82 | # Method for temporarily toggling between national and Latin input: 83 | # Choices: No temporary switch, Both Logo keys, Right Alt (AltGr), Right Logo key, Left Alt, Left Logo key 84 | keyboard-configuration keyboard-configuration/switch select No temporary switch 85 | # Encoding to use on the console: 86 | # Choices: ARMSCII-8, CP1251, CP1255, CP1256, GEORGIAN-ACADEMY, GEORGIAN-PS, IBM1133, ISIRI-3342, ISO-8859-1, ISO-8859-10, ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, KOI8-R, KOI8-U, TIS-620, UTF-8, VISCII 87 | console-setup console-setup/charmap47 select UTF-8 88 | # Font tuning method for screen: 89 | # Choices: Native, Autohinter, None 90 | fontconfig-config fontconfig/hinting_type select Native 91 | # Font size: 92 | # Choices: 93 | console-setup console-setup/fontsize-fb47 select 16 94 | # The desktop environment to install when the desktop task is selected 95 | # Choices: gnome, kde, xfce 96 | tasksel tasksel/desktop multiselect xfce 97 | # Key to function as AltGr: 98 | # Choices: The default for the keyboard layout, No AltGr key, Right Alt (AltGr), Right Control, Right Logo key, Menu key, Left Alt, Left Logo key, Keypad Enter key, Both Logo keys, Both Alt keys 99 | keyboard-configuration keyboard-configuration/altgr select The default for the keyboard layout 100 | # Default locale for the system environment: 101 | # Choices: None, en_GB.UTF-8 102 | locales locales/default_environment_locale select en_GB.UTF-8 103 | SELEOF 104 | EOF 105 | } 106 | 107 | install_packages() { 108 | # we may want to break out DEBIAN_FRONTEND=noninteractive 109 | ssh_in_to_qemu chroot /mnt sh -l -ex - <<\EOF 110 | apt-get update 111 | # install some utils 112 | apt-get install -y ssh locales less fbset sudo psmisc strace module-init-tools ifplugd ed ncdu 113 | apt-get install -y console-setup keyboard-configuration debconf-utils parted unzip 114 | apt-get install -y build-essential manpages-dev python bash-completion gdb pkg-config 115 | apt-get install -y python-rpi.gpio v4l-utils 116 | apt-get install -y avahi-daemon 117 | apt-get install -y lua5.1 118 | [ "$(dpkg --print-architecture)" = armhf ] && apt-get install -y luajit 119 | apt-get install -y hardlink ca-certificates curl 120 | apt-get install -y fake-hwclock ntp nfs-common usbutils 121 | apt-get install -y --no-install-recommends cifs-utils 122 | apt-get install -y libraspberrypi-dev libraspberrypi-doc libfreetype6-dev 123 | # Install stuff for wireless 124 | apt-get install -y wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 \ 125 | firmware-libertas firmware-ralink firmware-realtek 126 | /etc/init.d/fake-hwclock stop # save current time 127 | update-rc.d hwclock.sh disable 128 | # Don't need to start these by default, wastes boot time 129 | update-rc.d nfs-common disable 130 | update-rc.d rpcbind disable 131 | apt-get install -y dosfstools 132 | EOF 133 | } 134 | 135 | cache_keymap() { 136 | onvm_chroot sh -l -e - <<\EOF 137 | setupcon --force --save-only -v 138 | /etc/init.d/fake-hwclock stop # save current time 139 | EOF 140 | } 141 | 142 | add_pi_user_to_groups() { 143 | onvm_chroot sh -l -ex - <<\EOF 144 | groupadd -f -r input 145 | groupadd -f -r spi 146 | groupadd -f -r i2c 147 | groupadd -f -r gpio 148 | for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c; do 149 | adduser pi $GRP 150 | done 151 | EOF 152 | } 153 | 154 | configure_useradd() { 155 | onvm_chroot sh -l -ex - <<\EOF 156 | sed -i /etc/default/useradd -e 's/^# SKEL=/SKEL=/' 157 | sed -i /etc/default/useradd -e 's|^SHELL=.*$|SHELL=/bin/bash|' 158 | EOF 159 | } 160 | 161 | make_udev_com_rule() { 162 | onvm_chroot sh -l -e - < /etc/udev/rules.d/99-com.rules 164 | printf 'SUBSYSTEM=="input", GROUP="input", MODE="0660"\n' >> /etc/udev/rules.d/99-com.rules 165 | printf 'SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"\n' >> /etc/udev/rules.d/99-com.rules 166 | printf 'SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"\n' >> /etc/udev/rules.d/99-com.rules 167 | EOF 168 | } 169 | 170 | configure_wifi() { 171 | onvm_chroot sh -l -e - <> /etc/network/interfaces 173 | 174 | allow-hotplug wlan0 175 | iface wlan0 inet manual 176 | wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf 177 | iface default inet dhcp 178 | EOF1 179 | cat <<\EOF2 > /etc/wpa_supplicant/wpa_supplicant.conf 180 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 181 | update_config=1 182 | EOF2 183 | chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf 184 | adduser pi netdev 185 | EOF 186 | } 187 | 188 | apply_noobs_os_config() { 189 | onvm_chroot sh -l -ex - <<\EOF 190 | cat <<\EOF1 > /etc/init.d/apply_noobs_os_config 191 | #!/bin/sh 192 | ### BEGIN INIT INFO 193 | # Provides: apply_noobs_os_config 194 | # Required-Start: 195 | # Required-Stop: 196 | # Default-Start: 2 197 | # Default-Stop: 198 | # Short-Description: Apply config from /boot/os_config.json 199 | # Description: 200 | ### END INIT INFO 201 | 202 | . /lib/lsb/init-functions 203 | 204 | set -e 205 | 206 | case "$1" in 207 | start) 208 | log_daemon_msg "Applying config from /boot/os_config.json (if it exists)" 209 | if raspi-config --apply-os-config; then 210 | rm /etc/init.d/apply_noobs_os_config && update-rc.d apply_noobs_os_config remove 211 | log_end_msg 0 212 | else 213 | log_end_msg 1 214 | fi 215 | ;; 216 | *) 217 | echo "Usage: $0 start" >&2 218 | exit 3 219 | ;; 220 | esac 221 | EOF1 222 | chmod +x /etc/init.d/apply_noobs_os_config 223 | update-rc.d apply_noobs_os_config start 2 224 | EOF 225 | } 226 | 227 | remove_ssh_host_keys() { 228 | onvm_chroot sh -l -ex - <<\EOF 229 | rm -f /etc/ssh/ssh_host_*_key* 230 | cat <<\RCL | tee /etc/rc.local 231 | #!/bin/sh -e 232 | # 233 | # rc.local 234 | # 235 | # This script is executed at the end of each multiuser runlevel. 236 | # Make sure that the script will "exit 0" on success or any other 237 | # value on error. 238 | # 239 | # In order to enable or disable this script just change the execution 240 | # bits. 241 | # 242 | # By default this script does nothing. 243 | 244 | # Print the IP address 245 | _IP=$(hostname -I) || true 246 | if [ "$_IP" ]; then 247 | printf "My IP address is %s\n" "$_IP" 248 | fi 249 | 250 | exit 0 251 | RCL 252 | update-rc.d ssh disable # to be re-enabled at first boot when we regenerate ssh host keys 253 | cat <<\EOF1 > /etc/init.d/regenerate_ssh_host_keys 254 | #!/bin/sh 255 | ### BEGIN INIT INFO 256 | # Provides: regenerate_ssh_host_keys 257 | # Required-Start: 258 | # Required-Stop: 259 | # Default-Start: 2 260 | # Default-Stop: 261 | # Short-Description: Regenerate ssh host keys 262 | # Description: 263 | ### END INIT INFO 264 | 265 | . /lib/lsb/init-functions 266 | 267 | set -e 268 | 269 | case "$1" in 270 | start) 271 | log_daemon_msg "Regenerating ssh host keys (in background)" 272 | nohup sh -c "yes | ssh-keygen -q -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key && \ 273 | yes | ssh-keygen -q -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key && \ 274 | yes | ssh-keygen -q -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key && \ 275 | update-rc.d ssh enable && sync && \ 276 | rm /etc/init.d/regenerate_ssh_host_keys && \ 277 | update-rc.d regenerate_ssh_host_keys remove && \ 278 | printf '\nfinished\n' && invoke-rc.d ssh start" > /var/log/regen_ssh_keys.log 2>&1 & 279 | log_end_msg $? 280 | ;; 281 | *) 282 | echo "Usage: $0 start" >&2 283 | exit 3 284 | ;; 285 | esac 286 | EOF1 287 | chmod +x /etc/init.d/regenerate_ssh_host_keys 288 | update-rc.d regenerate_ssh_host_keys start 2 289 | EOF 290 | } 291 | 292 | configure_ifplugd() { 293 | onvm_chroot sh -l -ex - <<\EOF 294 | sed /etc/default/ifplugd -i -e 's/^INTERFACES.*/INTERFACES="auto"/' 295 | sed /etc/default/ifplugd -i -e 's/^HOTPLUG_INTERFACES.*/HOTPLUG_INTERFACES="all"/' 296 | EOF 297 | } 298 | 299 | add_opt_vc_lib_to_ld_so() { 300 | onvm_chroot sh -l -ex - < /etc/ld.so.conf.d/vmcs.conf 302 | ldconfig 303 | EOF 304 | } 305 | 306 | setup_sudoers() { 307 | onvm_chroot sh -l -ex - <> /etc/sudoers 310 | chmod -w /etc/sudoers 311 | usermod --pass='*' root # don't need root password any more 312 | EOF 313 | } 314 | 315 | # We use a swap file rather than a swap partition for greater flexibility 316 | setup_swap() { 317 | onvm_chroot sh -l -e - < /etc/dphys-swapfile 320 | EOF 321 | } 322 | 323 | setup_console_setup() { 324 | onvm_chroot sh -l -e - <<\EOF1 325 | cat <<\EOF2 > /etc/default/console-setup 326 | # CONFIGURATION FILE FOR SETUPCON 327 | 328 | # Consult the console-setup(5) manual page. 329 | 330 | ACTIVE_CONSOLES="/dev/tty[1-6]" 331 | 332 | CHARMAP="UTF-8" 333 | 334 | CODESET="guess" 335 | FONTFACE="" 336 | FONTSIZE="" 337 | 338 | VIDEOMODE= 339 | 340 | # The following is an example how to use a braille font 341 | # FONT='lat9w-08.psf.gz brl-8x8.psf' 342 | EOF2 343 | EOF1 344 | } 345 | 346 | # Spread the word about my favourite inputrc tweak 347 | tweak_inputrc() { 348 | onvm_chroot sh -l -e - <<\EOF1 349 | cat <<\EOF2 >> /etc/inputrc 350 | 351 | # mappings for up and down arrows search history 352 | # "\e[B": history-search-forward 353 | # "\e[A": history-search-backward 354 | EOF2 355 | EOF1 356 | } 357 | 358 | # It's not to have the sbin dirs in $PATH as that gives us ifconfig 359 | fiddle_default_PATH() { 360 | # This sed match is clearly brittle and specific to the current debian 361 | # /etc/profile 362 | onvm_chroot sh -l -ex - <> /etc/apt/sources.list.d/qt5pi.list 373 | apt-get update 374 | EOF 375 | } 376 | 377 | install_memcpy_replacement() { 378 | onvm_chroot sh -l -e <<\EOF 379 | apt-get install -y raspi-copies-and-fills 380 | mv /etc/ld.so.preload /etc/ld.so.preload.disable 381 | EOF 382 | } 383 | 384 | adjust_sysctl() { 385 | onvm_chroot sh -l -e <<\EOF 386 | printf "\n# rpi tweaks\nvm.swappiness=1\n" >> /etc/sysctl.conf 387 | printf "vm.min_free_kbytes = 8192\n" >> /etc/sysctl.conf 388 | # Only print important messages to console 389 | sed /etc/sysctl.conf -i -e "s/\#kernel\.printk/kernel.printk/" 390 | EOF 391 | } 392 | 393 | set_default_kernel_modules() { 394 | onvm_chroot sh -e - <> /etc/modules 396 | EOF 397 | } 398 | 399 | configure_sound() { 400 | onvm_chroot sh -e - < /etc/asound.conf 402 | pcm.mmap0 { 403 | type mmap_emul; 404 | slave { 405 | pcm "hw:0,0"; 406 | } 407 | } 408 | 409 | pcm.!default { 410 | type plug; 411 | slave { 412 | pcm mmap0; 413 | } 414 | } 415 | EOF1 416 | EOF 417 | } 418 | 419 | cd $WORKDIR 420 | dotask branch_image ../$OUTDIR/stage2.$IMGFORMAT $CURIMG 421 | dotask run_qemu $CURIMG 422 | dotask mount_apt_cache 423 | dotask disable_starting_services 424 | dotask configure_apt 425 | dotask set_debconf_selections 426 | dotask install_packages 427 | dotask configure_ifplugd 428 | dotask add_pi_user_to_groups 429 | dotask configure_useradd 430 | dotask make_udev_com_rule 431 | dotask configure_wifi 432 | #dotask add_opt_vc_lib_to_ld_so 433 | dotask setup_sudoers 434 | dotask setup_swap 435 | dotask setup_console_setup 436 | dotask cache_keymap 437 | dotask tweak_inputrc 438 | dotask fiddle_default_PATH 439 | [ -n "$RASPBIAN" ] && dotask install_memcpy_replacement 440 | dotask save_space_using_hardlink 441 | #[ -z "$RASPBIAN" ] && dotask add_qt5_apt_source 442 | dotask adjust_sysctl 443 | dotask allow_starting_services 444 | dotask remove_ssh_host_keys 445 | dotask apply_noobs_os_config 446 | dotask set_default_kernel_modules 447 | # Latest firmware does not need mmap emulation, so skip asound.conf creation 448 | #dotask configure_sound 449 | dotask update_issue 450 | dotask fingerprint_debian 451 | dotask shutdown_qemu 452 | dotask finish_image 453 | --------------------------------------------------------------------------------