diff --git a/src/freedombone-image-hardware-setup b/src/freedombone-image-hardware-setup index c962bd56..42a1ebb3 100755 --- a/src/freedombone-image-hardware-setup +++ b/src/freedombone-image-hardware-setup @@ -39,17 +39,32 @@ enable_serial_console() { } beaglebone_setup_boot() { + bbb_version=$1 + # 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) + 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 + 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' + 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/uEnv.txt <> 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 ) -} - -beaglebone_wireless_repack_kernel() { - echo "info: repacking beaglebone wireless kernel and initrd" - - kernelVersion=$(ls /usr/lib/*/am335x-boneblack-wireless.dtb | head -1 | cut -d/ -f4) - version=$(echo $kernelVersion | sed 's/linux-image-\(.*\)/\1/') - initRd=initrd.img-$version - vmlinuz=vmlinuz-$version - - mkdir /tmp/initrd-repack - - (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 - - (cd /boot ; \ - cp /usr/lib/$kernelVersion/am335x-boneblack-wireless.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 ) + 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() { @@ -270,9 +230,9 @@ case "$MACHINE" in enable_serial_console ttyO0 ;; beaglebonewifi) - beaglebone_wireless_setup_boot + beaglebone_setup_boot wireless beaglebone_flash - beaglebone_wireless_repack_kernel + beaglebone_repack_kernel wireless enable_serial_console ttyO0 ;; cubietruck)