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

Bug#716902: flash-kernel: [RFC PATCH] samsung arm chromebook support



Package: flash-kernel
Version: 3.8
Severity: normal
Tags: patch

I am working on getting the Samsung ARM Chromebook supported by
the Debian installer.

RFC on this patch, as the vboot on the chromebook does not support initrd
I had to change some global stuff. It is also possible to chain boot a second
more regular u-boot on this device, which might be the way to go, and would then
only require the symlink method (and another partition).

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: armhf (armv7l)

Kernel: Linux 3.4.0 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages flash-kernel depends on:
ii  devio            1.2-1
ii  initramfs-tools  0.113
ii  linux-base       3.5

flash-kernel recommends no packages.

Versions of packages flash-kernel suggests:
ii  u-boot-tools  2013.01.01-4

-- no debconf information
>From c6512836f056bed09212f04cdeddd6e31edfc20f Mon Sep 17 00:00:00 2001
From: Shawn Landden <shawnlandden@gmail.com>
Date: Fri, 12 Jul 2013 22:52:43 -0700
Subject: [PATCH] add Samsung ARM Chromebook support

armmp is to support this (currently does not as it doesn't compile in enough modules
- no initrd support without chain loading u-boot-nv)
---
 README    |  1 +
 db/all.db | 10 ++++++++++
 functions | 31 ++++++++++++++++++++++++++++---
 test_db   |  2 +-
 4 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/README b/README
index 920acb3..9bcf18a 100644
--- a/README
+++ b/README
@@ -46,6 +46,7 @@ The following systems are supported:
  - QNAP TS-409
  - QNAP TS-410 and TS-410U Turbo NAS
  - QNAP TS-419P and TS-419U Turbo NAS
+ - Samsung ARM Chromebook
  - Seagate FreeAgent DockStar
  - SheevaPlug
  - SheevaPlug eSATA
diff --git a/db/all.db b/db/all.db
index d1ad4bc..db11a46 100644
--- a/db/all.db
+++ b/db/all.db
@@ -337,3 +337,13 @@ Method: android
 Android-Boot-Device: /dev/mmcblk0
 Required-Packages: abootimg
 Bootloader-Sets-Root: no
+
+# /proc/cpuinfo contains Hardware	: SAMSUNG EXYNOS5 (Flattened Device Tree)
+Machine: Google Snow
+Method: chromeos
+Kernel-Flavors: armmp
+# not with armmp, only chromeos-3.4
+#DTB-Id: exynos5250-spring.dts
+#DTB-Append: yes
+Part-Kernel: /dev/mmcblk0p6
+Required-Packages: vboot-kernel-utils
diff --git a/functions b/functions
index df00a86..193c2f3 100644
--- a/functions
+++ b/functions
@@ -316,6 +316,21 @@ android_flash() {
 	echo "done." >&2
 }
 
+# XXX needs testsuite coverage
+vboot_sign() {
+        printf "Signing kernel with kernel.flags\n"
+        vbutil_kernel --pack /boot/vmlinuz.signed-${kvers} --keyblock \
+		/usr/share/vboot/devkeys/kernel.keyblock --version 1 \
+		--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
+		--config /boot/kernel.flags --vmlinuz /boot/vmlinuz-${kvers} \
+		--arch arm
+}
+
+chromeos_flash() {
+	printf "Writing vmlinuz.signed-${kvers} to ${part_kernel}\n"
+	dd if=/boot/vmlinuz.signed-${kvers}.signed of=${part_kernel} bs=4M
+}
+
 main() {
 if [ "x$1" = "x--machine" ]; then
 	machine="$2"
@@ -365,11 +380,13 @@ ifile="/boot/initrd.img-$kvers"
 desc="kernel $kvers"
 idesc="ramdisk $kvers"
 
-if [ ! -e $kfile ] || [ ! -e $ifile ]; then
-	error "Can't find $kfile or $ifile"
+if [ ! -e $kfile ]; then
+	error "Can't find $kfile"
 fi
 kfilesize=$(stat -c '%s' "$kfile")
-ifilesize=$(stat -c '%s' "$ifile")
+if [ -e $ifile ]; then
+	ifilesize=$(stat -c '%s' "$ifile")
+fi
 
 if [ -L "$kfile" ]; then
 	kfile=$(readlink -e "$kfile")
@@ -393,6 +410,7 @@ machine_id="$(get_machine_field "$machine" "Machine-Id")" || :
 method="$(get_machine_field "$machine" "Method")" || method="generic"
 mtd_kernel="$(get_machine_field "$machine" "Mtd-Kernel")" || :
 mtd_initrd="$(get_machine_field "$machine" "Mtd-Initrd")" || :
+part_kernel="$(get_machine_field "$machine" "Part-Kernel")" || :
 dtb_name="$(get_machine_field "$machine" "DTB-Id")" || :
 dtb_append="$(get_machine_field "$machine" "DTB-Append")" || :
 ukaddr="$(get_machine_field "$machine" "U-Boot-Kernel-Address")" || :
@@ -591,6 +609,13 @@ case "$method" in
 		pad=$(($imtdsize - $ifilesize))
 		flash_initrd "$ifile" "$imtd" $pad
 	;;
+	"chromeos")
+		if [ ! -b "$part_kernel" ] ; then
+			error "Couldn't find $part_kernel or is not block special"
+		fi
+		vboot_sign
+		chromeos_flash
+	;;
 	"slug")
 		case "$(dpkg --print-architecture)" in
 			arm|armel)
diff --git a/test_db b/test_db
index 587899e..0798953 100755
--- a/test_db
+++ b/test_db
@@ -22,7 +22,7 @@
 MACHINE_DB="$(cat "${FK_CHECKOUT:-$FK_DIR}/db/"*.db)"
 
 test_no_unknown_fields() {
-    local expected='Android-Boot-Device Boot-Device Boot-DTB-Path Boot-Initrd-Path Boot-Kernel-Path Boot-Multi-Path Boot-Script-Path Bootloader-Sets-Root DTB-Append DTB-Id Kernel-Flavors Machine Machine-Id Method Mtd-Initrd Mtd-Kernel Optional-Packages Required-Packages U-Boot-Initrd-Address U-Boot-Kernel-Address U-Boot-Multi-Address U-Boot-Script-Address U-Boot-Script-Name'
+    local expected='Android-Boot-Device Boot-Device Boot-DTB-Path Boot-Initrd-Path Boot-Kernel-Path Boot-Multi-Path Boot-Script-Path Bootloader-Sets-Root DTB-Append DTB-Id Kernel-Flavors Machine Machine-Id Method Mtd-Initrd Mtd-Kernel Optional-Packages Required-Packages U-Boot-Initrd-Address U-Boot-Kernel-Address U-Boot-Multi-Address U-Boot-Script-Address U-Boot-Script-Name Part-Kernel'
     expected="$(echo "$expected" | sed 's/ /\n/g' | sort -u | xargs)"
     local fields="$(echo "$MACHINE_DB" | sed -n '/^[^#]*:/s/:.*//p' | sort -u | xargs)"
     echo $fields
-- 
1.8.3.2


Reply to: