Skip to contentSkip to conversation

Samsung XE303C12 aka Chromebook Snow

PATCH Superseded Alex Suykov 5 participants 15 messages Nov 16, 2015 – Dec 24, 2015

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Samsung XE303C12 aka Chromebook Snow

This short series adds board config for Chromebook Snow.

There are several ways to boot a custom kernel on the device, the one used here is perhaps the easiest to implement. However, it needs vboot-tools to sign the custom kernel.

The kernel is packed into u-boot flat image tree (FIT) together with the DT blob. Long story short, this is the only way I can get it to boot with the original bootloader. Using uImage with appended DT should be possible as well, but for some reason it does not seem to work.

At first I tried to add FIT option to the Kernel binary format menu, because it's not really Chromebook-specific, but it turned out to be ugly and much more complex than doing it in a post-build script.

Most of this boot stuff is common for all Chromebooks, even x86 ones, but not for Samsung devices other than Chromebooks. Because of this, it's boards/chromebook/snow and not boards/samsung/xe303c12.

Alex Suykov (2):
vboot-utils: new package
board: add support for Chromebook Snow

 board/chromebook/snow/kernel.args      |   1 +
 board/chromebook/snow/kernel.its       |  34 ++++++
 board/chromebook/snow/linux-4.3.config | 161 +++++++++++++++++++++++++++
 board/chromebook/snow/readme.txt       | 191 +++++++++++++++++++++++++++++++++
 board/chromebook/snow/sign.sh          |  32 ++++++
 configs/chromebook_snow_defconfig      |  17 +++
 package/Config.in.host                 |   1 +
 package/vboot-utils/Config.in.host     |   6 ++
 package/vboot-utils/vboot-utils.mk     |  23 ++++
 9 files changed, 466 insertions(+)
 create mode 100644 board/chromebook/snow/kernel.args
 create mode 100644 board/chromebook/snow/kernel.its
 create mode 100644 board/chromebook/snow/linux-4.3.config
 create mode 100644 board/chromebook/snow/readme.txt
 create mode 100755 board/chromebook/snow/sign.sh
 create mode 100644 configs/chromebook_snow_defconfig
 create mode 100644 package/vboot-utils/Config.in.host
 create mode 100644 package/vboot-utils/vboot-utils.mk
Signature · 1 line
2.0.3
#1 lore raw

PATCH 1/2 vboot-utils: new package

Host utilities for working with Chromium OS verified boot images. Needed to create signed kernel images and manipulating bootable partitions for Chromium OS bootloaders.

---
 package/Config.in.host             |  1 +
 package/vboot-utils/Config.in.host |  6 ++++++
 package/vboot-utils/vboot-utils.mk | 23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 package/vboot-utils/Config.in.host
 create mode 100644 package/vboot-utils/vboot-utils.mk
package/Config.in.host +1 -0
index ce1b6bc..7044a3b 100644
@@ -29,5 +29,6 @@ menu "Host utilities"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/uboot-tools/Config.in.host"
 	source "package/util-linux/Config.in.host"
+	source "package/vboot-utils/Config.in.host"
 
 endmenu
package/vboot-utils/Config.in.host new file +6 -0
new file mode 100644
index 0000000..a0c7497
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HOST_VBOOT_UTILS
+	bool "host vboot utils"
+	help
+	  ChromeOS verified boot utils: futility and cgpt.
+
+	  https://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot
package/vboot-utils/vboot-utils.mk new file +23 -0
new file mode 100644
index 0000000..b160efa
@@ -0,0 +1,23 @@
+################################################################################
+#
+# vboot
+#
+################################################################################
+
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference
+VBOOT_UTILS_SITE_METHOD = git
+VBOOT_UTILS_LICENSE = BSD
+
+HOST_VBOOT_UTILS_DEPENDENCIES = host-openssl
+
+define HOST_VBOOT_UTILS_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) futil cgpt
+endef
+
+define HOST_VBOOT_UTILS_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(HOST_DIR)/usr \
+		futil_install cgpt_install devkeys_install
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.0.3
#2 lore raw

PATCH 1/2 vboot-utils: new package

Hi Alex,

Quoted 5 lines · Alex Suykov

