diff --git a/src/freedombone-image-hardware-setup b/src/freedombone-image-hardware-setup index 29b7ad27..b8a5858a 100755 --- a/src/freedombone-image-hardware-setup +++ b/src/freedombone-image-hardware-setup @@ -31,228 +31,47 @@ PROJECT_NAME='freedombone' 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 -} - -beaglebone_setup_boot() { - bbb_version=$1 - - # Setup uEnv.txt - if grep -q btrfs /etc/fstab ; then - fstype=btrfs - else - fstype=ext4 +setup_flash_kernel() { + if [ ! -d /etc/flash-kernel ] ; then + mkdir /etc/flash-kernel fi - if [ ! $bbb_version ]; then - kernelVersion=$(ls /usr/lib/*/am335x-boneblack.dtb | head -1 | cut -d/ -f4) - else - kernelVersion=$(ls /usr/lib/*/am335x-boneblack-${1}.dtb | head -1 | cut -d/ -f4) - fi - version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') - initRd=initrd.img-$version - vmlinuz=vmlinuz-$version + echo -n "$1" > /etc/flash-kernel/machine - bbb_loadaddr='0x80200000' - bbb_initrd_addr='0x81000000' - bbb_fdtaddr='0x80F80000' - if [[ "$bbb_version" == "wireless" ]]; then - bbb_loadaddr='0x82000000' - bbb_initrd_addr='0x88080000' - bbb_fdtaddr='0x88000000' + command_line="" + if [ -n "$2" ] ; then + command_line="console=$2" fi - # 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 - - if [ ! $bbb_version ]; then - (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 ) - else - (cd /boot ; \ - cp /usr/lib/$kernelVersion/am335x-boneblack-${bbb_version}.dtb dtb ; \ - cat $vmlinuz dtb >> temp-kernel ; \ - mkimage -A arm -O linux -T kernel -n "Debian kernel ${version}" \ - -C none -a 0x82000000 -e 0x82000000 -d temp-kernel uImage ; \ - rm -f temp-kernel ; \ - mkimage -A arm -O linux -T ramdisk -C gzip -a 0x88080000 -e 0x88080000 \ - -n "Debian ramdisk ${version}" \ - -d $initRd uInitrd ) - fi -} - -a20_setup_boot() { - dtb="$1" - - # Setup boot.cmd - if grep -q btrfs /etc/fstab ; then - fstype=btrfs - else - fstype=ext4 - fi - kernelVersion=$(ls /usr/lib/*/$dtb | head -1 | cut -d/ -f4) - version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') - initRd=initrd.img-$version - vmlinuz=vmlinuz-$version - - # Create boot.cmd - cat >> /boot/boot.cmd <> /etc/initramfs-tools/modules + apt-get -yq install flash-kernel } case "$MACHINE" in beaglebone) - beaglebone_setup_boot - #beaglebone_flash - #beaglebone_repack_kernel - enable_serial_console ttyO0 + setup_flash_kernel 'TI AM335x BeagleBone Black' 'ttyO0' ;; beaglebonewifi) - beaglebone_setup_boot wireless - #beaglebone_flash - #beaglebone_repack_kernel wireless - enable_serial_console ttyO0 + setup_flash_kernel 'TI AM335x BeagleBone Black Wireless' 'ttyO0' ;; cubietruck) - a20_setup_boot sun7i-a20-cubietruck.dtb - enable_serial_console ttyS0 + setup_flash_kernel 'Cubietech Cubietruck' ;; a20-olinuxino-lime) - a20_setup_boot sun7i-a20-olinuxino-lime.dtb - enable_serial_console ttyS0 + setup_flash_kernel 'Olimex A20-OLinuXino-LIME' ;; a20-olinuxino-lime2) - a20_setup_boot sun7i-a20-olinuxino-lime2.dtb - enable_serial_console ttyS0 + setup_flash_kernel 'Olimex A20-OLinuXino-LIME2' ;; a20-olinuxino-micro) - a20_setup_boot sun7i-a20-olinuxino-micro.dtb - enable_serial_console ttyS0 + setup_flash_kernel 'Olimex A20-Olinuxino Micro' ;; cubieboard2) - a20_setup_boot sun7i-a20-cubieboard2.dtb - enable_serial_console ttyS0 + setup_flash_kernel 'Cubietech Cubieboard2' + ;; + pcduino3) + setup_flash_kernel 'LinkSprite pcDuino3' ;; esac