Skip to content

Commit

Permalink
Merge pull request #236 from siemens/su/split-pgs
Browse files Browse the repository at this point in the history
Split the firmware building for PG1 and PG2
  • Loading branch information
BaochengSu authored Jan 5, 2022
2 parents f9615cf + 4db11bc commit 40d3fc0
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ jobs:
build/tmp/deploy/images/iot2050/iot2050-image-example-iot2050-debian-iot2050.wic.img.bmap
bootloaders:
name: Bootloaders
name: Bootloaders for both PG1 and PG2
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build image
- name: Build bootloader image for PG1
run: ./kas-container build kas-iot2050-boot.yml:kas/opt/pg1.yml
- name: Build bootloader image for PG2
run: ./kas-container build kas-iot2050-boot.yml
- name: Archive bootloaders
uses: actions/upload-artifact@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ all:
- kas build kas-iot2050-example.yml
- kas build kas-iot2050-example.yml:kas/opt/preempt-rt.yml
- sudo rm -rf build/tmp
- kas build kas-iot2050-boot.yml:kas/opt/pg1.yml
- sudo rm -rf build/tmp
- kas build kas-iot2050-boot.yml
2 changes: 1 addition & 1 deletion conf/machine/iot2050.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

DISTRO_ARCH ?= "arm64"

PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-iot2050"
PREFERRED_PROVIDER_u-boot-${MACHINE} ?= "u-boot-iot2050-pg2"

KERNEL_NAME ?= "iot2050"

Expand Down
16 changes: 16 additions & 0 deletions kas/opt/pg1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) Siemens AG, 2022
#
# Authors:
# Su Baocheng <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#

header:
version: 10

local_conf_header:
u-boot: |
PREFERRED_PROVIDER_u-boot-${MACHINE} = "u-boot-iot2050-pg1"
22 changes: 12 additions & 10 deletions recipes-bsp/u-boot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,33 @@ The boot loader is built like this:
./kas-container build kas-iot2050-boot.yml
```

After the build the boot image is under
Default built is for PG2 board. To build for PG1:

```shell
./kas-container build kas-iot2050-boot.yml:kas/opt/pg1.yml
```

After the build the boot images are under

```text
build/tmp/deploy/images/iot2050/iot2050-image-boot.bin
build/tmp/deploy/images/iot2050/iot2050-pg1-image-boot.bin
build/tmp/deploy/images/iot2050/iot2050-pg2-image-boot.bin
```

## Flashing the image

> :warning:
> Flashing an incorrect image may brick the device!
Write `iot2050-image-boot.bin` to an SD card and insert that into
Write `iot2050-pgN-image-boot.bin` to an SD card and insert that into
the target device. Then boot into the U-Boot shell and execute there:

```shell
sf probe
load mmc 0:1 $loadaddr /path/to/iot2050-image-boot.bin
load mmc 0:1 $loadaddr /path/to/iot2050-pgN-image-boot.bin
sf update $loadaddr 0x0 $filesize
```

> :note:
> When updating the boot loader of the BASIC variant, make sure to remove
> 0014-iot2050-Provide-dtb-for-devices-using-boot-load-V01..patch from the kernel
> patch queue in recipes-kernel/linux/linux-iot2050_*.bb.
## Recovering a bricked device

If the device does not come up anymore after flashing the boot loader, you can
Expand All @@ -41,5 +43,5 @@ Dediprog SF100 or SF600. Attach the programmer to X17, then run the following
on the host machine:

```shell
dpcmd --vcc 2 -v -u iot2050-image-boot.bin
dpcmd --vcc 2 -v -u iot2050-pgN-image-boot.bin
```
Binary file modified recipes-bsp/u-boot/files/prebuild/sysfw.itb_HS
Binary file not shown.
Binary file modified recipes-bsp/u-boot/files/prebuild/sysfw_sr2.itb_HS
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions recipes-bsp/u-boot/u-boot-iot2050-pg1_2021.04.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright (c) Siemens AG, 2022
#
# Authors:
# Su Baocheng <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#

require u-boot-iot2050_2021.04.inc

SPI_FLASH_DEPLOY_IMG = "iot2050-pg1-image-boot.bin"

do_prepare_build_append() {
ln -sf ../prebuild/tiboot3_sr1.bin ${S}/tiboot3.bin
}
17 changes: 17 additions & 0 deletions recipes-bsp/u-boot/u-boot-iot2050-pg2_2021.04.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright (c) Siemens AG, 2022
#
# Authors:
# Su Baocheng <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
#

require u-boot-iot2050_2021.04.inc

SPI_FLASH_DEPLOY_IMG = "iot2050-pg2-image-boot.bin"

do_prepare_build_append() {
ln -sf ../prebuild/tiboot3_sr2.bin ${S}/tiboot3.bin
}
2 changes: 1 addition & 1 deletion recipes-bsp/u-boot/u-boot-iot2050.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ U_BOOT_CONFIG = "iot2050_defconfig"
U_BOOT_BIN = "flash.bin"

SPI_FLASH_IMG = "${U_BOOT_BIN}"
SPI_FLASH_DEPLOY_IMG = "iot2050-image-boot.bin"
SPI_FLASH_DEPLOY_IMG ??= "iot2050-image-boot.bin"

# Needed to resolve races as long as the layer has to rebuild swig
DEPENDS += "swig"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#
# Copyright (c) Siemens AG, 2020-2021
# Copyright (c) Siemens AG, 2020-2022
#
# Authors:
# Jan Kiszka <[email protected]>
# Su Baocheng <[email protected]>
#
# This file is subject to the terms and conditions of the MIT License. See
# COPYING.MIT file in the top-level directory.
Expand Down

0 comments on commit 40d3fc0

Please sign in to comment.