Host utilities for working with Chromium OS verified boot images. Needed to create signed kernel images and manipulating bootable partitions for Chromium OS bootloaders.

[...]

package/vboot-utils/vboot-utils.mk line 10

Quoted 4 lines
package/vboot-utils/vboot-utils.mk new file +4 -0
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference
+VBOOT_UTILS_SITE_METHOD = git
+VBOOT_UTILS_LICENSE = BSD

Please add 'VBOOT_UTILS_LICENSE_FILES = LICENSE'.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#3 lore raw

PATCH 1/2 vboot-utils: new package

Quoted 6 lines · Baruch Siach

package/vboot-utils/vboot-utils.mk line 10

Quoted 4 lines
package/vboot-utils/vboot-utils.mk new file +4 -0
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference
+VBOOT_UTILS_SITE_METHOD = git
+VBOOT_UTILS_LICENSE = BSD

Please add 'VBOOT_UTILS_LICENSE_FILES = LICENSE'.

Done, v2 patch sent.

#4 lore raw

PATCH 1/2 vboot-utils: new package

In reply to Alex Suykov
Quoted 30 lines · Alex Suykov

Host utilities for working with Chromium OS verified boot images. Needed to create signed kernel images and manipulating bootable partitions for Chromium OS bootloaders.

---
 package/Config.in.host             |  1 +
 package/vboot-utils/Config.in.host |  6 ++++++
 package/vboot-utils/vboot-utils.mk | 23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 package/vboot-utils/Config.in.host
 create mode 100644 package/vboot-utils/vboot-utils.mk
package/Config.in.host +1 -0
index ce1b6bc..7044a3b 100644
@@ -29,5 +29,6 @@ menu "Host utilities"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/uboot-tools/Config.in.host"
 	source "package/util-linux/Config.in.host"
+	source "package/vboot-utils/Config.in.host"
 
 endmenu
package/vboot-utils/Config.in.host new file +0 -0
new file mode 100644
index 0000000..a0c7497

package/vboot-utils/Config.in.host line 4

Quoted 4 lines
package/vboot-utils/Config.in.host new file +4 -0
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HOST_VBOOT_UTILS
+	bool "host vboot utils"
+	help
+	  ChromeOS verified boot utils: futility and cgpt.

ChromeOS or Chromius OS? Please be consistent :-)

Quoted 8 lines
package/vboot-utils/Config.in.host new file +2 -0
+
+	  https://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot
package/vboot-utils/vboot-utils.mk new file +0 -0
new file mode 100644
index 0000000..b160efa

package/vboot-utils/vboot-utils.mk line 8

Quoted 8 lines
package/vboot-utils/vboot-utils.mk new file +8 -0
@@ -0,0 +1,23 @@
+################################################################################
+#
+# vboot
+#
+################################################################################
+
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference

Since googlesource is shutting down: is there an alternative location already?
Possibly one which doesn't require git download method?

package/vboot-utils/vboot-utils.mk line 10

Quoted 2 lines
package/vboot-utils/vboot-utils.mk new file +2 -0
+VBOOT_UTILS_SITE_METHOD = git
+VBOOT_UTILS_LICENSE = BSD

BSD doesn't exist, I think it's BSD-3c in this case.

package/vboot-utils/vboot-utils.mk line 21

Quoted 11 lines
package/vboot-utils/vboot-utils.mk new file +11 -0
+
+HOST_VBOOT_UTILS_DEPENDENCIES = host-openssl
+
+define HOST_VBOOT_UTILS_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) futil cgpt
+endef
+
+define HOST_VBOOT_UTILS_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(HOST_DIR)/usr \
+		futil_install cgpt_install devkeys_install
+endef

Why not just 'make' and 'make install'? Please add the explanation as a comment.

Regards,
Arnout

