Das U-Boot

U-Boot for Surface RT.

How to build u-boot

Get source code

You can use U-boot for tegra git clone https://github.com/OE4T/u-boot-tegra; cd u-boot-tegra or U-boot Mainline git clone https://gitlab.denx.de/u-boot/u-boot.git; cd u-boot

Add/change Devicetree

THIS IS VERY IMPORTANT!!! If you skip this step you can damage your device Use the devicetree below. Don't use the devicetree from Linux.

Replace the content of ./arch/arm/dts/tegra30-cardhu.dts with following code:

/dts-v1/;

#include "tegra30.dtsi"

/ {
	model = "NVIDIA Cardhu";
	compatible = "nvidia,cardhu", "nvidia,tegra30";

	chosen {
		stdout-path = &uarta;
	};

	aliases {
		mmc0 = "/sdhci@78000600";
		mmc1 = "/sdhci@78000000";
	};

	memory {
		device_type = "memory";
		reg = <0x80000000 0x40000000>;
	};

	sdhci@78000000 {
		status = "okay";
		cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
		wp-gpios = <&gpio TEGRA_GPIO(T, 3) GPIO_ACTIVE_HIGH>;
		power-gpios = <&gpio TEGRA_GPIO(D, 7) GPIO_ACTIVE_HIGH>;
		bus-width = <4>;
	};

	sdhci@78000600 {
		status = "okay";
		bus-width = <8>;
		non-removable;
	};

	clocks {
		compatible = "simple-bus";
		#address-cells = <1>;
		#size-cells = <0>;

		clk32k_in: clock@0 {
			compatible = "fixed-clock";
			reg=<0>;
			#clock-cells = <0>;
			clock-frequency = <32768>;
		};
	};
};

&uarta {
	status = "okay";
};

Build U-Boot

Now you can build U-Boot: make cardhu_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- Now you should find the file./u-boot-dtb-tegra.bin This your Uboot Image which contains the SPL and Uboot.

Boot script

Booting Linux from UART is tedious and you may don't have UART access. To automate the boot process a boot script can be used. Create a file:

boot.script
echo 'Linux is booted from boot.scr'
setenv bootargs "console=tty0 root=/dev/mmcblk1p2 rootwait"
setenv kern_addr 0x80008000
fatload mmc 1:1 ${kern_addr} /zImage
fatload mmc 1:1 ${fdt_addr_r} /tegra30-microsoft-surface-rt.dtb
bootz ${kern_addr} - ${fdt_addr_r}

Compile it using: mkimage -A arm -O linux -a 0 -e 0 -T script -C none -n "SurfaceRT Boot Script" -d boot.script boot.scr

Place boot.scr on the SD Card next to the kernel. Tip: Don't hit any key to stop autoboot

Last updated