From 1baba33ec2f06b18fb44fa19f97f2995ef607bbf Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 28 Jun 2016 17:32:54 +0100 Subject: [PATCH] Tidying --- src/freedombone-image-hardware-setup | 242 +++++++++++++-------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/src/freedombone-image-hardware-setup b/src/freedombone-image-hardware-setup index ea44c215..0cdc1316 100755 --- a/src/freedombone-image-hardware-setup +++ b/src/freedombone-image-hardware-setup @@ -32,27 +32,27 @@ export TEXTDOMAIN=${PROJECT_NAME}-image-hardware-setup export TEXTDOMAINDIR="/usr/share/locale" enable_serial_console() { - # By default, spawn a console on the serial port - device="$1" - echo $"Adding a getty on the serial port" - echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab + # By default, spawn a console on the serial port + device="$1" + echo $"Adding a getty on the serial port" + echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab } beaglebone_setup_boot() { - # Setup uEnv.txt - if grep -q btrfs /etc/fstab ; then - fstype=btrfs - else - fstype=ext4 - fi - kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4) - version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') - initRd=initrd.img-$version - vmlinuz=vmlinuz-$version + # Setup uEnv.txt + if grep -q btrfs /etc/fstab ; then + fstype=btrfs + else + fstype=ext4 + fi + kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4) + version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') + initRd=initrd.img-$version + vmlinuz=vmlinuz-$version - # uEnv.txt for Beaglebone - # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt - cat >> /boot/uEnv.txt <> /boot/uEnv.txt < /boot/$initRd ) + (cd /tmp/initrd-repack ; \ + zcat /boot/$initRd | cpio -i ; \ + rm -f conf/param.conf ; \ + find . | cpio --quiet -o -H newc | \ + gzip -9 > /boot/$initRd ) - rm -rf /tmp/initrd-repack + rm -rf /tmp/initrd-repack - (cd /boot ; \ - cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \ - cat $vmlinuz dtb >> temp-kernel ; \ - mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \ - -C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \ - rm -f temp-kernel ; \ - mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \ - -n "Debian ramdisk ${version}" \ - -d $initRd uInitrd ) + (cd /boot ; \ + cp /usr/lib/$kernelVersion/am335x-boneblack.dtb dtb ; \ + cat $vmlinuz dtb >> temp-kernel ; \ + mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \ + -C none -a 0x80200000 -e 0x80200000 -d temp-kernel uImage ; \ + rm -f temp-kernel ; \ + mkimage -A arm -O linux -T ramdisk -C gzip -a 0x81000000 -e 0x81000000 \ + -n "Debian ramdisk ${version}" \ + -d $initRd uInitrd ) } odroidc2_setup_boot() { - dtb="$1" + dtb="$1" - # Setup uEnv.txt - if grep -q btrfs /etc/fstab ; then - fstype=btrfs - else - fstype=ext4 - fi - kernelVersion=$(ls /usr/lib/*/${dtb}.dtb | head -1 | cut -d/ -f4) - version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') - initRd=initrd.img-$version - vmlinuz=vmlinuz-$version + # Setup uEnv.txt + if grep -q btrfs /etc/fstab ; then + fstype=btrfs + else + fstype=ext4 + fi + kernelVersion=$(ls /usr/lib/*/${dtb}.dtb | head -1 | cut -d/ -f4) + version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') + initRd=initrd.img-$version + vmlinuz=vmlinuz-$version - # based on http://odroid.com/dokuwiki/doku.php?id=en:c2_building_u-boot - cat >> /boot/uEnv.txt <> /boot/uEnv.txt <> /boot/boot.cmd <> /boot/boot.cmd <> /etc/initramfs-tools/modules + # extra boot modules + echo "rtc_sunxi" >> /etc/initramfs-tools/modules } case "$MACHINE" in - beaglebone) - beaglebone_setup_boot - beaglebone_flash - beaglebone_repack_kernel - enable_serial_console ttyO0 - ;; - odroid-c2) - odroidc2_setup_boot meson64_odroidc2 - enable_serial_console ttyO0 - ;; - cubietruck) - a20_setup_boot sun7i-a20-cubietruck.dtb - enable_serial_console ttyS0 - ;; - a20-olinuxino-lime) - a20_setup_boot sun7i-a20-olinuxino-lime.dtb - enable_serial_console ttyS0 - ;; - a20-olinuxino-lime2) - a20_setup_boot sun7i-a20-olinuxino-lime2.dtb - enable_serial_console ttyS0 - ;; - a20-olinuxino-micro) - a20_setup_boot sun7i-a20-olinuxino-micro.dtb - enable_serial_console ttyS0 - ;; - cubieboard2) - a20_setup_boot sun7i-a20-cubieboard2.dtb - enable_serial_console ttyS0 - ;; + beaglebone) + beaglebone_setup_boot + beaglebone_flash + beaglebone_repack_kernel + enable_serial_console ttyO0 + ;; + odroid-c2) + odroidc2_setup_boot meson64_odroidc2 + enable_serial_console ttyO0 + ;; + cubietruck) + a20_setup_boot sun7i-a20-cubietruck.dtb + enable_serial_console ttyS0 + ;; + a20-olinuxino-lime) + a20_setup_boot sun7i-a20-olinuxino-lime.dtb + enable_serial_console ttyS0 + ;; + a20-olinuxino-lime2) + a20_setup_boot sun7i-a20-olinuxino-lime2.dtb + enable_serial_console ttyS0 + ;; + a20-olinuxino-micro) + a20_setup_boot sun7i-a20-olinuxino-micro.dtb + enable_serial_console ttyS0 + ;; + cubieboard2) + a20_setup_boot sun7i-a20-cubieboard2.dtb + enable_serial_console ttyS0 + ;; esac