Quoted 3 lines
package/vboot-utils/vboot-utils.mk new file +2 -0
+
+$(eval $(host-generic-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 1/2 vboot-utils: new package

Quoted 3 lines · Arnout Vandecappelle

package/vboot-utils/Config.in.host line 4

Quoted 1 line
package/vboot-utils/Config.in.host new file +1 -0
+	  ChromeOS verified boot utils: futility and cgpt.

ChromeOS or Chromius OS? Please be consistent :-)

Fixed that in v2 already. Should be Chromium OS throughout of course. Chromium OS but Chrome-book.

Quoted 5 lines

package/vboot-utils/vboot-utils.mk line 8

Quoted 2 lines
package/vboot-utils/vboot-utils.mk new file +2 -0
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference

Since googlesource is shutting down: is there an alternative location already?
Possibly one which doesn't require git download method?

Isn't it Google Code that's shutting down?
It does not look like they have any other site for Chromium OS sources.
https://www.chromium.org/chromium-os/developer-guide#TOC-Get-the-Source

They do have tgz shapshots however, I overlooked that. Should be better than git checkouts.

#6 lore raw

PATCH 1/2 vboot-utils: new package

Quoted 8 lines · Alex Suykov
Quoted 3 lines · Arnout Vandecappelle

package/vboot-utils/Config.in.host line 4

Quoted 1 line
package/vboot-utils/Config.in.host new file +1 -0
+	  ChromeOS verified boot utils: futility and cgpt.

ChromeOS or Chromius OS? Please be consistent :-)

Fixed that in v2 already. Should be Chromium OS throughout of course. Chromium OS but Chrome-book.

Yeah sorry I was replying to the wrong version.

Quoted 8 lines
Quoted 6 lines

package/vboot-utils/vboot-utils.mk line 8

Quoted 3 lines
package/vboot-utils/vboot-utils.mk new file +2 -0
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference

Since googlesource is shutting down: is there an alternative location already?
Possibly one which doesn't require git download method?

Isn't it Google Code that's shutting down?

Oops, my bad.

Quoted 5 lines

It does not look like they have any other site for Chromium OS sources.
https://www.chromium.org/chromium-os/developer-guide#TOC-Get-the-Source

They do have tgz shapshots however, I overlooked that. Should be better than git checkouts.

All right, so my comments weren't completely useless :-)

Don't forget to add a hash file then.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#7 lore raw

PATCH 1/2 vboot-utils: new package

In reply to Alex Suykov
Quoted 8 lines · Alex Suykov
Quoted 3 lines · Arnout Vandecappelle

package/vboot-utils/Config.in.host line 4

Quoted 1 line
package/vboot-utils/Config.in.host new file +1 -0
+	  ChromeOS verified boot utils: futility and cgpt.

ChromeOS or Chromius OS? Please be consistent :-)

Fixed that in v2 already. Should be Chromium OS throughout of course. Chromium OS but Chrome-book.

mmm, it should be "Chromium OS" and "Chrome OS", but it should be "Chromebook"

Quoted 6 lines
Quoted 5 lines

package/vboot-utils/vboot-utils.mk line 8

Quoted 2 lines
package/vboot-utils/vboot-utils.mk new file +2 -0
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference

Since googlesource is shutting down: is there an alternative location already?
Possibly one which doesn't require git download method?

Quoted 6 lines

Isn't it Google Code that's shutting down?
It does not look like they have any other site for Chromium OS sources.
https://www.chromium.org/chromium-os/developer-guide#TOC-Get-the-Source

They do have tgz shapshots however, I overlooked that. Should be better than git checkouts.

unfortunately, the tgz snapshots are not stable (same code but diff hash). there's a bug open to get it fixed, but i don't know when/if it'll change :(. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151208/89878b60/attachment.asc>

#8 lore raw

PATCH 2/2 board: add support for Chromebook Snow

In reply to Alex Suykov

Samsung XE303C12 aka Chromebook Snow is an Exynos5250-based netbook.

There is barely anything special about this target as far as toolchain is concerned, but its bootloader only accepts signed kernel images in a Chromium OS specific format, and is not controllable otherwise.

This config provides a script for building the proper kernel blobs, and a short manual for booting Buildroot images on the device.

The kernel defconfig is also provided. Mainline kernel already has exynos_defconfig which could have been used here, but it builds mwifiex statically, and that module tries to load its firmware during initialization.

Since the board was going to get a custom kernel config anyway, exynos_defconfig was trimmed to only include the drivers needed for this particular chip and this particular board.

