[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#612376: flash-kernel: please include efikamx support



On Thu, Feb 10, 2011 at 08:11:36AM +0000, Martin Michlmayr wrote:
> Yeah, you'd think that Clint would know how to submit a proper patch.

My apologies.
--- flash-kernel.sid	2011-02-12 17:41:30.532519059 -0500
+++ flash-kernel.patched	2011-02-12 17:54:16.589578778 -0500
@@ -76,6 +76,69 @@
 	fi
 }
 
+efikamx_flash_kernel() {
+        root=$(readlink -f /dev/root)
+        echo "Root filesystem is $root" >&2
+
+        loadaddr=0x90008000
+	tmpdir="$(mktemp -d)"
+
+        printf "Generating kernel u-boot image... " >&2
+        cat $kfile >> $tmpdir/kernel
+        mkimage -A arm -O linux -T kernel -C none -n "$desc" -a $loadaddr \
+            -e $loadaddr -d $tmpdir/kernel $tmpdir/uboot >&2 1>/dev/null
+        echo "done." >&2
+
+        if [ -e /boot/uImage-$kvers ]; then
+                echo "Creating backup of /boot/uImage-$kvers." >&2
+                mv /boot/uImage-$kvers /boot/uImage-$kvers.bak
+        fi
+
+        echo "Creating new /boot/uImage." >&2
+        mv $tmpdir/uboot /boot/uImage-$kvers
+        rm -f $tmpdir/uboot
+
+        printf "Generating initrd u-boot image... " >&2
+        mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 \
+                -e 0x0 -n "$idesc" -d "$ifile" "$tmpdir/uboot" >&2 1>/dev/null
+        echo "done." >&2
+        if [ -e /boot/uInitrd-$kvers ]; then
+                echo "Creating backup of /boot/uInitrd." >&2
+                mv /boot/uInitrd-$kvers /boot/uInitrd-$kvers.bak
+        fi
+        echo "Creating new /boot/uInitrd." >&2
+        mv "$tmpdir/uboot" /boot/uInitrd-$kvers
+        rm -f "$tmpdir/uboot"
+        printf "Generating new u-boot boot script..." >&2
+        # The UUID will come from the flash-kernel config file
+
+        printf "Generating boot.scr... " >&2
+        cat >$tmpdir/boot.script <<EOF
+setenv ramdisk uInitrd-$kvers;
+setenv kernel uImage-$kvers;
+setenv bootargs console=tty1 console=\${console} root=$root rootwait rw quiet splash;
+\${loadcmd} \${ramdiskaddr} \${ramdisk};
+if imi \${ramdiskaddr}; then; else
+  setenv bootargs \${bootargs} noinitrd;
+  setenv ramdiskaddr "";
+fi;
+\${loadcmd} \${kerneladdr} \${kernel}
+if imi \${kerneladdr}; then
+  bootm \${kerneladdr} \${ramdiskaddr}
+fi;
+EOF
+        mkimage -A arm -T script -C none -n "Debian U-Boot boot script" -d "$tmpdir/boot.script" \
+                "$tmpdir/boot.scr" >&2 1>/dev/null
+        echo "done." >&2
+        if [ -e /boot/boot.scr ]; then
+                echo "Creating backup of /boot/boot.scr." >&2
+                mv /boot/boot.scr /boot/boot.scr.bak
+        fi
+        echo "Creating new /boot/boot.scr." >&2
+        mv "$tmpdir/boot.scr" /boot/boot.scr
+        rm -rf $tmpdir*
+}
+
 if [ "x$1" = "x--machine" ]; then
 	machine=$2
 	shift 2
@@ -105,6 +168,8 @@
 		"Seagate FreeAgent DockStar")		exit 0 ;;
 		"Thecus N2100")				exit 0 ;;
 		"Lanner EM7210")			exit 0 ;;
+		"Genesi Efika MX (Smartbook)")		exit 0 ;;
+		"Genesi Efika MX (Smarttop)")		exit 0 ;;
 		*)					exit 1 ;;
 	esac
 fi
@@ -517,6 +582,10 @@
 		) > "$imtd" || error "failed."
 		echo "done." >&2
 	;;
+	"Genesi Efika MX (Smartbook)" | "Genesi Efika MX (Smarttop)")
+                #check_subarch $running_subarch
+                efikamx_flash_kernel
+	;;
 	*)
 		error "Unsupported platform."
 	;;

Reply to: