#!/bin/sh # Set up an debian system on a ARM system under QEMU color_red="\\033[1;31m" color_green="\\033[1;32m" color_black="\\033[1;38m" color_reset="\\033[0;39m" if [ "$1" = "-h" -o "$1" = "--help" ]; then echo "Usage: $0 [INSTALL_DIR] [HDD_SIZE]" exit fi if ! qemu --version > /dev/null; then echo "${color_red}QEMU not installed${color_reset}" exit fi cpu=$(qemu-system-arm -M versatilepb -cpu ? | grep arm1176 || qemu-system-arm -M versatilepb -cpu ? | grep arm1136-r2) dir=${1-debian} hdd=${2-2G} if [ -z "$cpu" ]; then echo "${color_red}CPU not supportet by QEMU${color_reset}" exit fi if [ -e "$dir" ]; then echo "${color_red}Destination directory '$dir' already exists${color_reset}" exit fi echo -n $color_black cat <<-EOF Install Debian for ARM processors on QEMU ========================================= CPU: $cpu hdd size: $hdd Please attend this during the installation: - Continue the installation without kernel modules - ignore RAID and LVM error messages During the system will be installed, switch to console 2 and copy the kernel modules: mkdir /target/lib/modules cp -r /lib/modules/3.0.4-Raspi /target/lib/modules EOF echo -n $color_reset mkdir $dir cd $dir wget "http://thoronir.net/raspi-dev/initrd-raspi.gz" wget "http://thoronir.net/raspi-dev/kernel-raspi" qemu-img create -f raw debian.hda $hdd qemu-system-arm -m 256 -M versatilepb -cpu $cpu -hda debian.hda -kernel kernel-raspi -no-reboot -append "console=tty0 root=/dev/sda1 rw panic=5" -initrd initrd-raspi.gz #mkdir initrd debian.hda1 #gunzip -c initrd-raspi.gz > cpio -i initrd #sudo mount -o loop debian.hda debian.hda1 ## geht so nicht, da ja nur hda1 gemountet werden soll #cp -r initrd/lib/modules/3.0.4-Raspi debian.hda1/lib/modules echo -n $color_black cat <<-EOF The installation is completed! Now the installed system will boot - If on every login a new password will be requested, you must set the system time, e.g.: date -s "30 Sep 2011 19:00:00" EOF echo -n $color_reset qemu-system-arm -m 256 -M versatilepb -cpu $cpu -hda debian.hda -kernel kernel-raspi -no-reboot -append "console=tty0 root=/dev/sda1 rw panic=5"