---
 board/chromebook/snow/kernel.args      |   1 +
 board/chromebook/snow/kernel.its       |  34 ++++++
 board/chromebook/snow/linux-4.3.config | 170 +++++++++++++++++++++++++++++
 board/chromebook/snow/readme.txt       | 191 +++++++++++++++++++++++++++++++++
 board/chromebook/snow/sign.sh          |  32 ++++++
 configs/chromebook_snow_defconfig      |  24 +++++
 6 files changed, 452 insertions(+)
 create mode 100644 board/chromebook/snow/kernel.args
 create mode 100644 board/chromebook/snow/kernel.its
 create mode 100644 board/chromebook/snow/linux-4.3.config
 create mode 100644 board/chromebook/snow/readme.txt
 create mode 100755 board/chromebook/snow/sign.sh
 create mode 100644 configs/chromebook_snow_defconfig
board/chromebook/snow/kernel.args new file +1 -0
new file mode 100644
index 0000000..1220bf8
@@ -0,0 +1 @@
+console=tty1 clk_ignore_unused root=/dev/mmcblk1p2 rootfstype=ext4 ro
board/chromebook/snow/kernel.its new file +34 -0
new file mode 100644
index 0000000..33f2c00
@@ -0,0 +1,34 @@
+/dts-v1/;
+
+/ {
+    description = "Buildroot kernel for Chromebook Snow";
+    images {
+        kernel at 1{
+            description = "kernel";
+            data = /incbin/("zImage");
+            type = "kernel";
+            arch = "arm";
+            os = "linux";
+            compression = "none";
+            load = <0x40008000>;
+            entry = <0x40008000>;
+        };
+        fdt at 1{
+            description = "exynos5250-snow.dtb";
+            data = /incbin/("exynos5250-snow.dtb");
+            type = "flat_dt";
+            arch = "arm";
+            compression = "none";
+            hash at 1{
+                algo = "sha1";
+            };
+        };
+    };
+    configurations {
+        default = "conf at 1";
+        conf at 1{
+            kernel = "kernel at 1";
+            fdt = "fdt at 1";
+        };
+    };
+};
board/chromebook/snow/linux-4.3.config new file +161 -0

161 lines not on this page · raw message

board/chromebook/snow/readme.txt new file +191 -0

191 lines not on this page · raw message

board/chromebook/snow/sign.sh new file +32 -0
new file mode 100755
index 0000000..9a621b2
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+run() { echo "$@"; "$@"; }
+
+if [ -z "$BINARIES_DIR" -o -z "$HOST_DIR" ]; then
+	echo "BINARIES_DIR and HOST_DIR must be set" >&2
+	exit 1
+fi
+
+board=$PWD/board/chromebook/snow
+mkimage=$HOST_DIR/usr/bin/mkimage
+futility=$HOST_DIR/usr/bin/futility
+devkeys=$HOST_DIR/usr/share/vboot/devkeys
+
+cd "$BINARIES_DIR" || exit 1
+
+cp $board/kernel.its kernel.its || exit 1
+run $mkimage -f kernel.its uImage.itb
+
+echo > dummy.txt
+
+run $futility vbutil_kernel \
+	--keyblock $devkeys/kernel.keyblock \
+	--signprivate $devkeys/kernel_data_key.vbprivk \
+	--arch arm \
+	--version 1 \
+	--config $board/kernel.args \
+	--vmlinuz uImage.itb \
+	--bootloader dummy.txt \
+	--pack uImage.kpart
+
+rm -f kernel.its dummy.txt
configs/chromebook_snow_defconfig new file +17 -0
new file mode 100644
index 0000000..631ed73
@@ -0,0 +1,17 @@
+BR2_arm=y
+BR2_cortex_a15=y
+BR2_BINUTILS_VERSION_2_25_X=y
+BR2_GCC_VERSION_5_X=y
+BR2_TARGET_GENERIC_GETTY_PORT="tty1"
+BR2_TARGET_GENERIC_GETTY_TERM="linux"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/chromebook/snow/sign.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/chromebook/snow/linux-4.3.config"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5250-snow"
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8797=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_VBOOT_UTILS=y
Signature · 1 line
2.0.3
#9 lore raw

PATCH 2/2 board: add support for Chromebook Snow

Quoted 20 lines · Alex Suykov

Samsung XE303C12 aka Chromebook Snow is an Exynos5250-based netbook.

