Skip to content

Commit

Permalink
Merge pull request #92 from ndechesne/meta-qcom-next
Browse files Browse the repository at this point in the history
Migration of meta-qcom (and merge with meta-qcom-hwe)
  • Loading branch information
ricardosalveti authored Jan 17, 2025
2 parents d55004a + 56f8251 commit 0da8663
Show file tree
Hide file tree
Showing 241 changed files with 15,244 additions and 46 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-yocto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ jobs:
- qcm6490-idp
- qcs6490-rb3gen2-core-kit
- sa8775p-ride-sx
- qcom-armv8a
- qcom-armv7a
- qcom-armv7a-modem
runs-on: [self-hosted, x86]
name: ${{ matrix.machine }}/poky/systemd
steps:
Expand Down
24 changes: 12 additions & 12 deletions COPYING.MIT
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions README
65 changes: 41 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# meta-qcom-hwe
# meta-qcom

[![Build Yocto](https://github.com/qualcomm-linux/meta-qcom-hwe/actions/workflows/build-yocto.yml/badge.svg?event=push)](https://github.com/qualcomm-linux/meta-qcom-hwe/actions/workflows/build-yocto.yml)
[![Nightly Build](https://github.com/qualcomm-linux/meta-qcom-hwe/actions/workflows/nightly-build.yml/badge.svg)](https://github.com/qualcomm-linux/meta-qcom-hwe/actions/workflows/nightly-build.yml)
[![Build Yocto](https://github.com/qualcomm-linux/meta-qcom/actions/workflows/build-yocto.yml/badge.svg?event=push)](https://github.com/qualcomm-linux/meta-qcom/actions/workflows/build-yocto.yml)
[![Nightly Build](https://github.com/qualcomm-linux/meta-qcom/actions/workflows/nightly-build.yml/badge.svg)](https://github.com/qualcomm-linux/meta-qcom/actions/workflows/nightly-build.yml)

## Introduction

Expand All @@ -17,22 +17,39 @@ URI: https://github.com/openembedded/openembedded-core.git
layers: meta
branch: master
revision: HEAD
```

This layers has an optional dependency on meta-oe layer:

URI: https://github.com/Linaro/meta-qcom.git
```
URI: https://github.com/openembedded/meta-openembedded.git
layers: meta-oe
branch: master
revision: HEAD
```

The dependency is optional, and not strictly required. When meta-oe is enabled
in the build (e.g. it is used in BBLAYERS) then additional recipes from
meta-qcom are added to the metadata. You can refer to meta-qcom/conf/layer.conf
for the implementation details.

## Branches

* **main:** Primary development branch, with focus on upstream support and
- **master:** Primary development branch, with focus on upstream support and
compatibility with the most recent Yocto Project release.
* **kirkstone:** Qualcomm Linux 1.x, aligned with Yocto Project 4.0 (LTS).
- **all stable branch up until styhead:** Legacy branches maintained by Linaro,
prior to the migration to [Qualcomm-linux](https://github.com/qualcomm-linux).

## Machine Support

See `conf/machine` for the complete list of supported devices.

## Generic machine support

All contemporary boards are supported by a single qcom-armv8a machine. It can be
used instead of using the per-board configuration file. In order to enable
support for the particular device extend the qcom-armv8a.conf file .

## Quick build

Please refer to the [Yocto Project Reference Manual](https://docs.yoctoproject.org/ref-manual/system-requirements.html)
Expand All @@ -42,23 +59,23 @@ Please follow the instructions below for a KAS-based build. The KAS tool offers
an easy way to setup bitbake based projects. For more details, visit the
[KAS documentation](https://kas.readthedocs.io/en/latest/index.html).

1. Install kas tool:
1. Install kas tool

```
sudo pip3 install kas
```
```
sudo pip3 install kas
```
2. Clone `meta-qcom-hwe` layer:
2. Clone meta-qcom layer
```
git clone https://github.com/qualcomm-linux/meta-qcom-hwe.git -b main
```
```
git clone https://github.com/qualcomm-linux/meta-qcom.git -b master
```
3. Build using the KAS configuration for one of the supported boards
```
kas build meta-qcom-hwe/ci/qcs6490-rb3gen2-core-kit.yml
```
```
kas build meta-qcom/ci/qcs6490-rb3gen2-core-kit.yml
```
For a manual build without KAS, refer to the [Yocto Project Quick Build](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html).
Expand Down Expand Up @@ -160,22 +177,22 @@ Make sure that ModemManager is not running, disable it if necessary.
## Contributing
Please submit any patches against the `meta-qcom-hwe` layer (branch **main**)
by using the GitHub pull-request feature. Fork the repo, create a branch, do
the work, rebase from upstream, and create the pull request.
Please submit any patches against the `meta-qcom` layer (branch **master**)
by using the GitHub pull-request feature. Fork the repo, create a branch,
do the work, rebase from upstream, and create the pull request.
For some useful guidelines when submitting patches, please refer to:
[Preparing Changes for Submission](https://docs.yoctoproject.org/dev/contributor-guide/submit-changes.html#preparing-changes-for-submission)
Pull requests will be discussed within the GitHub pull-request infrastructure.
Branch **kirkstone** is not open for direct contributions, please raise an
issue with the suggested change instead.
Branch **kirkstone** is not open for direct contributions, please raise an issue
with the suggested change instead.
## Communication
* **GitHub Issues:** [meta-qcom-hwe issues](https://github.com/qualcomm-linux/meta-qcom-hwe/issues)
* **Pull Requests:** [meta-qcom-hwe pull requests](https://github.com/qualcomm-linux/meta-qcom-hwe/pulls)
- **GitHub Issues:** [meta-qcom issues](https://github.com/qualcomm-linux/meta-qcom/issues)
- **Pull Requests:** [meta-qcom pull requests](https://github.com/qualcomm-linux/meta-qcom/pulls)
## Maintainer(s)
Expand Down
3 changes: 0 additions & 3 deletions ci/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ defaults:
repos:
meta-qcom-hwe:

meta-qcom:
url: https://github.com/Linaro/meta-qcom

poky:
url: https://git.yoctoproject.org/git/poky
layers:
Expand Down
11 changes: 11 additions & 0 deletions ci/qcom-armv7a-modem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/siemens/kas/master/kas/schema-kas.json

header:
version: 14
includes:
- ci/base.yml

local_conf_header:
qcomflash: |
machine: qcom-armv7a-modem
11 changes: 11 additions & 0 deletions ci/qcom-armv7a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/siemens/kas/master/kas/schema-kas.json

header:
version: 14
includes:
- ci/base.yml

local_conf_header:
qcomflash: |
machine: qcom-armv7a
11 changes: 11 additions & 0 deletions ci/qcom-armv8a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/siemens/kas/master/kas/schema-kas.json

header:
version: 14
includes:
- ci/base.yml

local_conf_header:
qcomflash: |
machine: qcom-armv8a
2 changes: 1 addition & 1 deletion ci/yocto-check-layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CMD="$CMD $TOPDIR"
# Disable auto layer discovery
CMD="$CMD --no-auto"
# Layers to process for dependencies
CMD="$CMD --dependency $KAS_WORK_DIR/poky/meta $KAS_WORK_DIR/meta-qcom"
CMD="$CMD --dependency $KAS_WORK_DIR/poky/meta"
# Disable automatic testing of dependencies
CMD="$CMD --no-auto-dependency"
# Set machines to all machines defined in this BSP layer
Expand Down
152 changes: 152 additions & 0 deletions classes/linux-qcom-bootimg.bbclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
QIMG_DEPLOYDIR = "${WORKDIR}/qcom_deploy-${PN}"

# Define INITRAMFS_IMAGE to create kernel+initramfs Android boot images in
# addition to default boot images. For example add the following line to your
# conf/local.conf:
#
# INITRAMFS_IMAGE = "initramfs-kerneltest-image"
#

python __anonymous () {
if d.getVar('INITRAMFS_IMAGE') != '':
d.appendVarFlag('do_qcom_img_deploy', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
}

python do_qcom_img_deploy() {
import shutil
import subprocess

subdir = d.getVar("KERNEL_DEPLOYSUBDIR")
if subdir is not None:
qcom_deploy_dir = os.path.join(d.getVar("QIMG_DEPLOYDIR"), subdir)
image_dir = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), subdir)
else:
qcom_deploy_dir = d.getVar("QIMG_DEPLOYDIR")
image_dir = d.getVar("DEPLOY_DIR_IMAGE")

initrd = None
if d.getVar('INITRAMFS_IMAGE') != '':
initrd_image_name = d.getVar("INITRAMFS_IMAGE_NAME")
baseinitrd = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), initrd_image_name)
for img in (".cpio.gz", ".cpio.lz4", ".cpio.lzo", ".cpio.lzma", ".cpio.xz", ".cpio"):
if os.path.exists(baseinitrd + img):
initrd = baseinitrd + img
break
if not initrd:
bb.fatal("Could not find initramfs image %s for bundling" % d.getVar("INITRAMFS_IMAGE"))

B = d.getVar("B")
D = d.getVar("D")
kernel_output_dir = d.getVar("KERNEL_OUTPUT_DIR")
kernel_dtbdest = d.getVar("KERNEL_DTBDEST")
kernel = os.path.join(B, "kernel-dtb")
definitrd = os.path.join(B, "initrd.img")
mkbootimg = os.path.join(d.getVar("STAGING_BINDIR_NATIVE"), "skales", "mkbootimg")
kernel_image_name = d.getVar("KERNEL_IMAGE_NAME")
kernel_link_name = d.getVar("KERNEL_IMAGE_LINK_NAME")
output_img = os.path.join(qcom_deploy_dir, "boot-%s.img" % (kernel_link_name))
output_sd_img = os.path.join(qcom_deploy_dir, "boot-sd-%s.img" % (kernel_link_name))

arch = d.getVar("ARCH")
if arch == "arm":
kernel_name = "zImage"
elif arch == "arm64":
kernel_name = "Image.gz"
else:
bb.fatal("Unuspported ARCH %s" % arch)

if os.path.exists(output_img):
os.unlink(output_img)
if os.path.exists(output_sd_img):
os.unlink(output_sd_img)

with open(definitrd, "w") as f:
f.write("This is not an initrd\n")

for dtbf in d.getVar("KERNEL_DEVICETREE").split():
dtb = os.path.basename(dtbf)
dtb_name = dtb.rsplit('.', 1)[0]

def getVarDTB(name):
var = d.getVarFlag(name, dtb_name)
return d.getVar(name) if var is None else var

def make_image_internal(output, output_link, rootfs, initrd = definitrd):
rootfs_cmdline = "root=%s " % (rootfs) if rootfs else ""
subprocess.check_call([mkbootimg,
"--kernel", kernel,
"--ramdisk", initrd,
"--output", output,
"--pagesize", getVarDTB("QCOM_BOOTIMG_PAGE_SIZE"),
"--base", getVarDTB("QCOM_BOOTIMG_KERNEL_BASE"),
"--cmdline", "%srw rootwait %s %s" % (rootfs_cmdline, consoles, getVarDTB("KERNEL_CMDLINE_EXTRA") or "")])
if os.path.exists(output_link):
os.unlink(output_link)
os.symlink(os.path.basename(output), output_link)

def make_image(template, rootfs):
output = os.path.join(qcom_deploy_dir, template % (dtb_name, kernel_image_name))
output_link = os.path.join(qcom_deploy_dir, template % (dtb_name, kernel_link_name))
make_image_internal(output, output_link, rootfs)
return output

def make_initramfs_image(template, rootfs, initrd, initrd_image_name):
output = os.path.join(qcom_deploy_dir, template % (initrd_image_name, dtb_name, kernel_image_name))
output_link = os.path.join(qcom_deploy_dir, template % (initrd_image_name, dtb_name, kernel_link_name))
make_image_internal(output, output_link, rootfs, initrd)
output_link = os.path.join(qcom_deploy_dir, template % ("initramfs", dtb_name, kernel_link_name))
if os.path.exists(output_link):
os.unlink(output_link)
os.symlink(os.path.basename(output), output_link)
return output

consoles = ' '.join(map(lambda c: "console=%(tty)s,%(rate)sn8" % dict(zip(("rate", "tty"), c.split(';'))), getVarDTB("SERIAL_CONSOLES").split()))

# prepare kernel image with appended dtb
with open(kernel, 'wb') as wfd:
with open(os.path.join(kernel_output_dir, kernel_name), 'rb') as rfd:
shutil.copyfileobj(rfd, wfd)
with open(os.path.join(D, kernel_dtbdest, dtb), 'rb') as rfd:
shutil.copyfileobj(rfd, wfd)

rootfs = getVarDTB("QCOM_BOOTIMG_ROOTFS")
if rootfs is None:
bb.fatal("QCOM_BOOTIMG_ROOTFS is undefined")

output = make_image("boot-%s-%s.img", rootfs)
if not os.path.exists(output_img):
os.symlink(os.path.basename(output), output_img)

if initrd:
make_initramfs_image("boot-%s-%s-%s.img", rootfs, initrd, d.getVar("INITRAMFS_IMAGE"))

sd_rootfs = getVarDTB("SD_QCOM_BOOTIMG_ROOTFS")
if sd_rootfs:
output = make_image("boot-sd-%s-%s.img", sd_rootfs)
if not os.path.exists(output_sd_img):
os.symlink(os.path.basename(output), output_sd_img)

if initrd:
make_initramfs_image("boot-sd-%s-%s-%s.img", rootfs, initrd, d.getVar("INITRAMFS_IMAGE"))
}

do_qcom_img_deploy[depends] += "skales-native:do_populate_sysroot"
do_qcom_img_deploy[vardeps] = "QCOM_BOOTIMG_PAGE_SIZE QCOM_BOOTIMG_KERNEL_BASE KERNEL_CMDLINE_EXTRA QCOM_BOOTIMG_ROOTFS"

addtask qcom_img_deploy after do_populate_sysroot do_packagedata do_bundle_initramfs before do_deploy

# Setup sstate, see deploy.bbclass
SSTATETASKS += "do_qcom_img_deploy"
do_qcom_img_deploy[sstate-inputdirs] = "${QIMG_DEPLOYDIR}"
do_qcom_img_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"

python do_qcom_img_deploy_setscene () {
sstate_setscene(d)
}
addtask do_qcom_img_deploy_setscene
do_qcom_img_deploy[dirs] = "${QIMG_DEPLOYDIR} ${B}"
do_qcom_img_deploy[cleandirs] = "${QIMG_DEPLOYDIR}"
do_qcom_img_deploy[stamp-extra-info] = "${MACHINE_ARCH}"

# We do not need kernel image in /boot, these images are flashed into separate partition.
RDEPENDS:${KERNEL_PACKAGE_NAME}-base = ""
Loading

0 comments on commit 0da8663

Please sign in to comment.