diff --git a/.oebuild/workflows/ci.yaml b/.oebuild/workflows/ci.yaml index ad2ad1ce87cb0525ba5a18f046838a29b13f5797..fa9dac371bd36cbd0b1c17d434ad774be322a794 100644 --- a/.oebuild/workflows/ci.yaml +++ b/.oebuild/workflows/ci.yaml @@ -37,14 +37,14 @@ build_list: - target: openeuler-image - target: openeuler-image -c do_populate_sdk ########################################## -# - name: raspberrypi4-64-ros -# platform: raspberrypi4-64 -# directory: raspberrypi4-64-ros -# feature: -# - name: openeuler-ros -# bitbake: -# - target: openeuler-image-ros -# - target: openeuler-image-ros -c do_populate_sdk + - name: raspberrypi4-64-ros + platform: raspberrypi4-64 + directory: raspberrypi4-64-ros + feature: + - name: openeuler-ros + bitbake: + - target: openeuler-image-ros + - target: openeuler-image-ros -c do_populate_sdk ########################################## - name: raspberrypi4-64-qt platform: raspberrypi4-64 diff --git a/.oebuild/workflows/jenkinsfile_gate b/.oebuild/workflows/jenkinsfile_gate new file mode 100644 index 0000000000000000000000000000000000000000..46de4ab3295e0ae058ce5138890cceab517fa737 --- /dev/null +++ b/.oebuild/workflows/jenkinsfile_gate @@ -0,0 +1,405 @@ +def downloadEmbeddedCI(){ + sh 'rm -rf embedded-ci' + sh "git clone ${embeddedRemote} -b ${embeddedBranch} -v embedded-ci --depth=1" +} + +def downloadYoctoWithPr(String workspace, String namespace, String repo, Integer prnum, Integer deepth){ + sh """ + python3 main.py clone_repo \ + -w ${workspace} \ + -r https://gitee.com/${namespace}/${repo} \ + -p ${repo} \ + -pr ${prnum} \ + -dp ${deepth} + """ +} + +def formatRes(String name, String action, String check_res, String log_path){ + return sh (script: """ + python3 main.py serial \ + -c name=$name \ + -c action=$action \ + -c result=$check_res \ + -c log_path=$log_path + """, returnStdout: true).trim() +} + +def getRandomStr(){ + return sh(script: """ + cat /proc/sys/kernel/random/uuid + """, returnStdout: true).trim() +} + +def mkdirOpeneulerLog(){ + def logdir = "openeuler/log" + sh "mkdir -p $logdir" + return logdir +} + +def STAGES_RES = [] + +pipeline { + agent { node "${node}" } + environment { + PATH = "/home/jenkins/.local/bin:${env.PATH}" + } + stages { + stage("clone embedded-ci"){ + steps{ + dir('/home/jenkins/agent'){ + script{ + downloadEmbeddedCI() + } + } + } + } + stage("pre") { + steps { + dir('/home/jenkins/agent/embedded-ci'){ + script{ + withCredentials([ + string(credentialsId: "${giteeId}", variable: 'GITEETOKEN'), + usernamePassword(credentialsId: "${jenkinsId}", usernameVariable: 'JUSER',passwordVariable: 'JPASSWD')]){ + // 执行pre + sh """ + python3 main.py pre \ + -s /home/jenkins/ccache/openeuler_embedded \ + -o $giteeTargetNamespace \ + -p $giteeRepoName \ + -pr $giteePullRequestid \ + -juser $JUSER \ + -jpwd $JPASSWD \ + -gt $GITEETOKEN + """ + // 执行pr_check + env.pr_check_result = sh (script: """ + python3 main.py pr_check \ + -o $giteeTargetNamespace \ + -p $giteeRepoName \ + -pr $giteePullRequestid \ + -gt $GITEETOKEN + """, returnStdout: true).trim() + } + } + } + } + } + stage("code check"){ + steps { + dir('/home/jenkins/agent/embedded-ci'){ + script{ + // 下载yocto源码 + downloadYoctoWithPr("/home/jenkins/agent", giteeTargetNamespace, giteeRepoName, Integer.parseInt(giteePullRequestid), Integer.parseInt(commitCount)) + def randomStr = getRandomStr() + def logDir = mkdirOpeneulerLog() + // 执行commit检查 + def task_res_code = sh (script: """ + python3 main.py codecheck \ + -c /home/jenkins/agent/yocto-meta-openeuler \ + -target commit_msg \ + -o $giteeTargetNamespace \ + -p $giteeRepoName \ + -pr $giteePullRequestid > ${logDir}/${randomStr}.log + """, returnStatus: true) + def check_res = "" + if (task_res_code == 0){ + check_res = "success" + }else{ + check_res = "failed" + env.code_check_result = "failed" + } + // 对检查赋值 + // env.task_check_commit = formatRes("check", "commit_check", check_res, "xxx") + archiveArtifacts "${logDir}/*.log" + STAGES_RES.push(formatRes("check", "commit_check", check_res, "artifact/${logDir}/${randomStr}.log")) + } + } + dir('/home/jenkins/agent/embedded-ci'){ + script{ + // 执行scope检查 + def randomStr = getRandomStr() + def logDir = mkdirOpeneulerLog() + // 执行commit检查 + def task_res_code = sh (script: """ + python3 main.py codecheck \ + -target commit_scope \ + -o $giteeTargetNamespace \ + -p $giteeRepoName \ + -pr $giteePullRequestid > ${logDir}/${randomStr}.log + """, returnStatus: true) + def check_res = "" + if (task_res_code == 0){ + check_res = "success" + }else{ + check_res = "failed" + env.code_check_result = "failed" + } + // 对检查赋值 + // env.task_check_scope = formatRes("check", "scope_check", check_res, "xxx") + archiveArtifacts "${logDir}/*.log" + STAGES_RES.push(formatRes("check", "scope_check", check_res, "artifact/${logDir}/${randomStr}.log")) + } + } + } + } + stage("check task"){ + when { + expression { + return env.code_check_result != "failed" + } + } + parallel { + stage("docs"){ + agent { node "${node}" } + when { + expression { + return env.pr_check_result.contains("docs") + } + } + steps{ + dir('/home/jenkins/agent'){ + script{ + downloadEmbeddedCI() + } + } + dir('/home/jenkins/agent/embedded-ci'){ + script{ + // 执行docs编译 + // 下载yocto源码 + downloadYoctoWithPr("/home/jenkins/agent", giteeTargetNamespace, giteeRepoName, Integer.parseInt(giteePullRequestid), 1) + def randomStr = getRandomStr() + def logDir = mkdirOpeneulerLog() + // 执行文档编译检查 + def task_res_code = sh (script: """ + python3 main.py build \ + -c /home/jenkins/agent/yocto-meta-openeuler \ + -target openeuler_doc > ${logDir}/${randomStr}.log + """, returnStatus: true) + def check_res = "" + if (task_res_code == 0){ + check_res = "success" + }else{ + check_res = "failed" + } + // 对检查赋值 + // env.task_build_docs = formatRes("docs", "build", check_res, "xxx") + archiveArtifacts "${logDir}/*.log" + STAGES_RES.push(formatRes("docs", "build", check_res, "artifact/${logDir}/${randomStr}.log")) + } + } + } + } + stage("qemu_aarch64"){ + agent { node "${node}" } + when { + expression { + return env.pr_check_result.contains("code") + } + } + steps { + dir('/home/jenkins/agent'){ + script{ + downloadEmbeddedCI() + } + } + dir('/home/jenkins/agent/embedded-ci'){ + script{ + // 执行qemu_aarch64编译 + // 下载yocto源码 + downloadYoctoWithPr("/home/jenkins/agent", giteeTargetNamespace, giteeRepoName, Integer.parseInt(giteePullRequestid), 1) + def randomStr = getRandomStr() + def logDir = mkdirOpeneulerLog() + // 执行镜像编译检查 + def task_res_code = sh (script: """ + python3 main.py build \ + -c /home/jenkins/agent/yocto-meta-openeuler \ + -target openeuler_image \ + -a aarch64 \ + -t /usr1/openeuler/gcc/openeuler_gcc_arm64le \ + -p qemu-aarch64 \ + -i openeuler-image \ + -d qemu-aarch64 > ${logDir}/${randomStr}.log + """, returnStatus: true) + + def check_res = "" + if (task_res_code == 0){ + check_res = "success" + }else{ + check_res = "failed" + } + // 对检查赋值 + archiveArtifacts "${logDir}/*.log" + STAGES_RES.push(formatRes("qemu_aarch64", "build", check_res, "artifact/${logDir}/${randomStr}.log")) + } + } + } + } + stage("qemu_aarch64_tiny"){ + agent { node "${node}" } + when { + expression { + return env.pr_check_result.contains("code") + } + } + steps { + dir('/home/jenkins/agent'){ + script{ + downloadEmbeddedCI() + } + } + dir('/home/jenkins/agent/embedded-ci'){ + script{ + // 执行qemu_aarch64编译 + // 下载yocto源码 + downloadYoctoWithPr("/home/jenkins/agent", giteeTargetNamespace, giteeRepoName, Integer.parseInt(giteePullRequestid), 1) + def randomStr = getRandomStr() + def logDir = mkdirOpeneulerLog() + // 执行镜像编译检查 + def task_res_code = sh (script: """ + python3 main.py build \ + -c /home/jenkins/agent/yocto-meta-openeuler \ + -target openeuler_image \ + -a aarch64 \ + -t /usr1/openeuler/gcc/openeuler_gcc_arm64le \ + -p qemu-aarch64 \ + -i openeuler-image-tiny \ + -d qemu-aarch64-tiny > ${logDir}/${randomStr}.log + """, returnStatus: true) + + def check_res = "" + if (task_res_code == 0){ + check_res = "success" + }else{ + check_res = "failed" + } + // 对检查赋值 + archiveArtifacts "${logDir}/*.log" + STAGES_RES.push(formatRes("qemu_aarch64_tiny", "build", check_res, "artifact/${logDir}/${randomStr}.log")) + } + } + } + } + stage("qemu_arm"){ + agent { node "${node}" } + when { + expression { + return env.pr_check_result.contains("code") + } + } + steps { + dir('/home/jenkins/agent'){ + script{ + downloadEmbeddedCI() + } + } + dir('/home/jenkins/agent/embedded-ci'){ + script{ + // 执行qemu_arm编译 + // 下载yocto源码 + downloadYoctoWithPr("/home/jenkins/agent", giteeTargetNamespace, giteeRepoName, Integer.parseInt(giteePullRequestid), 1) + def randomStr = getRandomStr() + def logDir = mkdirOpeneulerLog() + // 执行镜像编译检查 + def task_res_code = sh (script: """ + python3 main.py build \ + -c /home/jenkins/agent/yocto-meta-openeuler \ + -target openeuler_image \ + -a arm \ + -t /usr1/openeuler/gcc/openeuler_gcc_arm32le \ + -p qemu-arm \ + -i openeuler-image \ + -d qemu-arm > ${logDir}/${randomStr}.log + """, returnStatus: true) + + def check_res = "" + if (task_res_code == 0){ + check_res = "success" + }else{ + check_res = "failed" + } + // 对检查赋值 + archiveArtifacts "${logDir}/*.log" + STAGES_RES.push(formatRes("qemu_arm", "build", check_res, "artifact/${logDir}/${randomStr}.log")) + } + } + } + } + stage("qemu_x86"){ + agent { node "${node}" } + when { + expression { + return env.pr_check_result.contains("code") + } + } + steps { + dir('/home/jenkins/agent'){ + script{ + downloadEmbeddedCI() + } + } + dir('/home/jenkins/agent/embedded-ci'){ + script{ + // 执行qemu_arm编译 + // 下载yocto源码 + def randomStr = getRandomStr() + def logDir = mkdirOpeneulerLog() + downloadYoctoWithPr("/home/jenkins/agent", giteeTargetNamespace, giteeRepoName, Integer.parseInt(giteePullRequestid), 1) + // 执行镜像编译检查 + def task_res_code = sh (script: """ + python3 main.py build \ + -c /home/jenkins/agent/yocto-meta-openeuler \ + -target openeuler_image \ + -a x86_64 \ + -t /usr1/openeuler/gcc/openeuler_gcc_x86_64 \ + -p x86-64 \ + -i openeuler-image \ + -d qemu-x86-64 > ${logDir}/${randomStr}.log + """, returnStatus: true) + + def check_res = "" + if (task_res_code == 0){ + check_res = "success" + }else{ + check_res = "failed" + } + // 对检查赋值 + archiveArtifacts "${logDir}/*.log" + STAGES_RES.push(formatRes("qemu_x86", "build", check_res, "artifact/${logDir}/${randomStr}.log")) + } + } + } + } + } + } + } + post { + always { + dir('/home/jenkins/agent/embedded-ci'){ + script{ + withCredentials([ + string(credentialsId: "${giteeId}", variable: 'GITEETOKEN'), + usernamePassword(credentialsId: "${jenkinsId}", usernameVariable: 'JUSER',passwordVariable: 'JPASSWD')]){ + if (currentBuild.result != 'ABORTED') { + def chks = "" + for (int i = 0; i < STAGES_RES.size(); ++i) { + chks = "${chks} -chk ${STAGES_RES[i]}" + } + + def duration_time = System.currentTimeMillis() - currentBuild.startTimeInMillis + sh """ + python3 main.py comment \ + -m gate \ + -o $giteeTargetNamespace \ + -p $giteeRepoName \ + -pr $giteePullRequestid \ + -gt $GITEETOKEN \ + -dt $duration_time \ + $chks + """ + } + } + } + } + } + } +} diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-core/systemd/systemd_%.bbappend b/bsp/meta-openeuler-bsp/rockchip/recipes-core/systemd/systemd_%.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..0a8af110253b64cd2aba8fff8b65955b78400586 --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-core/systemd/systemd_%.bbappend @@ -0,0 +1,3 @@ +SRC_URI:remove = " \ + file://0001-basic-Allow-unknown-filesystems.patch \ +" diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/mkbootimg b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/mkbootimg new file mode 100755 index 0000000000000000000000000000000000000000..c3e09aba3499704e3faa327da6f265a25a82c8e8 --- /dev/null +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/files/tools/mkbootimg @@ -0,0 +1,234 @@ +#!/usr/bin/env python +# Copyright 2015, The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import print_function +from sys import argv, exit, stderr +from argparse import ArgumentParser, FileType, Action +from os import fstat +from struct import pack +from hashlib import sha1 +import sys +import re + +def filesize(f): + if f is None: + return 0 + try: + return fstat(f.fileno()).st_size + except OSError: + return 0 + + +def update_sha(sha, f): + if f: + sha.update(f.read()) + f.seek(0) + sha.update(pack('I', filesize(f))) + else: + sha.update(pack('I', 0)) + + +def pad_file(f, padding): + pad = (padding - (f.tell() & (padding - 1))) & (padding - 1) + f.write(pack(str(pad) + 'x')) + + +def get_number_of_pages(image_size, page_size): + """calculates the number of pages required for the image""" + return (image_size + page_size - 1) / page_size + + +def get_recovery_dtbo_offset(args): + """calculates the offset of recovery_dtbo image in the boot image""" + num_header_pages = 1 # header occupies a page + num_kernel_pages = get_number_of_pages(filesize(args.kernel), args.pagesize) + num_ramdisk_pages = get_number_of_pages(filesize(args.ramdisk), args.pagesize) + num_second_pages = get_number_of_pages(filesize(args.second), args.pagesize) + dtbo_offset = args.pagesize * (num_header_pages + num_kernel_pages + + num_ramdisk_pages + num_second_pages) + return dtbo_offset + + +def write_header(args): + BOOT_IMAGE_HEADER_V1_SIZE = 1648 + BOOT_IMAGE_HEADER_V2_SIZE = 1660 + BOOT_MAGIC = 'ANDROID!'.encode() + + if (args.header_version > 2): + raise ValueError('Boot header version %d not supported' % args.header_version) + + args.output.write(pack('8s', BOOT_MAGIC)) + final_ramdisk_offset = (args.base + args.ramdisk_offset) if filesize(args.ramdisk) > 0 else 0 + final_second_offset = (args.base + args.second_offset) if filesize(args.second) > 0 else 0 + args.output.write(pack('10I', + filesize(args.kernel), # size in bytes + args.base + args.kernel_offset, # physical load addr + filesize(args.ramdisk), # size in bytes + final_ramdisk_offset, # physical load addr + filesize(args.second), # size in bytes + final_second_offset, # physical load addr + args.base + args.tags_offset, # physical addr for kernel tags + args.pagesize, # flash page size we assume + args.header_version, # version of bootimage header + (args.os_version << 11) | args.os_patch_level)) # os version and patch level + args.output.write(pack('16s', args.board.encode())) # asciiz product name + args.output.write(pack('512s', args.cmdline[:512].encode())) + + sha = sha1() + update_sha(sha, args.kernel) + update_sha(sha, args.ramdisk) + update_sha(sha, args.second) + + if args.header_version > 0: + update_sha(sha, args.recovery_dtbo) + if args.header_version > 1: + update_sha(sha, args.dtb) + + img_id = pack('32s', sha.digest()) + + args.output.write(img_id) + args.output.write(pack('1024s', args.cmdline[512:].encode())) + + if args.header_version > 0: + args.output.write(pack('I', filesize(args.recovery_dtbo))) # size in bytes + if args.recovery_dtbo: + args.output.write(pack('Q', get_recovery_dtbo_offset(args))) # recovery dtbo offset + else: + args.output.write(pack('Q', 0)) # Will be set to 0 for devices without a recovery dtbo + + # Populate boot image header size for header versions 1 and 2. + if args.header_version == 1: + args.output.write(pack('I', BOOT_IMAGE_HEADER_V1_SIZE)) + elif args.header_version == 2: + args.output.write(pack('I', BOOT_IMAGE_HEADER_V2_SIZE)) + + if args.header_version > 1: + args.output.write(pack('I', filesize(args.dtb))) # size in bytes + args.output.write(pack('Q', args.base + args.dtb_offset)) # dtb physical load address + pad_file(args.output, args.pagesize) + return img_id + + +class ValidateStrLenAction(Action): + def __init__(self, option_strings, dest, nargs=None, **kwargs): + if 'maxlen' not in kwargs: + raise ValueError('maxlen must be set') + self.maxlen = int(kwargs['maxlen']) + del kwargs['maxlen'] + super(ValidateStrLenAction, self).__init__(option_strings, dest, **kwargs) + + def __call__(self, parser, namespace, values, option_string=None): + if len(values) > self.maxlen: + raise ValueError('String argument too long: max {0:d}, got {1:d}'. + format(self.maxlen, len(values))) + setattr(namespace, self.dest, values) + + +def write_padded_file(f_out, f_in, padding): + if f_in is None: + return + f_out.write(f_in.read()) + pad_file(f_out, padding) + + +def parse_int(x): + return int(x, 0) + +def parse_os_version(x): + match = re.search(r'^(\d{1,3})(?:\.(\d{1,3})(?:\.(\d{1,3}))?)?', x) + if match: + a = int(match.group(1)) + b = c = 0 + if match.lastindex >= 2: + b = int(match.group(2)) + if match.lastindex == 3: + c = int(match.group(3)) + # 7 bits allocated for each field + assert a < 128 + assert b < 128 + assert c < 128 + return (a << 14) | (b << 7) | c + return 0 + +def parse_os_patch_level(x): + match = re.search(r'^(\d{4})-(\d{2})-(\d{2})', x) + if match: + y = int(match.group(1)) - 2000 + m = int(match.group(2)) + # 7 bits allocated for the year, 4 bits for the month + assert y >= 0 and y < 128 + assert m > 0 and m <= 12 + return (y << 4) | m + return 0 + +def parse_cmdline(): + parser = ArgumentParser() + parser.add_argument('--kernel', help='path to the kernel', type=FileType('rb'), + required=True) + parser.add_argument('--ramdisk', help='path to the ramdisk', type=FileType('rb')) + parser.add_argument('--second', help='path to the 2nd bootloader', type=FileType('rb')) + parser.add_argument('--dtb', help='path to dtb', type=FileType('rb')) + recovery_dtbo_group = parser.add_mutually_exclusive_group() + recovery_dtbo_group.add_argument('--recovery_dtbo', help='path to the recovery DTBO', type=FileType('rb')) + recovery_dtbo_group.add_argument('--recovery_acpio', help='path to the recovery ACPIO', + type=FileType('rb'), metavar='RECOVERY_ACPIO', dest='recovery_dtbo') + parser.add_argument('--cmdline', help='extra arguments to be passed on the ' + 'kernel command line', default='', action=ValidateStrLenAction, maxlen=1536) + parser.add_argument('--base', help='base address', type=parse_int, default=0x10000000) + parser.add_argument('--kernel_offset', help='kernel offset', type=parse_int, default=0x00008000) + parser.add_argument('--ramdisk_offset', help='ramdisk offset', type=parse_int, default=0x01000000) + parser.add_argument('--second_offset', help='2nd bootloader offset', type=parse_int, + default=0x00f00000) + parser.add_argument('--dtb_offset', help='dtb offset', type=parse_int, default=0x01f00000) + + parser.add_argument('--os_version', help='operating system version', type=parse_os_version, + default=0) + parser.add_argument('--os_patch_level', help='operating system patch level', + type=parse_os_patch_level, default=0) + parser.add_argument('--tags_offset', help='tags offset', type=parse_int, default=0x00000100) + parser.add_argument('--board', help='board name', default='', action=ValidateStrLenAction, + maxlen=16) + parser.add_argument('--pagesize', help='page size', type=parse_int, + choices=[2**i for i in range(11,15)], default=2048) + parser.add_argument('--id', help='print the image ID on standard output', + action='store_true') + parser.add_argument('--header_version', help='boot image header version', type=parse_int, default=0) + parser.add_argument('-o', '--output', help='output file name', type=FileType('wb'), + required=True) + return parser.parse_args() + + +def write_data(args): + write_padded_file(args.output, args.kernel, args.pagesize) + write_padded_file(args.output, args.ramdisk, args.pagesize) + write_padded_file(args.output, args.second, args.pagesize) + + if args.header_version > 0: + write_padded_file(args.output, args.recovery_dtbo, args.pagesize) + if args.header_version > 1: + write_padded_file(args.output, args.dtb, args.pagesize) + +def main(): + args = parse_cmdline() + img_id = write_header(args) + write_data(args) + if args.id: + if isinstance(img_id, str): + # Python 2's struct.pack returns a string, but py3 returns bytes. + img_id = [ord(x) for x in img_id] + print('0x' + ''.join('{:02x}'.format(c) for c in img_id)) + +if __name__ == '__main__': + main() diff --git a/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-rockchip.inc b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-rockchip.inc index 010f7501579490dbce8fea9010f3b9a43af99b97..1a4f3d2e766b22bfebf49709b50b54b87743b641 100644 --- a/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-rockchip.inc +++ b/bsp/meta-openeuler-bsp/rockchip/recipes-kernel/linux/linux-rockchip.inc @@ -52,7 +52,7 @@ do_compile:append:ok3399(){ cp ../logo/* ./ scripts/mkkrnlimg ${KERNEL_OUTPUT_DIR}/Image kernel.img ../tools/mkimg --dtb ${ROCKCHIP_KERNEL_DTB_NAME} - scripts/mkbootimg --kernel ${KERNEL_OUTPUT_DIR}/Image --second resource.img -o boot.img && + ../tools/mkbootimg --kernel ${KERNEL_OUTPUT_DIR}/Image --second resource.img -o boot.img } # add boot.img to $D diff --git a/docs/source/bsp/arm32/index.rst b/docs/source/bsp/arm32/index.rst deleted file mode 100644 index 3371553099b7bd63325685edaaa72a20a6f485fa..0000000000000000000000000000000000000000 --- a/docs/source/bsp/arm32/index.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. _openeuler_embedded_arm32: - - -ARM32硬件 -################################ - -所支持的ARM32硬件如下: - -.. toctree:: - :maxdepth: 1 - :glob: - - */index diff --git a/docs/source/bsp/arm32/qemu_virt_cortex_a15/index.rst b/docs/source/bsp/arm32/qemu_virt_cortex_a15/index.rst deleted file mode 100644 index 0e45c83ea399e3bcf6ba035b8e96d9864bc0a04a..0000000000000000000000000000000000000000 --- a/docs/source/bsp/arm32/qemu_virt_cortex_a15/index.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. _board_qemu_cortex_a15: - - -QEMU Virt Cortex-A15 -###################################### - -基本介绍 -================= - - -构建说明 -================== - - -使用说明 -================= - diff --git a/docs/source/bsp/riscv/index.rst b/docs/source/bsp/riscv/index.rst deleted file mode 100644 index cf2bdb22785b8a57f3747c9a125519cc3e7083d3..0000000000000000000000000000000000000000 --- a/docs/source/bsp/riscv/index.rst +++ /dev/null @@ -1,13 +0,0 @@ -.. _openeuler_embedded_riscv: - - -RISC-V硬件 -################################ - -所支持的RISC-V硬件如下: - -.. toctree:: - :maxdepth: 1 - :glob: - - */index \ No newline at end of file diff --git a/docs/source/features/distributed_softbus.rst b/docs/source/features/distributed_softbus.rst index 4761e63c8a310ee22c7f747e850bfbf1829f4310..6aa81878c8f052a42d348da832bf7b2019cfa20f 100644 --- a/docs/source/features/distributed_softbus.rst +++ b/docs/source/features/distributed_softbus.rst @@ -1043,7 +1043,7 @@ hichain的客户端API头文件在嵌入式版本提供的sdk中对外开放, 基于isula的软总线应用指南 ************************* -在嵌入式23.09版本中,利用isula,制作了预装3.2版本软总线容器镜像,可以在嵌入式环境中通过几行命令就可以完成软总线复杂依赖的安装部署,以及与嵌入式、服务器设备的通信测试。此版本软总线使用binder作为IPC底层驱动,在树莓派静默无业务场景下,资源占用由原来的CPU单核80%降低到1%,并且为支持上层的分布式数据模块的拓展打下了基础。 +嵌入式23.09版本中,利用isula,制作了预装3.2版本软总线容器镜像。在嵌入式环境中通过几行命令就可以安装软总线及其复杂依赖,并完成设备间通信测试。此版本软总线使用binder作为IPC底层驱动,在树莓派静默无业务场景下,资源占用由原来的CPU单核80%降低到1%,并且为支持上层的分布式数据模块的拓展打下了基础。 .. note:: @@ -1064,7 +1064,7 @@ hichain的客户端API头文件在嵌入式版本提供的sdk中对外开放, .. code-block:: console - http://repo.openeuler.org/openEuler-23.09/embedded_img/aarch64/raspberrypi4-64-systemd/openeuler-image-raspberrypi4-64-20230921165629.rootfs.rpi-sdimg + https://repo.openeuler.org/openEuler-23.09/embedded_img/aarch64/raspberrypi4-64-systemd/openeuler-image-raspberrypi4-64-20230927180859.rootfs.rpi-sdimg 参考: @@ -1097,13 +1097,13 @@ hichain的客户端API头文件在嵌入式版本提供的sdk中对外开放, .. code-block:: console - cd /home; wget http://repo.openeuler.org/openEuler-23.09/embedded_img/dsoftbus_isula_image/softbus.xz + cd /home; wget https://repo.openeuler.org/openEuler-23.09/embedded_img/isula_img/openEuler-23.09-isula-softbus.aarch64.xz 6.使用isula加载软总线镜像 .. code-block:: console - isula import /home/softbus.xz softbus + isula import /home/openEuler-23.09-isula-softbus.aarch64.xz softbus 7.查看加载的镜像ID @@ -1120,7 +1120,7 @@ hichain的客户端API头文件在嵌入式版本提供的sdk中对外开放, 容器中启动并测试软总线 ---------------------- -以下操作均在宿主机执行 +以下操作均在容器中执行 1.在容器中写SN号,注意此SN号是本设备标识,需要与其他设备不一致,建议使用本机IP diff --git a/docs/source/features/preempt_rt.rst b/docs/source/features/preempt_rt.rst index 956e17ef4b8c37b9f6309ad8553fd2e5799a0ade..92531ad2acb45c5e0e750d1361bf3b4d45dedc7c 100644 --- a/docs/source/features/preempt_rt.rst +++ b/docs/source/features/preempt_rt.rst @@ -246,3 +246,5 @@ ____ menuentry 'boot'{ linux /bzImage root=PARTUUID=eaecae14-7021-4551-9183-29b0d210222f rw quiet } + + 如果没有``/run/media/sda1/efi/boot/grub.cfg``可以使用``fdisk -l``查看磁盘情况,使用``mount``自行挂载。 diff --git a/docs/source/getting_started/index.rst b/docs/source/getting_started/index.rst index 16e067b5e2b42c23b9d015c5795667be3bca11c3..d42e2f43479650fe24a76e6c325b49dfd8b24ae0 100644 --- a/docs/source/getting_started/index.rst +++ b/docs/source/getting_started/index.rst @@ -184,15 +184,15 @@ openEuler Embedded提供了SDK自解压安装包,包含了应用程序开发 .. tab:: openEuler - $ sudo yum install make gcc g++ flex bison gmp-devel libmpc-devel openssl-devel + $ sudo yum install make gcc g++ flex bison gmp-devel libmpc-devel openssl-devel elfutils-libelf-devel .. tab:: Ubuntu - $ sudo apt-get install make gcc g++ flex bison libgmp3-dev libmpc-dev libssl-dev + $ sudo apt-get install make gcc g++ flex bison libgmp3-dev libmpc-dev libssl-dev libelf-dev .. tab:: SUSELeap15.4 - $ sudo zypper in gcc gcc-c++ make bison gmp-devel libmpc3 openssl cmake flex + $ sudo zypper in gcc gcc-c++ make bison gmp-devel libmpc3 openssl cmake flex libelf-devel - **执行SDK自解压安装脚本** diff --git a/docs/source/index.rst b/docs/source/index.rst index 526209dfcb4fa2ce6dd6461a2fe62e690b5b0dbb..de640805c1e1cf2215e2efa40803f46f8e92ebc4 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -32,11 +32,9 @@ openEuler Embedded在内核版本、软件包版本等代码层面会与openEule .. toctree:: :maxdepth: 1 - :caption: oebuild指导 + :caption: oebuild 指导 - oebuild/install/index.rst - oebuild/command/index.rst - oebuild/directory/index.rst - oebuild/configure/index.rst + oebuild/intro.rst + oebuild/userguide/index.rst oebuild/develop/index.rst oebuild/release/index.rst diff --git a/docs/source/oebuild/develop/index.rst b/docs/source/oebuild/develop/index.rst index c94130d27e3831d043beab59b7319faccca985c6..3af118e3c32724fc519ed0002c28342591531f1c 100644 --- a/docs/source/oebuild/develop/index.rst +++ b/docs/source/oebuild/develop/index.rst @@ -1,7 +1,7 @@ .. _develop_index: -开发者介绍 -######################## +开发者指南 +########## 该章节用于介绍开发者如何在oebuild上进行开发命令插件。整个oebuild的设计模式采用了对象创建型模式,主体框架已经开发完毕,因此开发者仅需要实现命令插件即可。 diff --git a/docs/source/oebuild/directory/index.rst b/docs/source/oebuild/directory/index.rst deleted file mode 100644 index 2468e9fe5665847ce18e6e449c35d2eec2337e84..0000000000000000000000000000000000000000 --- a/docs/source/oebuild/directory/index.rst +++ /dev/null @@ -1,53 +0,0 @@ -.. _directory_index: - -目录介绍 -######################## - -该章节将介绍oebuild的工作目录结构,以及每个目录的作用。oebuild工作目录的结构如下: - -:: - - .oebuild - config.yaml - compile.yaml.sample - build - aarch-std - compile.yaml - .env - src - - -.oebuild --------- - -oebuild全局配置文件存放目录,该目录是隐藏目录。 - -config.yaml ->>>>>>>>>>> - -oebuild全局配置文件,该文件中记录着构建openEuler Embedded的一些准备数据,在执行update、generate,以及bitbake命令时,都会解析该文件。 - -compile.yaml.sample ->>>>>>>>>>>>>>>>>>> - -构建配置范例文件,在oebuild对构建配置文件的处理中,可以通过generate命令输入各种参数来生成compile.yaml,也可以通过-c命令直接指定compile.yaml,而compile.yaml.sample是compile.yaml的全参数的范例文件,里面有对所有涉及到的参数的详细说明,由于对compile.yaml的定制命令行参数较多,并不直观,而对配置文件直接进行文本编辑会直观很多,对于该范例文件的使用方法比较简单,直接将该文件拷贝到某个地方,然后重命名为compile.yaml,通过编辑器打开compile.yaml,对该文件做定制化修改,然后直接在generate命令下用-c参数指定即可。关于该文件的详细介绍请参考 :ref:`compile.yaml.sample`。 - -build ------ - -构建统一存放目录,在oebuild的工作目录下,对于镜像构建目录会做统一的管理,而build目录就是用来存放所有创建的构建目录。 - -aarch-std/compile.yaml ->>>>>>>>>>>>>>>>>>>>>> - -构建配置文件,每个新创建的构建目录下都会存在一个构建配置文件,其被命名为compile.yaml,而这个文件也是判断该目录是否是构建目录的一个标准。 - -aarch-std/.env ->>>>>>>>>>>>>> - -构建目录运行环境文件,在oebuild对openEuler Embedded进行构建时会将当下启动的一些环境参数写入到.env中,该文件对构建环境的重复利用起着至关重要的作用。 - -src ---- - -源码存放目录,该目录下存放着openEuler Embedded构建下载的所有源码,源码目录的命名以openEuler Embedded的包名为准,例如软件包名为libzip,在openEuler Embedded中该包名称为zip,那么源码包目录名为zip。 diff --git a/docs/source/oebuild/install/index.rst b/docs/source/oebuild/install/index.rst deleted file mode 100644 index a35936ebb9852ee49c82d7f7393775a68f9b559f..0000000000000000000000000000000000000000 --- a/docs/source/oebuild/install/index.rst +++ /dev/null @@ -1,84 +0,0 @@ -.. _oebuild_install: - -安装介绍 -######################## - -该文档讲解如何安装并使能oebuild,该版本匹配oebuild版本为v0.0.30。 - -如何安装 -======== - -oebuild是用python语言编写,并且适配的python版本为python3。目前oebuild已经在PyPi平台发布,因此可以通过pip3命令进行安装或升级oebuild。由于openEuler Embedded的构建目前仅适配常用的x86架构,因此对于其他架构的底层硬件并不适用,同时对于x86架构的上层系统,仅支持Linux和macOS。 - -On Linux: - -.. code-block:: console - - pip3 install --user -U oebuild - -On macOS: - -.. code-block:: console - - pip3 install -U oebuild - -在安装oebuild后,就可以使用oebuild来下载openEuler Embedded相关源码了。 - -.. note:: 目前oebuild支持的最低的python3版本为python3.8。 - - -环境依赖安装 -============ - -oebuild的构建有两种方式,分别是主机端构建和容器端构建。 - -**何为主机端构建**: - -主机端构建即为直接使用主机环境进行构建,构建所需要的编译链和构建依赖工具需要在主机端进行初始化并加入到环境变量中。在构建过程中,可以直接使用主机端初始化的编译链和构建依赖工具,使用主机端构建有可能会破坏本地默认的环境配置,因此不建议使用。 - -**何为容器端构建**: - -容器端构建即为使用容器进行构建,构建所需要的编译链和构建依赖工具已经被提前内置到特定的容器中,在oebuild启动容器后会自动完成环境变量的初始化动作,然后进入构建目录,可以直接执行yocto的构建。 - -**如何安装docker依赖**: - -docker容器对Linux内核新功能的要求比较高,所以使用Ubuntu作为docker容器的宿主机更加友好一点。而且很多项目docker在配置的时候也仅仅支持了针对Ubuntu的dockerfile配置,所以容器化方面Ubuntu比较有优势。因此这里建议使用Ubuntu作为开发平台。 - -Ubuntu安装docker命令如下: - -.. code-block:: console - - sudo apt install docker.io - -在安装好docker后,由于oebuild在调用docker时会以当前用户来进行调用,因此需要将当前用户添加docker执行权限。按如下方法完成给当前用户添加docker执行权限: - -1. 添加docker用户组 - -.. code-block:: console - - sudo groupadd docker - -2. 将当前用户添加到docker用户组 - -.. code-block:: console - - sudo usermod -a -G docker - -3. 重新启动docker服务 - -.. code-block:: console - - sudo systemctl daemon-reload - - sudo systemctl restart docker - -4. 向docker套接字添加读写权限 - -.. code-block:: console - - sudo chmod o+rw /var/run/docker.sock - -.. note:: - - docker由client和server组成,docker的任何终端命令输入,实际上是通过客户端将请求发送到docker的守护进程 `docker daemon` 服务上,由 `docker daemon` 返回信息,客户端收到信息后展示在控制台上。 - 而 `/var/run/docker.sock` 是 `docker daemon` 监听的套接字socket(ip+port),容器中的进程可以通过它与 `docker daemon` 通信,对于docker的交互,可以使用官方给出的二进制cli,即docker,也可以使用实现了 `docker apis` 的client,例如python-docker,在这里由于oebuild对于docker的处理需要用到对 `/var/run/docker.sock` 的操作,因此需要对该套接字添加执行权限。 diff --git a/docs/source/oebuild/intro.rst b/docs/source/oebuild/intro.rst new file mode 100644 index 0000000000000000000000000000000000000000..896b3dd42832879d8811886208923dea6dd72942 --- /dev/null +++ b/docs/source/oebuild/intro.rst @@ -0,0 +1,15 @@ +.. _oebuild: + +简介 +#### + +`oebuild `__ 是一个用于构建和配置 openEuler Embedded 的工具, +能够为用户简化 openEuler Embedded 的构建流程,自动化生成定制化的 openEuler Embedded 发行版。 + +oebuild 的主要功能包括: + +* 自动化下载不同版本的构建依赖,包括 `yocto-meta-openeuler `_ , + `yocto-poky `_ , `yocto-meta-openembedded `_ 等。 +* 根据用户的构建选项(机器类型,功能特性等等),创建出定制化的镜像配置文件。 +* 使用容器创建一个隔离的构建环境,降低主机污染风险,简化构建系统的配置和依赖管理。 +* 启动 openEuler Embedded 镜像构建。 diff --git a/docs/source/oebuild/userguide/build/index.rst b/docs/source/oebuild/userguide/build/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..80e0521d5a13dc5455d3f6714c68feff63bfcac7 --- /dev/null +++ b/docs/source/oebuild/userguide/build/index.rst @@ -0,0 +1,166 @@ +.. _oebuild_usage: + +使用指导 +######## + +本章节内容会介绍 oebuild 的具体使用方法,可根据下述步骤,了解 oebuild 的相关命令并掌握如何构建定制化的 openEuler Embedded 镜像。 + +.. note:: + + 在开始构建前,请确保构建主机满足以下条件: + + - 至少有 **50G** 以上的空闲磁盘空间,建议预留尽可能多的空间,有助于运行多个镜像构建,通过重复构建提升效率。 + - 至少有 **8G** 内存,建议使用内存、CPU数量更多的机器,增加构建速度。 + +____ + +第 1 步: 初始化工作目录 +************************ + +oebuild 的工作目录与 openEuler Embedded 版本是相关联的,构建不同版本的 openEuler Embedded,需要创建相对应的工作目录。 +因此,推荐以openEuler Embedded版本号命名工作目录,例如 `workdir_master`。当前,可以通过执行以下命令,创建工作目录: + +* ``oebuild init [-u URL] [-b BRANCH] [DIRECTORY]`` + + * ``-u ``:yocot-meta-openeuler 仓库地址,默认为 `yocto-meta-openeuler `_。 + * ``-b ``:yocot-meta-openeuler 版本分支,默认为 `master `_。 + 如需构建其它版本,请按照 :ref:`oebuild 版本信息 ` **下载对应版本的oebuild,并指定对应分支**。例如:`-b openEuler-22.03-LTS-SP2`。 + * ````:需要创建的工作目录,注意,不能指定当前目录中已有的目录,否则会报错:`mkdir failed`。 + + .. code-block:: console + + # 例如: + # 初始化 master 版本的工作目录 + $ oebuild init workdir_master + + # 初始化 openEuler-22.03-LTS-SP2 版本的工作目录 + $ oebuild init -b openEuler-22.03-LTS-SP2 workdir_2203-sp2 + +成功创建工作目录后,**切换到工作目录** 执行以下命令,下载目标版本的项目源码及构建容器: + +* ``oebuild update`` + +下载完成后,工作目录如下: + + .. code-block:: console + + $ tree -L 1 workdir_master/ + workdir_master/ + ├── oebuild.log + └── src + + | ``oebuild.log``:oebuild 的操作日志。 + | ``src``:目标版本依赖的软件包源码目录,包括 yocto-meta-openeuler、yocto-poky等。后续构建所依赖的软件包也会自动下载到该目录,包括 kernel、busybox、systemd等等。 + +____ + +第 2 步: 创建定制化的构建配置文件 +********************************* + +当前,openEuler Embedded 支持多种南向架构,包括 ARM/ARM64、X86_64、RISCV。在此基础上,oebuild 抽象封装了 openEuler Embedded 的大颗粒特性, +包括:混合部署(MICA)、图形、ROS、初始化服务(busybox or systemd)。用户可以通过 oebuild 自由组合所需特性,定制化 openEuler Embedded 版本。 + +**在 oebuild 工作目录下**,执行以下命令,创建定制化的构建配置文件: + +* ``oebuild generate -p PLATFORM [-f FEATURES] [-d DIRECTORY]`` + + * ``-p ``:选择需要构建的目标机器类型。 + * ``-f ``:选择需要打开的特性,可多次指定 -f 打开多个特性。 + * ``-d ``:构建目录,用于存放构建产物,同一构建目录支持多次重复构建。 + + .. code-block:: console + + # 例如: + # 创建支持混合部署和systemd的 qemu-aarch64 镜像构建配置文件,构建目录为 build_arm64-mcs-systemd: + $ oebuild generate -p qemu-aarch64 -f openeuler-mcs -f systemd -d build_arm64-mcs-systemd + + # 创建支持软实时和systemd的 x86-64 镜像构建配置文件,构建目录为 build_x86-rt-systemd: + $ oebuild generate -p x86-64 -f openeuler-rt -f systemd -d build_x86-rt-systemd + + .. note:: + + 可以通过执行 ``oebuild generate -l`` 查看支持的南向列表和特性列表。南向支持的帮助文档请参阅 :ref:`南向支持章节 `。 + 特性文档请参阅 :ref:`关键特性章节 `。 + +执行成功后,会在 oebuild 的工作目录下创建出 ``build`` 目录,该目录包含多个用户定制的镜像构建目录,如: + + .. code-block:: console + + $ tree build/ + build/ + ├── build_arm64-mcs-systemd + │   └── compile.yaml + └── build_x86-rt-systemd + └── compile.yaml + +不同目录下的 ``compile.yaml`` 为对应的构建配置文件。 + +.. note:: + + - | 在具体的镜像构建目录 ```` 下,可以重复触发构建,包括单个软件包的构建和镜像构建。 + + - 针对单个构建目录 ````,支持重复使用 ``oebuild generate -d `` 创建新的配置文件,以复用构建缓存加速构建,但需要注意: + + - | 一个目录对应一个 ``PLATFORM``,即上一次使用 ``-p x86-64 -d build_dir`` 创建出来的构建目录 build_dir,重新使用 ``-p qemu-aarch64 -d build_dir``,也无法复用上一次的构建缓存。 + + - | 新增特性后,需要删除构建目录 ```` 下的 ``conf`` 文件夹再进行构建。因为当 conf 存在时,不会再根据 oebuild 创建的 compile.yaml 重新生成 conf,新增特性无法生效。 + | 例如,上一次使用 ``-f systemd -d build_dir`` 在 build_dir 下创建了配置文件并完成了构建,希望重新使用 ``-f busybox -d build_dir`` 变更特性,需要同步删除 build_dir 下的 conf 文件夹,才能构建 busybox 镜像。 + +____ + +第 3 步: 构建 openEuler Embedded +******************************** + +**在** ``compile.yaml`` **的同级目录** (即第二步创建出来的构建目录)下,执行以下命令,开始构建: + +.. code-block:: console + + # 进入构建容器 + $ oebuild bitbake + + 8<-------- 进入容器环境 -------- + + # 构建 openEuler Embedded 镜像 + $ bitbake openeuler-image + + $ 构建 openEuler Embedded 的 SDK + $ bitbake openeuler-image -c do_populate_sdk + + # 构建完成后,退出容器环境 + $ exit + + 8<-------- 返回构建主机 -------- + + # 在 output 目录中可以找到构建镜像 + $ cd output/<构建时间戳> + +.. seealso:: + + 进入容器后,bitbake 的使用方法与 yocto 保持一致,一些常用命令如下: + + - ``bitbake -c cleansstate``:清理 的构建缓存,一般在重新构建 之前执行,以防止缓存影响新增的修改。 + + - ``bitbake -e > env.log``:输出关于 相关的构建环境变量到 env.log 中,一般用于帮助开发人员编写 的构建配方。 + + - ``bitbake -g``:输出 相关的构建依赖分析 pn-buildlist、task-depends.dot。 + + 关于 bitbake 命令更详细丰富的用法,请参考 `yocto bitbake manual `_。 + +____ + +进一步了解 +********** + +经过上述步骤,您已了解如何使用 oebuild 创建定制化的 openEuler Embedded 镜像配置,以及如何构建 openEuler Embedded 版本。推荐您继续阅读以下章节内容: + +- | :ref:`如何使用 openEuler Embedded SDK 进行开发 `: + | 了解 openEuler Embedded SDK 的使用方法,如何用 SDK 快速构建内核模块和用户态程序。 + +- | :ref:`openEuler Embedded 南向支持 `: + | 了解 openEuler Embedded 如何在不同的硬件平台上部署。 + +- | :ref:`openEuler Embedded 关键特性 `: + | 了解openEuler Embedded 正在进行的一些技术探索,参与社区的大颗粒特性。 + +- | :ref:`oebuild 命令手册 `: + | 了解 oebuild 的其它功能,包括如何使用自定义的软件包版本基线(manifest)、自定义的构建工具链构建 openEuler Embedded。 diff --git a/docs/source/oebuild/command/bitbake.rst b/docs/source/oebuild/userguide/command/bitbake.rst similarity index 100% rename from docs/source/oebuild/command/bitbake.rst rename to docs/source/oebuild/userguide/command/bitbake.rst diff --git a/docs/source/oebuild/command/clear.rst b/docs/source/oebuild/userguide/command/clear.rst similarity index 100% rename from docs/source/oebuild/command/clear.rst rename to docs/source/oebuild/userguide/command/clear.rst diff --git a/docs/source/oebuild/command/generate.rst b/docs/source/oebuild/userguide/command/generate.rst similarity index 100% rename from docs/source/oebuild/command/generate.rst rename to docs/source/oebuild/userguide/command/generate.rst diff --git a/docs/source/oebuild/command/index.rst b/docs/source/oebuild/userguide/command/index.rst similarity index 80% rename from docs/source/oebuild/command/index.rst rename to docs/source/oebuild/userguide/command/index.rst index 304694c73ccad2581b31cc6aa91c745798d3f7f4..9f9b66b8d26dd1f5155aad0ccafc8cd5935420a7 100644 --- a/docs/source/oebuild/command/index.rst +++ b/docs/source/oebuild/userguide/command/index.rst @@ -1,7 +1,7 @@ -.. _command_index: +.. _oebuild_command: -oebuild命令介绍 -######################## +oebuild 命令手册 +################ 该文档讲解oebuild所有相关的命令以及各命令详细的使用方法。 diff --git a/docs/source/oebuild/command/init.rst b/docs/source/oebuild/userguide/command/init.rst similarity index 100% rename from docs/source/oebuild/command/init.rst rename to docs/source/oebuild/userguide/command/init.rst diff --git a/docs/source/oebuild/command/manifest.rst b/docs/source/oebuild/userguide/command/manifest.rst similarity index 100% rename from docs/source/oebuild/command/manifest.rst rename to docs/source/oebuild/userguide/command/manifest.rst diff --git a/docs/source/oebuild/command/update.rst b/docs/source/oebuild/userguide/command/update.rst similarity index 98% rename from docs/source/oebuild/command/update.rst rename to docs/source/oebuild/userguide/command/update.rst index 710219d4c8f06f0d1c15cdfbf201d530e96328bd..760573766bd46605cab1842ca3fcfd6580471f6b 100644 --- a/docs/source/oebuild/command/update.rst +++ b/docs/source/oebuild/userguide/command/update.rst @@ -5,7 +5,7 @@ 该命令用于对oebuild的构建环境做初始化准备工作,主要是对必要的启动代码和执行容器做更新操作。openEuler Embedded的构建框架采用的是yocto构建框架,yocto构建的一个特点就是分层模型,这也意味着对于特性组件可进行插拔式选用,openEuler Embedded的代码主要分为三层,如下图所示: -.. image:: ../../_static/images/command/update_yocto_layer.png +.. image:: ../../../_static/images/command/update_yocto_layer.png 最上层是主构建层,即为openEuler Embedded的源码,决定着openEuler Embedded的特性配置,第二层为构建特性相关的layer层,这里需要额外说明的是poky,poky在yocto中是主干,yocto的构建离不开poky,其他层是特性层,例如添加图形特性,那么就需要添加图形层,想要添加ros特性,那么就需要添加ros层等。第三层是openEuler Embedded依赖的包列表,主构建仓决定着依赖的其他层的版本,也决定着依赖的软件包。 diff --git a/docs/source/oebuild/configure/index.rst b/docs/source/oebuild/userguide/configure/index.rst similarity index 99% rename from docs/source/oebuild/configure/index.rst rename to docs/source/oebuild/userguide/configure/index.rst index 259d65cfbaa8be4e5071c8269c7582cf2e1d0306..b143ea3dc18dca7382e763e07e1d42c187fd9353 100644 --- a/docs/source/oebuild/configure/index.rst +++ b/docs/source/oebuild/userguide/configure/index.rst @@ -1,7 +1,7 @@ .. _configure_index: -配置文件介绍 -######################## +oebuild 配置文件 +################ 这一章节将会对openEuler Embedded所有涉及到的配置文件进行详细的讲解说明,这些说明包括每个参数的意义,以及该参数的影响范围。 diff --git a/docs/source/oebuild/userguide/index.rst b/docs/source/oebuild/userguide/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..2f5d8a322c2a64fc972316aa8c18453ff67ee0a5 --- /dev/null +++ b/docs/source/oebuild/userguide/index.rst @@ -0,0 +1,15 @@ +.. _oebuild_userguide: + +用户指南 +######## + +本章将详细介绍 oebuild 的使用方法以及各项功能,并提供逐步指导和示例,帮助用户基于 oebuild 快速构建定制化的 openEuler Embedded 发行版。 + +.. toctree:: + :maxdepth: 1 + + install/index.rst + build/index.rst + oebuild_workdir/index.rst + configure/index.rst + command/index.rst diff --git a/docs/source/oebuild/userguide/install/index.rst b/docs/source/oebuild/userguide/install/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..239d9b966955eed72be557924be07b35173a2242 --- /dev/null +++ b/docs/source/oebuild/userguide/install/index.rst @@ -0,0 +1,82 @@ +.. _oebuild_install: + +安装步骤 +######## + +.. note:: + + - oebuild 基于 python 实现,支持最低的 python3 版本为 **python3.8**。 + + - 当前 **仅支持在64位的x86环境** 下使用 oebuild,并且需要在 **普通用户** 下进行 oebuild 的安装运行。 + +**1. 安装并配置依赖** + + .. tabs:: + + .. code-tab:: console openEuler + + # 安装必要的软件包 + $ sudo yum install python3 python3-pip docker + + # 配置docker环境 + $ sudo usermod -a -G docker $(whoami) + $ sudo systemctl daemon-reload && sudo systemctl restart docker + $ sudo chmod o+rw /var/run/docker.sock + + .. code-tab:: console Ubuntu + + # 安装必要的软件包 + $ sudo apt-get install python3 python3-pip docker docker.io + + # 配置docker环境 + $ sudo usermod -a -G docker $(whoami) + $ sudo systemctl daemon-reload && sudo systemctl restart docker + $ sudo chmod o+rw /var/run/docker.sock + + .. code-tab:: console SUSELeap15.4 + + # 安装必要的软件包 + $ sudo zypper install python311 python311-pip docker + + # 配置docker环境 + $ sudo usermod -a -G docker $(whoami) + $ sudo systemctl restart docker + $ sudo chmod o+rw /var/run/docker.sock + $ sudo systemctl enable docker + + # 配置最新版python + $ cd /usr/bin + $ sudo rm python python3 + $ sudo ln -s python3.11 python + $ sudo ln -s python3.11 python3 + +**2. 安装对应版本的oebuild** + + 针对不同的 openEuler Embedded 版本,需要安装对应版本的 oebuild。 + openEuler Embedded 的版本与 `yocto-meta-openeuler `_ 仓库的分支是一一对应的,相关联的 oebuild 版本信息如下: + + .. _oebuild_version: + + .. list-table:: + :widths: 40 35 + :header-rows: 1 + + * - openEuler Embedded 版本 + - oebuild 版本 + * - master + - latest + * - openEuler-23.09 + - 0.0.30 + * - openEuler-22.03-LTS-SP2 + - 0.0.27 + + 执行以下命令安装 oebuild: + + .. code-block:: console + + # 对于 master 分支,安装最新版本的 oebuild: + $ pip3 install --upgrade oebuild + + # 对于其它分支,安装 版本的 oebuild: + $ pip3 install oebuild== + diff --git a/docs/source/oebuild/userguide/oebuild_workdir/index.rst b/docs/source/oebuild/userguide/oebuild_workdir/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..721769bb5ae7cd99fd5ac94d81de4050f89854e1 --- /dev/null +++ b/docs/source/oebuild/userguide/oebuild_workdir/index.rst @@ -0,0 +1,55 @@ +.. _directory_index: + +oebuild 工作目录介绍 +#################### + +该章节将介绍oebuild的工作目录结构,以及每个目录的作用。oebuild工作目录的结构如下: + +:: + + . + ├── .oebuild + │   ├── compile.yaml.sample + │   └── config + │ + ├── build + │   └── build_arm64 + │   ├── compile.yaml + │   └── .env + │ + └── src + ├── yocto-meta-openembedded + ├── yocto-meta-openeuler + ├── yocto-poky + └── ...... + +.oebuild +-------- + +oebuild全局配置文件存放目录,该目录是隐藏目录。 + + **compile.yaml.sample** + + 构建配置范例文件,在oebuild对构建配置文件的处理中,可以通过generate命令输入各种参数来生成compile.yaml,也可以通过-c命令直接指定compile.yaml,而compile.yaml.sample是compile.yaml的全参数的范例文件,里面有对所有涉及到的参数的详细说明,由于对compile.yaml的定制命令行参数较多,并不直观,而对配置文件直接进行文本编辑会直观很多,对于该范例文件的使用方法比较简单,直接将该文件拷贝到某个地方,然后重命名为compile.yaml,通过编辑器打开compile.yaml,对该文件做定制化修改,然后直接在generate命令下用-c参数指定即可。关于该文件的详细介绍请参考 :ref:`compile.yaml.sample`。 + + **config** + + oebuild全局配置文件,该文件中记录着构建openEuler Embedded的一些准备数据,在执行update、generate,以及bitbake命令时,都会解析该文件。 + +build +----- + +构建统一存放目录,在oebuild的工作目录下,对于镜像构建目录会做统一的管理,而build目录就是用来存放所有创建的构建目录。 + + **build_arm64/compile.yaml** + + 构建配置文件,每个新创建的构建目录下都会存在一个构建配置文件,其被命名为compile.yaml,而这个文件也是判断该目录是否是构建目录的一个标准。 + + **build_arm64/.env** + + 构建目录运行环境文件,在oebuild对openEuler Embedded进行构建时会将当下启动的一些环境参数写入到.env中,该文件对构建环境的重复利用起着至关重要的作用。 + +src +--- + +源码存放目录,该目录下存放着openEuler Embedded构建下载的所有源码,源码目录的命名以openEuler Embedded的包名为准,例如软件包名为libzip,在openEuler Embedded中该包名称为zip,那么源码包目录名为zip。 diff --git a/meta-openeuler/classes/openeuler.bbclass b/meta-openeuler/classes/openeuler.bbclass index 5ef65ae435b3472dac1726f4f65d7e520e4b5f2f..2dca6721e1c853f986f589f4c149dcd9ccb66d9b 100644 --- a/meta-openeuler/classes/openeuler.bbclass +++ b/meta-openeuler/classes/openeuler.bbclass @@ -110,28 +110,15 @@ python do_openeuler_fetchs() { # Stage the variables related to the original package repoName = d.getVar("OPENEULER_REPO_NAME") localName = d.getVar("OPENEULER_LOCAL_NAME") - gitUrl = d.getVar("OPENEULER_GIT_URL") - branch = d.getVar("OPENEULER_BRANCH") repoList = d.getVar("PKG_REPO_LIST") - for item in repoList: - d.setVar("OPENEULER_REPO_NAME", item["repo_name"]) - if "git_url" in item: - d.setVar("OPENEULER_GIT_URL", item["git_url"]) - if "branch" in item: - d.setVar("OPENEULER_BRANCH", item["branch"]) - if "local" in item: - d.setVar("OPENEULER_LOCAL_NAME", item["local"]) - else: - d.setVar("OPENEULER_LOCAL_NAME", item["repo_name"]) - + for item_name in repoList: + d.setVar("OPENEULER_REPO_NAME", item_name) bb.build.exec_func("do_openeuler_fetch", d) # Restore the variables related to the original package d.setVar("OPENEULER_REPO_NAME", repoName) d.setVar("OPENEULER_LOCAL_NAME", localName) - d.setVar("OPENEULER_GIT_URL", gitUrl) - d.setVar("OPENEULER_BRANCH", branch) } # fetch software package from openeuler's repos first, @@ -147,8 +134,6 @@ python do_openeuler_fetch() { srcDir = d.getVar('OPENEULER_SP_DIR') repoName = d.getVar('OPENEULER_REPO_NAME') localName = d.getVar('OPENEULER_LOCAL_NAME') if d.getVar('OPENEULER_LOCAL_NAME') else repoName - gitUrl = d.getVar('OPENEULER_GIT_URL') - repoBranch = d.getVar('OPENEULER_BRANCH') urls = d.getVar("SRC_URI").split() @@ -158,7 +143,6 @@ python do_openeuler_fetch() { return repo_dir = os.path.join(srcDir, localName) - repo_url = os.path.join(gitUrl, repoName) except_str = None try: @@ -185,10 +169,7 @@ python do_openeuler_fetch() { except Exception as e: bb.plain("===============") bb.plain("OPENEULER_SP_DIR: {}".format(srcDir)) - bb.plain("OPENEULER_REPO_NAME: {}".format(repoName)) bb.plain("OPENEULER_LOCAL_NAME: {}".format(localName)) - bb.plain("OPENEULER_GIT_URL: {}".format(gitUrl)) - bb.plain("OPENEULER_BRANCH: {}".format(repoBranch)) bb.plain("===============") except_str = str(e) @@ -200,6 +181,7 @@ def init_repo_dir(repo_dir): import git repo = git.Repo.init(repo_dir) + with repo.config_writer() as wr: wr.set_value('http', 'sslverify', 'false').release() return repo @@ -222,8 +204,13 @@ def download_repo(repo_dir, repo_url ,version = None): if remote is None: remote_name = "upstream" remote = git.Remote.add(repo = repo, name = remote_name, url = repo_url) - - remote.fetch(version, depth=1) + + try: + repo.commit(version) + except: + bb.debug(1, 'commit does not exist, shallow fetch: ' + version) + remote.fetch(version, depth=1) + # if repo is modified, restore it if repo.is_dirty(): repo.git.checkout(".") diff --git a/meta-openeuler/recipes-core/dsoftbus/dsoftbus_1.0.bb b/meta-openeuler/recipes-core/dsoftbus/dsoftbus_1.0.bb index 0495fb9b09e865482af4b8e13cbc289d3dc86827..e03e6196994fbe7273ee240cd6efa5bc0559c6ef 100644 --- a/meta-openeuler/recipes-core/dsoftbus/dsoftbus_1.0.bb +++ b/meta-openeuler/recipes-core/dsoftbus/dsoftbus_1.0.bb @@ -68,23 +68,12 @@ INSANE_SKIP:${PN} += "already-stripped" ALLOW_EMPTY:${PN} = "1" python do_fetch:prepend() { - repoList = [{ - "repo_name": "yocto-embedded-tools", - "git_url": "https://gitee.com/openeuler", - "branch": "master" - },{ - "repo_name": "dsoftbus_standard", - "git_url": "https://gitee.com/openeuler", - "branch": "dev" - },{ - "repo_name": "embedded-ipc", - "git_url": "https://gitee.com/openeuler", - "branch": "master" - },{ - "repo_name": "dsoftbus", - "git_url": "https://gitee.com/src-openeuler", - "branch": "master" - }] + repoList = [ + "yocto-embedded-tools", + "dsoftbus_standard", + "embedded-ipc", + "dsoftbus" + ] d.setVar("PKG_REPO_LIST", repoList) diff --git a/meta-openeuler/recipes-core/isulad/lib-shim-v2-bin_0.0.1.bb b/meta-openeuler/recipes-core/isulad/lib-shim-v2-bin_0.0.1.bb index 045c1fd22bf9b0091d88c7035b4e5496dda014c3..d830bfb33dfdaa3208561d607e83fa0701007970 100644 --- a/meta-openeuler/recipes-core/isulad/lib-shim-v2-bin_0.0.1.bb +++ b/meta-openeuler/recipes-core/isulad/lib-shim-v2-bin_0.0.1.bb @@ -14,9 +14,9 @@ SRC_URI[x86.md5sum] = "fb1cdaba15faae97c94f9595b09ff945" SRC_URI[header.md5sum] = "97c8e9fff736e0f96c36dac0e5426aa2" SRC_URI = " \ - http://repo.openeuler.org/openEuler-22.03-LTS-SP2/OS/aarch64/Packages/lib-shim-v2-0.0.1-6.oe2203sp2.aarch64.rpm;name=arm64 \ - http://repo.openeuler.org/openEuler-22.03-LTS-SP2/OS/x86_64/Packages/lib-shim-v2-0.0.1-6.oe2203sp2.x86_64.rpm;name=x86 \ - http://repo.openeuler.org/openEuler-22.03-LTS-SP2/everything/aarch64/Packages/lib-shim-v2-devel-0.0.1-6.oe2203sp2.aarch64.rpm;name=header \ + http://repo.openeuler.openatom.cn/openEuler-22.03-LTS-SP2/OS/aarch64/Packages/lib-shim-v2-0.0.1-6.oe2203sp2.aarch64.rpm;name=arm64 \ + http://repo.openeuler.openatom.cn/openEuler-22.03-LTS-SP2/OS/x86_64/Packages/lib-shim-v2-0.0.1-6.oe2203sp2.x86_64.rpm;name=x86 \ + http://repo.openeuler.openatom.cn/openEuler-22.03-LTS-SP2/everything/aarch64/Packages/lib-shim-v2-devel-0.0.1-6.oe2203sp2.aarch64.rpm;name=header \ " S = "${WORKDIR}/repack" @@ -54,4 +54,3 @@ FILES:${PN}-dev = " \ " INSANE_SKIP:${PN} += "already-stripped" - diff --git a/meta-openeuler/recipes-devtools/dnf/files/aarch64/openEuler.repo b/meta-openeuler/recipes-devtools/dnf/files/aarch64/openEuler.repo index 41b2e4784a35f38cae0efe220b1e5bfbf075c157..391f0efd25a1fc4f6444507b4b213a332099da11 100644 --- a/meta-openeuler/recipes-devtools/dnf/files/aarch64/openEuler.repo +++ b/meta-openeuler/recipes-devtools/dnf/files/aarch64/openEuler.repo @@ -9,42 +9,42 @@ [OS] name=OS -baseurl=http://repo.openeuler.org/OPENEULER_VER/OS/$basearch/ +baseurl=http://repo.openeuler.openatom.cn/OPENEULER_VER/OS/$basearch/ enabled=1 gpgcheck=1 -gpgkey=http://repo.openeuler.org/OPENEULER_VER/OS/$basearch/RPM-GPG-KEY-openEuler +gpgkey=http://repo.openeuler.openatom.cn/OPENEULER_VER/OS/$basearch/RPM-GPG-KEY-openEuler [everything] name=everything -baseurl=http://repo.openeuler.org/OPENEULER_VER/everything/$basearch/ +baseurl=http://repo.openeuler.openatom.cn/OPENEULER_VER/everything/$basearch/ enabled=1 gpgcheck=1 -gpgkey=http://repo.openeuler.org/OPENEULER_VER/everything/$basearch/RPM-GPG-KEY-openEuler +gpgkey=http://repo.openeuler.openatom.cn/OPENEULER_VER/everything/$basearch/RPM-GPG-KEY-openEuler [EPOL] name=EPOL -baseurl=http://repo.openeuler.org/OPENEULER_VER/EPOL/main/$basearch/ +baseurl=http://repo.openeuler.openatom.cn/OPENEULER_VER/EPOL/main/$basearch/ enabled=1 gpgcheck=1 -gpgkey=http://repo.openeuler.org/OPENEULER_VER/OS/$basearch/RPM-GPG-KEY-openEuler +gpgkey=http://repo.openeuler.openatom.cn/OPENEULER_VER/OS/$basearch/RPM-GPG-KEY-openEuler [debuginfo] name=debuginfo -baseurl=http://repo.openeuler.org/OPENEULER_VER/debuginfo/$basearch/ +baseurl=http://repo.openeuler.openatom.cn/OPENEULER_VER/debuginfo/$basearch/ enabled=1 gpgcheck=1 -gpgkey=http://repo.openeuler.org/OPENEULER_VER/debuginfo/$basearch/RPM-GPG-KEY-openEuler +gpgkey=http://repo.openeuler.openatom.cn/OPENEULER_VER/debuginfo/$basearch/RPM-GPG-KEY-openEuler [source] name=source -baseurl=http://repo.openeuler.org/OPENEULER_VER/source/ +baseurl=http://repo.openeuler.openatom.cn/OPENEULER_VER/source/ enabled=1 gpgcheck=1 -gpgkey=http://repo.openeuler.org/OPENEULER_VER/source/RPM-GPG-KEY-openEuler +gpgkey=http://repo.openeuler.openatom.cn/OPENEULER_VER/source/RPM-GPG-KEY-openEuler [update] name=update -baseurl=http://repo.openeuler.org/OPENEULER_VER/update/$basearch/ +baseurl=http://repo.openeuler.openatom.cn/OPENEULER_VER/update/$basearch/ enabled=1 gpgcheck=1 -gpgkey=http://repo.openeuler.org/OPENEULER_VER/OS/$basearch/RPM-GPG-KEY-openEuler +gpgkey=http://repo.openeuler.openatom.cn/OPENEULER_VER/OS/$basearch/RPM-GPG-KEY-openEuler diff --git a/scripts/autobbappend/autobbappend.py b/scripts/autobbappend/autobbappend.py index 08b8f121b7d1a34b66107e75ad962e1f6f6b0bce..6e0992234b692cbbf96f5851e9f817420116ff17 100644 --- a/scripts/autobbappend/autobbappend.py +++ b/scripts/autobbappend/autobbappend.py @@ -37,8 +37,8 @@ def search_files(rootDir,filepathmsg,filetype): if j in apathname: filepathresult.append(apath) for i in sorted(filepathresult): - if not i.endswith(tuple(filetype)): - filepathresult.remove(i) + if not i.endswith(tuple(filetype)): + filepathresult.remove(i) if len(filepathresult) == 0: dir = None if len(filepathresult) == 1: @@ -220,6 +220,7 @@ def read_original_source(bb_dir): remote_url = line.strip('SRC_URI = "') remote_url = remote_url.split('"')[0].strip()#Delete the '"' at the end remote_url = remote_url.split("\\")[0].strip()#Delete the ' \' at the end + f.close() return remote_url @@ -381,7 +382,7 @@ class BuildData: BP = '${BP}', BPN = '${BPN}', )) - + template_file.close() # Write code to file if not os.path.exists(bbappend:path):os.makedirs(bbappend:path) filePath = bbappend:path+'/'+bpn+'_%.bbappend'