There is barely anything special about this target as far as toolchain is concerned, but its bootloader only accepts signed kernel images in a Chromium OS specific format, and is not controllable otherwise.

This config provides a script for building the proper kernel blobs, and a short manual for booting Buildroot images on the device.

The kernel defconfig is also provided. Mainline kernel already has exynos_defconfig which could have been used here, but it builds mwifiex statically, and that module tries to load its firmware during initialization.

Since the board was going to get a custom kernel config anyway, exynos_defconfig was trimmed to only include the drivers needed for this particular chip and this particular board.

---

[snip]

Quoted 36 lines
board/chromebook/snow/readme.txt new file +36 -0
+Partitioning the SD card
+------------------------
+Figure out the device name for the card on the host system. Typically
+it is either /dev/sdX or /dev/mmcblkX.
+
+	SD=/dev/sdb
+
+DOUBLE CHECK THE DEVICE NAME! The commands below will destroy and partially
+overwrite partitions on that device. Also make sure you have appropriate
+write permissions.
+
+You will need cgpt utility from vboot-utils package:
+
+	CGPT=output/host/usr/bin/cgpt
+
+First, erase and create a new GPT:
+
+	$CGPT create -z $SD
+	$CGPT create $SD	# ignore complaints about invalid GPT
+
+Take a look at the table:
+
+	$CGPT show $SD
+	       start        size    part  contents
+	           0           1          PMBR
+	           1           1          Pri GPT header
+	           2          32          Pri GPT table
+	    15564767          32          Sec GPT table
+	    15564799           1          Sec GPT header
+
+All offsets and sizes are in 512-blocks, and this table is from a 8GB SD card.
+Decide partition sizes. The kernel and the rootfs partition must fit between
+Pri and Sec GPT tables. It is also a good idea to have everything aligned
+at 8KB (16 blocks) boundary.
+
+	start=$[(2+32+15)&~15]

board/chromebook/snow/readme.txt line 72

Quoted 10 lines
board/chromebook/snow/readme.txt new file +10 -0
+	kernelsize=$[8*1024*2]			# 8MB in 512 blocks
+	rootfssize=$[(15564767-kernelsize-start)&~15]
+
+Create the partitions, marking the kernel partition as bootable.
+
+	$CGPT add -i 1 -b $start -s $kernelsize \
+		-t kernel -l kernel\
+		-S 1 -T 1 -P 10 $SD
+	$CGPT add -i 2 -b $[start+kernelsize] -s $rootfssize \
+		-t data -l rootfs $SD

Wouldn't it be possible to do all this in a post-image script that generates an
SD card image?

Quoted 32 lines
board/chromebook/snow/readme.txt new file +32 -0
+
+Check the resulting GPT:
+
+	$CGPT show $SD
+	       start        size    part  contents
+	           0           1          PMBR
+	           1           1          Pri GPT header
+	           2          32          Pri GPT table
+	          48       16384       1  Label: "kernel"
+	                                  Type: ChromeOS kernel
+	                                  UUID: ...
+	                                  Attr: priority=10 tries=1 successful=1
+	       16432    15548320       2  Label: "rootfs"
+	                                  Type: Linux data
+	                                  UUID: ...
+	    15564767          32          Sec GPT table
+	    15564799           1          Sec GPT header
+
+Natually this only needs to be done once per card.
+
+
+Writing kernel and rootfs to the SD card
+----------------------------------------
+Write .kpart directly to the bootable partition:
+
+	dd if=output/images/uImage.kpart of=${SD}1
+
+Make a new filesystem on the rootfs parition, and unpack fs image there:
+
+	mkfs.ext4 ${SD}2
+	mount ${SD2} /mnt/<ROOTFS-PARTITION>
+	tar -xvf output/images/rootfs.tar -C /mnt/<ROOTFS-PARTITION>

board/chromebook/snow/readme.txt line 114

Quoted 10 lines
board/chromebook/snow/readme.txt new file +10 -0
+	umount /mnt/<ROOTFS-PARTITION>
+
+This will require root permissions even if you can write to $SD.
+
+Alternatively, just write the fs image directly to the partition:
+
+	dd if=output/images/rootfs.ext2 of=${SD}2
+
+Select ext* fs image in menuconfig before doing this, and consider specifying
+extra fs size to have some empty space available there.

