Skip to content

Commit

Permalink
sync with lx2160a_build / generate multi-boot images for SD, eMMC, SPI
Browse files Browse the repository at this point in the history
Signed-off-by: Josua Mayer <josua@solid-run.com>
  • Loading branch information
Josua-SR committed Oct 9, 2024
1 parent 28bc7e1 commit 651ed6c
Show file tree
Hide file tree
Showing 21 changed files with 3,614 additions and 20 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ jobs:
with:
path: sources/meta-solidrun-arm-lx2xxx

- name: Patch dependency layers
shell: bash {0}
run: |
pushd sources/poky
git am ../../sources/meta-solidrun-arm-lx2xxx/patches/poky/*.patch
popd
- name: Get build tag
shell: bash {0}
id: tag_step
Expand Down Expand Up @@ -125,7 +132,9 @@ jobs:
export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS CACHE_DIR"
export MACHINE=lx2160acex7-rev2
bitbake -k fsl-image-networking
wic create lx2160a-bootimg-sd -e fsl-image-networking
wic create lx2160a-bootimg-mmc -e fsl-image-networking
wic create lx2160a-bootimg-xspi -e fsl-image-networking
wic create lx2160a-rootimg -e fsl-image-networking
continue-on-error: true

- name: Update cache on the server (build may have failed)
Expand Down Expand Up @@ -160,8 +169,10 @@ jobs:
mv $DEPLOY_PATH/device-tree.tgz deploy/
cp -L $DEPLOY_PATH/Image deploy/
cp -L $DEPLOY_PATH/modules-lx2160acex7-rev2.tgz deploy/
cp build_lx2160acex7-rev2/lx2160a-bootimg-sd.wks*.direct deploy/lx2160a-bootimg-sd.img
xz -9 deploy/lx2160a-bootimg-sd.img
cp build_lx2160acex7-rev2/lx2160a-bootimg-mmc.wks*.direct deploy/lx2160a-bootimg-mmc.img
cp build_lx2160acex7-rev2/lx2160a-bootimg-xspi.wks*.direct deploy/lx2160a-bootimg-xspi.img
cp build_lx2160acex7-rev2/lx2160a-rootimg.wks*.direct deploy/lx2160a-rootimg.img
xz -9 deploy/lx2160a-*.img
ls -lh deploy/
- name: Deploy to the local minio storage
Expand All @@ -179,7 +190,7 @@ jobs:
publish_images:
needs: build_images
runs-on: self-hosted
if: github.event_name == 'push'
if: github.ref == 'refs/heads/kirkstone' && github.event_name != 'pull_request'
steps:
- name: Download an artifacts from MinIO
uses: yakubique/minio-download@v1.1.1
Expand Down
69 changes: 62 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@ Start in a **new empty directory** with plenty of free disk space - at least 30G
```
repo init -u https://github.com/nxp-qoriq/yocto-sdk.git -b kirkstone -m ls-5.15.71-2.2.0.xml
repo sync
git clone https://github.com/SolidRun/meta-solidrun-arm-lx2xxx.git sources/meta-solidrun-arm-lx2xxx
git clone -b kirkstone https://github.com/SolidRun/meta-solidrun-arm-lx2xxx.git sources/meta-solidrun-arm-lx2xxx
```

2. Initialise a build directory with example configuration files based on lx2160ardb, and appropriate shell environment variables:
2. apply downstream patches to dependent layers:

- `poky`: add support for wic images without partition table (for xspi image)

```
pushd sources/poky
git am ../../meta-solidrun-arm-lx2xxx/patches/poky/0001-wic-add-supppport-for-generating-images-without-part.patch
popd
```
3. Initialise a build directory with example configuration files based on lx2160ardb, and appropriate shell environment variables:
source ./setup-env -m lx2160ardb-rev2 -b build_lx2160acex7-rev2
3. Adapt example configuration files for SolidRun LX2160A CEX7:
4. Adapt example configuration files for SolidRun LX2160A CEX7:
- edit `build_lx2160acex7-rev2/conf/bblayers.conf`:
Expand All @@ -35,11 +45,11 @@ Start in a **new empty directory** with plenty of free disk space - at least 30G
- See below for additional configuration options.
4. Build nxp image `fsl-image-networking`:
5. Build nxp image `fsl-image-networking`:
bitbake fsl-image-networking
5. Generate bootable disk image:
6. Generate bootable disk image:
NXP QorIQ Layers by default do not assemble full bootable disk images,
users are expected to install all components to various offsets manually.
Expand All @@ -49,11 +59,26 @@ Start in a **new empty directory** with plenty of free disk space - at least 30G
- SD-Card / eMMC (includes rootfs):
wic create lx2160a-bootimg-sd -e fsl-image-networking
wic create lx2160a-bootimg-mmc -e fsl-image-networking
This generates a bootable disk image named `lx2160a-bootimg-sd.wks-<timestamp>-mmcblk.direct` that is suitable
This generates a bootable disk image named `lx2160a-bootimg-mmc.wks-<timestamp>-mmcblk.direct` that is suitable
for writing to SD-Card or eMMC data partition, from the previously built `fsl-image-networking` target.
- SPI Flash (without rootfs):
wic create lx2160a-bootimg-xspi -e fsl-image-networking
This generates a bootable spi flash image named `lx2160a-bootimg-xspi.wks-<timestamp>-mmcblk.direct` that is suitable
for writing to SPI flash, from the previously built `fsl-image-networking` target's bootloader parts.
- SD-Card / eMMC / USB / SATA / NVMe (rootfs only):
wic create lx2160a-rootimg -e fsl-image-networking
This generates a bootable disk image named `lx2160a-rootimg.wks-<timestamp>-mmcblk.direct` that is suitable
for writing to any block storage, from the previously built `fsl-image-networking`.
It comes with kernel + rootfs only, use on separate media, together with an SD or SPI boot image.
Note: The build environment and ability to run `bitbake` is lost when closing the terminal or rebooting.
It can be restored at any time by entering the build directory and sourcing the aut-generated `SOURCE_THIS` file:
Expand All @@ -79,6 +104,7 @@ DDR Clock can be configured in local.conf using `LX2160A_DDR_SPEED`, supported v
- `2400`
- `2600`
- `2666`
- `2900` only for LX2162A, and LX2160A binned 2GHz and higher (default)
- `3200` only for LX2160A binned 2.2GHz
Expand All @@ -94,6 +120,35 @@ CPU (Cortex A72) Clock can be configured in local.conf using `LX2160A_CPU_SPEED`
Bus clock can be configured in local.conf using `LX2160A_BUS_SPEED`, supported values are:
- `700` only for LX2160A binned 2GHz and higher (default)
- `750` (for over-clocking, or for specifically purchased 2.2GHz binned SoC)
## Known Issues
## Failed to spawn fakeroot worker: [Errno 32] Broken pipe
On systems with glibc newer than 2.36 builds will fail when either:
- libfakeroot had been built against glibc later than 2.36
- host system glibc is later than 2.36
Yocto uninative package can be updated for glibc-2.40 by cherry-picking a few commits from yocto kirkstone branch into NXPs BSP:
cd bsp/sources/poky
git cherry-pick 2890968bbce028efc47a19213f4eff2ccaf7b979
git cherry-pick bba090696873805e44b1f7b3278ef8369763a176
git cherry-pick aab6fc20de9473d8d7f277332601cbae70c53320
git cherry-pick 43b94d2b8496eae6e512c6deb291b5908b7ada47
git cherry-pick b8fded3df36ab206eaf3bc25b75acda2544679c5
git cherry-pick b4b545cd9d3905253c398a6a42a9bc13c42073be
git cherry-pick ad9420b072896b6a58a571c8123bcb17a813a1e7
git cherry-pick 529c7c30e6a1b7e1e8a5ba5ba70b8f2f2af770ec
git cherry-pick b36affbe96b2f9063f75e11f64f5a8ead1cb5c55
git cherry-pick 8190d9c754c9c3a1962123e1e86d99de96c1224c
Cache must also be cleared before the next build can succeed:
cd bsp/build
rm -rf tmp sstate-cache cache
## Maintainer Notes
Expand Down
9 changes: 5 additions & 4 deletions conf/machine/lx2160acex7.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ LX2160A_CPU_SPEED ?= "2000"
LX2160A_DDR_SPEED ?= "2900"

UEFI_XSPIBOOT ?= "LX2160ARDB_EFI_NORBOOT.fd"
BOOTTYPE ?= "flexspi_nor sd emmc"
RCWXSPI ?= "clearfog-cx/rcw_${LX2160A_CPU_SPEED}_${LX2160A_BUS_SPEED}_${LX2160A_DDR_SPEED}_8_5_2"
RCWSD ?= "clearfog-cx/rcw_${LX2160A_CPU_SPEED}_${LX2160A_BUS_SPEED}_${LX2160A_DDR_SPEED}_8_5_2"
RCWEMMC ?= "clearfog-cx/rcw_${LX2160A_CPU_SPEED}_${LX2160A_BUS_SPEED}_${LX2160A_DDR_SPEED}_8_5_2"
BOOTTYPE ?= "flexspi_nor sd emmc auto"
RCWXSPI ?= "clearfog-cx/rcw_${LX2160A_CPU_SPEED}_${LX2160A_BUS_SPEED}_${LX2160A_DDR_SPEED}_8_5_2_xspi"
RCWSD ?= "clearfog-cx/rcw_${LX2160A_CPU_SPEED}_${LX2160A_BUS_SPEED}_${LX2160A_DDR_SPEED}_8_5_2_sdhc"
RCWEMMC ?= "clearfog-cx/rcw_${LX2160A_CPU_SPEED}_${LX2160A_BUS_SPEED}_${LX2160A_DDR_SPEED}_8_5_2_sdhc"
RCWAUTO ?= "clearfog-cx/rcw_${LX2160A_CPU_SPEED}_${LX2160A_BUS_SPEED}_${LX2160A_DDR_SPEED}_8_5_2_auto"

EXTRA_IMAGEDEPENDS += "management-complex mc-utils rcw ls2-phy ddr-phy uefi qoriq-atf inphi"
USE_VT = "0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From 4cf3e6792e76c0e2fdc04e9831cd45f2896d22dd Mon Sep 17 00:00:00 2001
From: Josua Mayer <josua@solid-run.com>
Date: Wed, 9 Oct 2024 15:18:25 +0200
Subject: [PATCH] wic: add supppport for generating images without partition
table

Wic wks files are great for laying out various pieces that go at
offsets or partitions into bootable images not just for standard sotrgae
devices using partition tables - but also for spi flash or emmc boot
partitions which in itself do not have any traditional partition tables.

Add support for 'bootloader --ptable none' to generate imaegs without a
partition table at sector 0 - neither mbr nor gpt.
This is particularly useful for putting blobs at the first sector.

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
scripts/lib/wic/ksparser.py | 2 +-
scripts/lib/wic/plugins/imager/direct.py | 17 ++++++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 0df9eb0d05..d26bb05251 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -190,7 +190,7 @@ class KickStart():
bootloader = subparsers.add_parser('bootloader')
bootloader.add_argument('--append')
bootloader.add_argument('--configfile')
- bootloader.add_argument('--ptable', choices=('msdos', 'gpt'),
+ bootloader.add_argument('--ptable', choices=('msdos', 'gpt', 'none'),
default='msdos')
bootloader.add_argument('--timeout', type=int)
bootloader.add_argument('--source')
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 4d0b836ef6..c873e72848 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -401,6 +401,8 @@ class PartitionedImage():
overhead = MBR_OVERHEAD
elif self.ptable_format == "gpt":
overhead = GPT_OVERHEAD
+ else:
+ overhead = 0

# Skip one sector required for the partitioning scheme overhead
self.offset += overhead
@@ -509,14 +511,15 @@ class PartitionedImage():
with open(self.path, 'w') as sparse:
os.ftruncate(sparse.fileno(), self.min_size)

- logger.debug("Initializing partition table for %s", self.path)
- exec_native_cmd("parted -s %s mklabel %s" %
- (self.path, self.ptable_format), self.native_sysroot)
+ if self.ptable_format != "none":
+ logger.debug("Initializing partition table for %s", self.path)
+ exec_native_cmd("parted -s %s mklabel %s" %
+ (self.path, self.ptable_format), self.native_sysroot)

- logger.debug("Set disk identifier %x", self.identifier)
- with open(self.path, 'r+b') as img:
- img.seek(0x1B8)
- img.write(self.identifier.to_bytes(4, 'little'))
+ logger.debug("Set disk identifier %x", self.identifier)
+ with open(self.path, 'r+b') as img:
+ img.seek(0x1B8)
+ img.write(self.identifier.to_bytes(4, 'little'))

logger.debug("Creating partitions")

--
2.43.0

Loading

0 comments on commit 651ed6c

Please sign in to comment.