# Config for building u-boot and SPL from source

**URL:** https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755
**Category:** Developers
**Tags:** tinkering
**Created:** [October 23, 2019, 6:57pm UTC](https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755 "2019-10-23T18:57:51Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![synack](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/synack/32/2807_2.png) [@synack](https://forum.clockworkpi.com/u/synack)
#### Post date: [October 23, 2019, 6:57pm UTC](https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755/1 "2019-10-23T18:57:51Z")

</div>

I couldn’t find a defconfig for u-boot on the gameshell, but was able to get it figured out based on the device tree and schematics.

Known issues:  
The DRAM clock is set to the first timing I got working. It’s probably possible to clock the RAM faster. The datasheet for the chip on my board says that it’s DDR3L-1600, but I have no idea what that translates to in terms of A33 DRAM clock settings.

I don’t think I’ve got the LCD mode quite right, as the display backlight just flashes on startup and using the bmp command to load an image appears to do nothing.

The AXP\_DLDO settings turn on power to the wifi chip, which is probably unnecessary as the Linux kernel does this later in the boot, but it seemed like a good idea to include it to avoid issues with MMC1 timeouts. The rest of the AXP settings appear to match the defaults for all sun8i boards and are the same as those listed on the GameShell schematic.

I’ve tested this patch against HEAD of the upstream u-boot master branch as well as 2019.07.

Patch:

> <https://gist.github.com/JeremyGrosser/d89b1fb0bee50b02876d48af4b2af0a3>

Git branch:

> **[JeremyGrosser/u-boot](https://github.com/JeremyGrosser/u-boot/tree/clockworkpi_cpi3)**
>
> "Das U-Boot" Source Tree. Contribute to JeremyGrosser/u-boot development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![aplanas](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/aplanas/32/1404_2.png) [@aplanas](https://forum.clockworkpi.com/u/aplanas)
#### Post date: [October 24, 2019, 5:34pm UTC](https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755/2 "2019-10-24T17:34:12Z")

</div>

Are the patch and the uboot bin from here of some help?

> **[clockworkpi/Kernel](https://github.com/clockworkpi/Kernel/tree/master/v0.4)**
>
> CPI Linux Kernel. Contribute to clockworkpi/Kernel development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![synack](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/synack/32/2807_2.png) [@synack](https://forum.clockworkpi.com/u/synack)
#### Post date: [October 24, 2019, 7:46pm UTC](https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755/3 "2019-10-24T19:46:04Z")

</div>

The work I’ve done is based on that. Mostly just posting it here for reference, in case others need to rebuild u-boot from source.

---

<div class="post-metadata">

### Author: ![aplanas](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/aplanas/32/1404_2.png) [@aplanas](https://forum.clockworkpi.com/u/aplanas)
#### Post date: [February 11, 2020, 1:34pm UTC](https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755/4 "2020-02-11T13:34:59Z")

</div>

Using binwalk I found that there is a dtb in the u-boot loader from [https://github.com/clockworkpi/Kernel/tree/master/v0.4](https://github.com/clockworkpi/Kernel/tree/master/v0.4)

I decompiled it and I have something like this [https://gist.github.com/aplanas/9dd0b65b0049a430eb802e3492a6bec8](https://gist.github.com/aplanas/9dd0b65b0049a430eb802e3492a6bec8)

I moved it into the u-boot tree, but this cannot be recompiled back:

arch/arm/dts/sun8i-r16-clockworkpi-cpi3.dtb: ERROR (path\_references): /aliases: Reference to non-existent node or label “mmc2”

---

<div class="post-metadata">

### Author: ![synack](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/synack/32/2807_2.png) [@synack](https://forum.clockworkpi.com/u/synack)
#### Post date: [February 11, 2020, 9:18pm UTC](https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755/5 "2020-02-11T21:18:33Z")

</div>

According to the schematic [1], SDC2 (aka `mmc2`) is not connected to anything on the CPI3 board, so the device and pinctrl don’t need to be defined in the dtb. If there is a new revision of the CPI board that has this connected, then you’d need to add a new definition for `mmc2` along with your `mmc2_8bit` pinctrl.

```
&mmc2 {
    pinctrl-names = "default";
    pinctrl-0 = <&mmc2_8bit>;
    vmmc-supply = <&reg_dcdc1>;
    bus-width = <8>;
    non-removable;
    cap-mmc-hw-reset;
    status = "okay";
};

```

The patch I posted originally includes a working dts, so I’m not really sure what you’re trying to accomplish here.

[1] [https://github.com/clockworkpi/GameShellDocs](https://github.com/clockworkpi/GameShellDocs)

---

<div class="post-metadata">

### Author: ![aplanas](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/aplanas/32/1404_2.png) [@aplanas](https://forum.clockworkpi.com/u/aplanas)
#### Post date: [February 12, 2020, 6:19am UTC](https://forum.clockworkpi.com/t/config-for-building-u-boot-and-spl-from-source/4755/6 "2020-02-12T06:19:21Z")

</div>

> [@synack](#):
>
> The patch I posted originally includes a working dts, so I’m not really sure what you’re trying to accomplish here.

Indeed, the original patch is working properly. Extracting the original dtb from the uboot did not produced any good result.

I did a diff -u from your dts and the one form the kernel patch, now I am trying to figure out the reason of those changes.

My final goal would be to test if I can use UEFI and Grub. IIUC uboot can provide an UEFI command line for non-UEFI devices.