Just add an ext4 image to the buildroot config right away.

[snip]

configs/chromebook_snow_defconfig line 2

Quoted 8 lines
configs/chromebook_snow_defconfig new file +2 -0
new file mode 100644
index 0000000..631ed73
@@ -0,0 +1,17 @@
+BR2_arm=y
+BR2_cortex_a15=y

You also have to fixate the kernel headers version, i.e. use a custom version
and specify 4.3

configs/chromebook_snow_defconfig line 8

Quoted 6 lines
configs/chromebook_snow_defconfig new file +6 -0
+BR2_BINUTILS_VERSION_2_25_X=y
+BR2_GCC_VERSION_5_X=y
+BR2_TARGET_GENERIC_GETTY_PORT="tty1"
+BR2_TARGET_GENERIC_GETTY_TERM="linux"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/chromebook/snow/sign.sh"
+BR2_LINUX_KERNEL=y

Here also fixate the version, but SAME_AS_HEADERS is ok.

configs/chromebook_snow_defconfig line 15

Quoted 7 lines
configs/chromebook_snow_defconfig new file +7 -0
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/chromebook/snow/linux-4.3.config"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5250-snow"
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8797=y

As mentioned, add an ext4 image.

Regards,
Arnout

Quoted 3 lines
configs/chromebook_snow_defconfig new file +2 -0
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_VBOOT_UTILS=y
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#10 lore raw

PATCH 2/2 board: add support for Chromebook Snow

Quoted 10 lines · Arnout Vandecappelle

board/chromebook/snow/readme.txt line 72

Quoted 7 lines
board/chromebook/snow/readme.txt new file +7 -0
+Create the partitions, marking the kernel partition as bootable.
+
+	$CGPT add -i 1 -b $start -s $kernelsize \
+		-t kernel -l kernel\
+		-S 1 -T 1 -P 10 $SD
+	$CGPT add -i 2 -b $[start+kernelsize] -s $rootfssize \
+		-t data -l rootfs $SD

Wouldn't it be possible to do all this in a post-image script that generates an
SD card image?

Seems to be possible. The resulting image has secondary GPT in the wrong location, but as long as the primary one is ok it should not cause trouble.

This also adds host-parted dependency, but that would be needed anyway. I was working with a partitioned card and did not notice it, but cgpt does not write protective MBR.

Sending v2.

#11 lore raw

PATCH v3 1/2 vboot-utils: new package

In reply to Alex Suykov

Chromium OS verified boot utilities.

Needed for signing kernel images and manipulating bootable partitions on media intended for Chromebooks.

---
v2: _LICENSE_FILES
minor text fixes
v3: git snapshot over https instead of git checkout
comments on unusual make targets
proper license name
minor text fixes

 package/Config.in.host               |  1 +
 package/vboot-utils/Config.in.host   |  6 ++++++
 package/vboot-utils/vboot-utils.hash |  2 ++
 package/vboot-utils/vboot-utils.mk   | 35 +++++++++++++++++++++++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 package/vboot-utils/Config.in.host
 create mode 100644 package/vboot-utils/vboot-utils.hash
 create mode 100644 package/vboot-utils/vboot-utils.mk
package/Config.in.host +1 -0
index ce1b6bc..7044a3b 100644
@@ -29,5 +29,6 @@ menu "Host utilities"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/uboot-tools/Config.in.host"
 	source "package/util-linux/Config.in.host"
+	source "package/vboot-utils/Config.in.host"
 
 endmenu
