#!/bin/sh 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 } 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 # uEnv.txt for Beaglebone # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt cat >> /boot/uEnv.txt < /boot/$initRd ) 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 ) } cubieboard2_setup_boot() { # Setup boot.cmd if grep -q btrfs /etc/fstab ; then fstype=btrfs else fstype=ext4 fi kernelVersion=$(ls /usr/lib/*/sun7i-a20-cubieboard2.dtb | head -1 | cut -d/ -f4) version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') initRd=initrd.img-$version vmlinuz=vmlinuz-$version # boot.cmd for CubieTruck cat >> /boot/boot.cmd <> /etc/initramfs-tools/modules } case "$MACHINE" in beaglebone) beaglebone_setup_boot beaglebone_flash beaglebone_repack_kernel enable_serial_console ttyO0 ;; cubieboard2) cubieboard2_setup_boot enable_serial_console ttyS0 ;; esac