package/vboot-utils/Config.in.host new file +6 -0
new file mode 100644
index 0000000..5cecef0
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HOST_VBOOT_UTILS
+	bool "host vboot utils"
+	help
+	  ChromiumOS verified boot utilities: futility and cgpt.
+
+	  https://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot
package/vboot-utils/vboot-utils.hash new file +2 -0
new file mode 100644
index 0000000..e161423
@@ -0,0 +1,2 @@
+# Git shapshot
+none	xxx	bbdd62f9b030db7ad8eef789aaf58a7ff9a25656.tar.gz
package/vboot-utils/vboot-utils.mk new file +35 -0
new file mode 100644
index 0000000..7d83899
@@ -0,0 +1,35 @@
+################################################################################
+#
+# vboot-utils
+#
+################################################################################
+
+VBOOT_UTILS_VERSION = bbdd62f9b030db7ad8eef789aaf58a7ff9a25656
+VBOOT_UTILS_SOURCE = $(VBOOT_UTILS_VERSION).tar.gz
+VBOOT_UTILS_SITE = https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+archive
+VBOOT_UTILS_STRIP_COMPONENTS = 0
+VBOOT_UTILS_LICENSE = BSD-3c
+VBOOT_UTILS_LICENSE_FILES = LICENSE
+
+HOST_VBOOT_UTILS_DEPENDENCIES = host-openssl
+
+# vboot_reference contains code that goes into bootloaders,
+# utilities intended for the target system, and a bunch of scripts
+# for Chromium OS build system. Most of that does not make sense
+# in a buildroot host-package.
+#
+# We only need futility for signing images, the keys, and cgpt for boot
+# media partitioning.
+#
+# make target for futility is "futil".
+
+define HOST_VBOOT_UTILS_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) futil cgpt
+endef
+
+define HOST_VBOOT_UTILS_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(HOST_DIR)/usr \
+		futil_install cgpt_install devkeys_install
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.0.3
#12 lore raw

PATCH v3 1/2 vboot-utils: new package

Dear Alex Suykov,

Quoted 6 lines · Alex Suykov

Chromium OS verified boot utilities.

Needed for signing kernel images and manipulating bootable partitions on media intended for Chromebooks.

I wanted to apply this patch, but it fails to build. It forgets to link with the OpenSSL library that has been built in $(HOST_DIR)/usr/lib. Can you have a look? To reproduce, make sure you don't have the openssl-dev package installed on your system.

    AR            libvboot_util21.a
    LD            futility/futility_s
    LD            futility/futility
    LDcgpt        cgpt/cgpt

/home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/cmd_create.o: In function `do_create':
cmd_create.c:(.text+0x42a): undefined reference to `PEM_read_RSAPrivateKey'
cmd_create.c:(.text+0x5fa): undefined reference to `RSA_free'
cmd_create.c:(.text+0x65e): undefined reference to `PEM_read_RSAPrivateKey'
cmd_create.c:(.text+0x680): undefined reference to `PEM_read_RSA_PUBKEY'
cmd_create.c:(.text+0x962): undefined reference to RSA_free' /home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/cmd_show.o: In function ft_show_privkey':
cmd_show.c:(.text+0x875): undefined reference to `d2i_RSAPrivateKey'
cmd_show.c:(.text+0x901): undefined reference to RSA_free' /home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/vb1_helper.o: In function ft_recognize_vb1_key':
vb1_helper.c:(.text+0x1141): undefined reference to `d2i_RSAPrivateKey'
vb1_helper.c:(.text+0x1159): undefined reference to RSA_free' /home/thomas/projets/buildroot/output/build/host-vboot-utils-bbdd62f9b030db7ad8eef789aaf58a7ff9a25656/build/futility/vb2_helper.o: In function rsa_from_buffer':
vb2_helper.c:(.text+0x4): undefined reference to `BIO_new_mem_buf'
vb2_helper.c:(.text+0x1a): undefined reference to `PEM_read_bio_RSAPrivateKey'
vb2_helper.c:(.text+0x33): undefined reference to `BIO_ctrl'
vb2_helper.c:(.text+0x45): undefined reference to `PEM_read_bio_RSA_PUBKEY'
vb2_helper.c:(.text+0x55): undefined reference to `BIO_free'
vb2_helper.c:(.text+0x61): undefined reference to `BIO_free'

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#13 lore raw

PATCH v3 1/2 vboot-utils: new package

Quoted 4 lines · Thomas Petazzoni

I wanted to apply this patch, but it fails to build. It forgets to link with the OpenSSL library that has been built in $(HOST_DIR)/usr/lib. Can you have a look? To reproduce, make sure you don't have the openssl-dev package installed on your system.

Well it fails for me even with the system openssl installed. That's because of pkg-config actually, and fixing pkg-config brought up some more issues.

Sending v4, checked against current master.

#14 lore raw

PATCH v2 2/2 board: add support for Chromebook Snow

In reply to Alex Suykov

Samsung XE303C12 aka Chromebook Snow is an Exynos5250-based netbook.

There is barely anything special about this target as far as toolchain is concerned, but its bootloader only accepts signed kernel images in a Chromium OS specific format, and is not controllable otherwise.

This config provides a script for building the proper kernel blobs, and a short manual for booting Buildroot images on the device.

The kernel defconfig is also provided. Mainline kernel already has exynos_defconfig which could have been used here, but it builds mwifiex statically, and that module tries to load its firmware during initialization.

Since the board was going to get a custom kernel config anyway, exynos_defconfig was trimmed to only include the drivers needed for this particular chip and this particular board.

---
v2: script to make complete SD card image
explicit kernel version in defconfig
comments and text updates

 board/chromebook/snow/kernel.args      |   1 +
 board/chromebook/snow/kernel.its       |  34 +++++++
 board/chromebook/snow/linux-4.3.config | 161 +++++++++++++++++++++++++++++++++
 board/chromebook/snow/mksd.sh          |  72 +++++++++++++++
 board/chromebook/snow/readme.txt       | 145 +++++++++++++++++++++++++++++
 board/chromebook/snow/sign.sh          |  44 +++++++++
 configs/chromebook_snow_defconfig      |  22 +++++
 7 files changed, 479 insertions(+)
 create mode 100644 board/chromebook/snow/kernel.args
 create mode 100644 board/chromebook/snow/kernel.its
 create mode 100644 board/chromebook/snow/linux-4.3.config
 create mode 100755 board/chromebook/snow/mksd.sh
 create mode 100644 board/chromebook/snow/readme.txt
 create mode 100755 board/chromebook/snow/sign.sh
 create mode 100644 configs/chromebook_snow_defconfig
board/chromebook/snow/kernel.args new file +1 -0
new file mode 100644
index 0000000..1220bf8
@@ -0,0 +1 @@
+console=tty1 clk_ignore_unused root=/dev/mmcblk1p2 rootfstype=ext4 ro
board/chromebook/snow/kernel.its new file +34 -0
new file mode 100644
index 0000000..33f2c00
@@ -0,0 +1,34 @@
+/dts-v1/;
+
+/ {
+    description = "Buildroot kernel for Chromebook Snow";
+    images {
+        kernel at 1{
+            description = "kernel";
+            data = /incbin/("zImage");
+            type = "kernel";
+            arch = "arm";
+            os = "linux";
+            compression = "none";
+            load = <0x40008000>;
+            entry = <0x40008000>;
+        };
+        fdt at 1{
+            description = "exynos5250-snow.dtb";
+            data = /incbin/("exynos5250-snow.dtb");
+            type = "flat_dt";
+            arch = "arm";
+            compression = "none";
+            hash at 1{
+                algo = "sha1";
+            };
+        };
+    };
+    configurations {
+        default = "conf at 1";
+        conf at 1{
+            kernel = "kernel at 1";
+            fdt = "fdt at 1";
+        };
+    };
+};
board/chromebook/snow/linux-4.3.config new file +161 -0

161 lines not on this page · raw message

board/chromebook/snow/mksd.sh new file +72 -0

72 lines not on this page · raw message

board/chromebook/snow/readme.txt new file +145 -0

145 lines not on this page · raw message

board/chromebook/snow/sign.sh new file +44 -0

44 lines not on this page · raw message

configs/chromebook_snow_defconfig new file +23 -0
new file mode 100644
index 0000000..5df3141
@@ -0,0 +1,23 @@
+BR2_arm=y
+BR2_cortex_a15=y
+BR2_KERNEL_HEADERS_4_3=y
+BR2_BINUTILS_VERSION_2_25_X=y
+BR2_GCC_VERSION_5_X=y
+BR2_TARGET_GENERIC_GETTY_PORT="tty1"
+BR2_TARGET_GENERIC_GETTY_TERM="linux"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/chromebook/snow/sign.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/chromebook/snow/mksd.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_SAME_AS_HEADERS=y
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/chromebook/snow/linux-4.3.config"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="exynos5250-snow"
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_SD8797=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_PACKAGE_HOST_PARTED=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
+BR2_PACKAGE_HOST_VBOOT_UTILS=y
Signature · 1 line
2.0.3