lbkit 0.6.4__tar.gz → 0.6.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lbkit-0.6.4/lbkit.egg-info → lbkit-0.6.6}/PKG-INFO +1 -1
- lbkit-0.6.6/lbkit/__init__.py +2 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/client.c.mako +0 -3
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/public.c.mako +2 -5
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/public.h.mako +3 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/server.c.mako +0 -3
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/component/template/conanbase.mako +13 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/build_image.py +1 -3
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/build_manifest.py +31 -16
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/build_rootfs.py +6 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/config.py +0 -3
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/template/conanfile.py.mako +1 -1
- lbkit-0.6.6/lbkit/integration/template/rootfs.py.mako +27 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/utils/images/emmc.py +2 -22
- {lbkit-0.6.4 → lbkit-0.6.6/lbkit.egg-info}/PKG-INFO +1 -1
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit.egg-info/SOURCES.txt +1 -0
- lbkit-0.6.4/lbkit/__init__.py +0 -2
- {lbkit-0.6.4 → lbkit-0.6.6}/AUTHORS +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/LICENSE +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/MANIFEST.in +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/README.md +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/build_conan_parallel.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/ci_robot/__init__.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/ci_robot/gitee.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/cli.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/__init__.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/codegen.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/ctype_defination.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/idf_interface.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/renderer.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/client.h.mako +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/interface.c.mako +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/codegen/template/server.h.mako +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/component/__init__.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/component/arg_parser.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/component/build.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/component/template/deploy.mako +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/component/test.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/errors.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/helper.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/__init__.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/build_prepare.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/integration/task.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/lbkit.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/log.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/misc.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/tools.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/utils/__init__.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit/utils/images/__init__.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit.egg-info/dependency_links.txt +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit.egg-info/entry_points.txt +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit.egg-info/requires.txt +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/lbkit.egg-info/top_level.txt +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/setup.cfg +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/setup.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/test/__init__.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/test/test_codegen.py +0 -0
- {lbkit-0.6.4 → lbkit-0.6.6}/test/test_helper.py +0 -0
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
#include "lb_base.h"
|
|
2
|
-
% for dep_intf in intf.dependency_interface:
|
|
3
|
-
#include "public/${dep_intf}.h"
|
|
4
|
-
% endfor
|
|
5
2
|
#include "${intf.name}.h"
|
|
6
3
|
|
|
7
4
|
<% class_name = intf.alias %>\
|
|
@@ -1034,12 +1031,12 @@ int ${class_name}_${action.name}_register(const gchar *req_signature, const gcha
|
|
|
1034
1031
|
}
|
|
1035
1032
|
if (g_strcmp0(req_signature, "${action.in_signature}") != 0) {
|
|
1036
1033
|
log_error("Register ${action.name} failed because parameter "
|
|
1037
|
-
"req_signature not match with \"{action.in_signature}\", get \"%s\"", req_signature);
|
|
1034
|
+
"req_signature not match with \"${action.in_signature}\", get \"%s\"", req_signature);
|
|
1038
1035
|
return -1;
|
|
1039
1036
|
}
|
|
1040
1037
|
if (g_strcmp0(rsp_signature, "${action.out_signature}") != 0) {
|
|
1041
1038
|
log_error("Register ${action.name} failed because parameter "
|
|
1042
|
-
"rsp_signature not match with \"{action.out_signature}\", get \"%s\"", rsp_signature);
|
|
1039
|
+
"rsp_signature not match with \"${action.out_signature}\", get \"%s\"", rsp_signature);
|
|
1043
1040
|
return -1;
|
|
1044
1041
|
}
|
|
1045
1042
|
g_mutex_lock(&_${class_name}_${action.name}_lock);
|
|
@@ -127,6 +127,19 @@ class LiteBmcConan(ConanFile):
|
|
|
127
127
|
% endif
|
|
128
128
|
pass
|
|
129
129
|
|
|
130
|
+
% if len(pkg.get("requires", {})) > 0:
|
|
131
|
+
def build_requirements(self):
|
|
132
|
+
% for conan in pkg["requires"].get("tool", []):
|
|
133
|
+
% if conan.get("when") is not None:
|
|
134
|
+
if ${conan.get("when")}:
|
|
135
|
+
self.tool_requires("${conan.get("conan")}")
|
|
136
|
+
% else:
|
|
137
|
+
self.tool_requires("${conan.get("conan")}")
|
|
138
|
+
% endif
|
|
139
|
+
% endfor
|
|
140
|
+
pass
|
|
141
|
+
% endif
|
|
142
|
+
|
|
130
143
|
def configure(self):
|
|
131
144
|
% if len(pkg.get("requires", {})) > 0:
|
|
132
145
|
% for conan in pkg["requires"].get("compile", []):
|
|
@@ -25,8 +25,6 @@ class BuildImage(Task):
|
|
|
25
25
|
"""任务入口"""
|
|
26
26
|
"""检查manifest文件是否满足schema格式描述"""
|
|
27
27
|
os.chdir(self.config.output_path)
|
|
28
|
-
cmd = "qemu-system-aarch64 -M virt -cpu cortex-a57 -M virt,dumpdtb=virt.dtb"
|
|
29
|
-
self.exec(cmd)
|
|
30
28
|
|
|
31
29
|
mk = MekeEmmcImage(os.path.join(self.config.temp_path, "emmc_tmp_dir"))
|
|
32
30
|
rootfs_size = self.get_manifest_config("metadata/rootfs_size")
|
|
@@ -35,7 +33,7 @@ class BuildImage(Task):
|
|
|
35
33
|
emmc_size = self.get_manifest_config("metadata/emmc_size")
|
|
36
34
|
if emmc_size:
|
|
37
35
|
mk.size_1m = self._trans_to_blk_1m(emmc_size)
|
|
38
|
-
mk.run(
|
|
36
|
+
mk.run(self.config.rootfs_img, "qemu.img")
|
|
39
37
|
cmd = 'cp /usr/share/litebmc/qemu.conf qemu.conf'
|
|
40
38
|
self.exec(cmd)
|
|
41
39
|
output_img = os.path.join(self.config.output_path, "litebmc_qemu.tar.gz")
|
|
@@ -68,6 +68,25 @@ class BuildManifest(Task):
|
|
|
68
68
|
cmd = f"conan download {pkg} -r {self.config.remote} --only-recipe"
|
|
69
69
|
self.exec(cmd, ignore_error=True)
|
|
70
70
|
|
|
71
|
+
def build_rootfs(self):
|
|
72
|
+
"""构建产品rootfs包"""
|
|
73
|
+
log.info("build rootfs")
|
|
74
|
+
|
|
75
|
+
manifest = self.load_manifest()
|
|
76
|
+
# 使用模板生成litebmc组件的配置
|
|
77
|
+
lookup = TemplateLookup(directories=os.path.join(src_cwd, "template"))
|
|
78
|
+
template = lookup.get_template("rootfs.py.mako")
|
|
79
|
+
conanfile = template.render(lookup=lookup, pkg=manifest)
|
|
80
|
+
|
|
81
|
+
recipe = os.path.join(self.conan_build, "rootfs")
|
|
82
|
+
os.makedirs(recipe, exist_ok=True)
|
|
83
|
+
os.chdir(recipe)
|
|
84
|
+
fp = open("conanfile.py", "w", encoding="utf-8")
|
|
85
|
+
fp.write(conanfile)
|
|
86
|
+
fp.close()
|
|
87
|
+
|
|
88
|
+
self.exec("conan create . " + self.common_args)
|
|
89
|
+
|
|
71
90
|
def build_litebmc(self):
|
|
72
91
|
"""构建产品conan包"""
|
|
73
92
|
log.info("build litebmc")
|
|
@@ -88,23 +107,17 @@ class BuildManifest(Task):
|
|
|
88
107
|
fp.close()
|
|
89
108
|
|
|
90
109
|
base_cmd = f"{self.common_args} {self.conan_settings}"
|
|
91
|
-
lockfile = os.path.join(self.config.
|
|
110
|
+
lockfile = os.path.join(self.config.temp_path, "conan.lock")
|
|
92
111
|
threadPool = ThreadPoolExecutor(max_workers=16)
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
with open(lockfile, "r") as fp:
|
|
103
|
-
lock = json.load(fp)
|
|
104
|
-
for key in ["requires", "build_requires", "python_requires", "config_requires"]:
|
|
105
|
-
requires = lock.get(key, [])
|
|
106
|
-
for require in requires:
|
|
107
|
-
threadPool.submit(self.download_recipe, require)
|
|
112
|
+
# 创建新的conan.lock文件
|
|
113
|
+
lock_cmd = f"conan lock create . {base_cmd} --lockfile-out={lockfile}"
|
|
114
|
+
self.exec(lock_cmd)
|
|
115
|
+
with open(lockfile, "r") as fp:
|
|
116
|
+
lock = json.load(fp)
|
|
117
|
+
for key in ["requires", "build_requires", "python_requires", "config_requires"]:
|
|
118
|
+
requires = lock.get(key, [])
|
|
119
|
+
for require in requires:
|
|
120
|
+
threadPool.submit(self.download_recipe, require)
|
|
108
121
|
threadPool.shutdown(wait=True)
|
|
109
122
|
graph_cmd = f"conan graph info . {base_cmd} -f json --lockfile={lockfile}"
|
|
110
123
|
graphfile = os.path.join(self.config.temp_path, "graph.info")
|
|
@@ -112,11 +125,13 @@ class BuildManifest(Task):
|
|
|
112
125
|
bcp = BuildConanParallel(graphfile, lockfile, self.common_args, self.config.from_source)
|
|
113
126
|
bcp.build()
|
|
114
127
|
|
|
128
|
+
self.exec(f"sed -i 's@rootfs_df190c/0.0.1#.*\"@rootfs_df190c/0.0.1\"@g' {lockfile}")
|
|
115
129
|
# 部署应用到self.config.conan_install
|
|
116
130
|
self.deploy(graphfile)
|
|
117
131
|
|
|
118
132
|
def run(self):
|
|
119
133
|
"""任务入口"""
|
|
134
|
+
self.build_rootfs()
|
|
120
135
|
self.build_litebmc()
|
|
121
136
|
error = False
|
|
122
137
|
if not self.config.rootfs_tar:
|
|
@@ -127,6 +127,12 @@ class BuildRootfs(Task):
|
|
|
127
127
|
if os.path.isdir(product_rootfs):
|
|
128
128
|
self.copy_conan_install(product_rootfs, mnt_path)
|
|
129
129
|
|
|
130
|
+
# 设置boot目录权限
|
|
131
|
+
log.info("设置boot目录权限")
|
|
132
|
+
self.exec(f"chown 0:0 boot/ -R")
|
|
133
|
+
self.exec(f"chmod 600 boot/ -R")
|
|
134
|
+
if os.path.isdir("extlinux"):
|
|
135
|
+
self.exec(f"chmod 700 boot/extlinux/")
|
|
130
136
|
# 执行rootfs定制化脚本
|
|
131
137
|
os.chdir(self.config.work_dir)
|
|
132
138
|
hook_name = "hook.post_rootfs"
|
|
@@ -34,8 +34,6 @@ class Config(object):
|
|
|
34
34
|
self.profile_build = args.profile_build
|
|
35
35
|
# 编译目标配置项
|
|
36
36
|
self.profile_host = args.profile
|
|
37
|
-
# 是否创建新的lockfile
|
|
38
|
-
self.create_conan_lock = args.create_conan_lock
|
|
39
37
|
|
|
40
38
|
# 设置并创建构建所需目录
|
|
41
39
|
log.info("Work dir: %s", self.work_dir)
|
|
@@ -67,7 +65,6 @@ class Config(object):
|
|
|
67
65
|
parser.add_argument("-pr:b", "--profile_build", help="Apply the specified profile to the build machine", default="default")
|
|
68
66
|
parser.add_argument("-t", "--build_type", type=str, choices=['debug', 'release', 'minsize'], help="Set the build type", default="debug")
|
|
69
67
|
parser.add_argument("-r", "--remote", help="specified conan server", default="litebmc")
|
|
70
|
-
parser.add_argument("-l", "--create_conan_lock", help="Create new conan.lock", action="store_true")
|
|
71
68
|
return parser
|
|
72
69
|
|
|
73
70
|
def get_manifest_config(self, key: str, default=None):
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from conan import ConanFile
|
|
3
|
+
<% dts = pkg.get("metadata", {}).get("dts") %>
|
|
4
|
+
|
|
5
|
+
class RootfsConan(ConanFile):
|
|
6
|
+
"""用于构建产品的顶层rootfs包"""
|
|
7
|
+
name = "rootfs_df190c"
|
|
8
|
+
settings = "os", "arch", "compiler", "build_type"
|
|
9
|
+
description = "build rootfs component"
|
|
10
|
+
url = "https://litebmc.com"
|
|
11
|
+
extension_properties = {
|
|
12
|
+
"compatibility_cppstd": False,
|
|
13
|
+
"compatibility_cstd": False
|
|
14
|
+
}
|
|
15
|
+
homepage = "https://www.litebmc.com"
|
|
16
|
+
license = "BSL-1.0"
|
|
17
|
+
version = "0.0.1"
|
|
18
|
+
|
|
19
|
+
% if dts:
|
|
20
|
+
def build_requirements(self):
|
|
21
|
+
self.tool_requires("dtc/1.7.0")
|
|
22
|
+
|
|
23
|
+
def build(self):
|
|
24
|
+
os.makedirs(self.package_folder + "/boot")
|
|
25
|
+
self.run(f"dtc -I dts -O dtb ${dts["input"]} -o {self.package_folder}/boot/${dts["output"]}")
|
|
26
|
+
|
|
27
|
+
% endif
|
|
@@ -26,7 +26,7 @@ class MakeImage():
|
|
|
26
26
|
cmd = "umount " + tmp_dir
|
|
27
27
|
self.tools.exec(cmd, ignore_error=True, echo_cmd=False)
|
|
28
28
|
|
|
29
|
-
def run(self,
|
|
29
|
+
def run(self, rootfs, output="emmc.img"):
|
|
30
30
|
blk_1k = self.misc_blk_1k + self.ubootenv_blk_1k + self.vbmeta_blk_1k
|
|
31
31
|
blk_1k += self.rootfs_blk_1m * 1024 * 3
|
|
32
32
|
blk_1k += self.userdata_blk_1m * 1024
|
|
@@ -57,26 +57,6 @@ class MakeImage():
|
|
|
57
57
|
end += self.rootfs_blk_1m * 1024 * 2
|
|
58
58
|
self.log.info("创建rootfs镜像区")
|
|
59
59
|
self.tools.exec(f"parted -s -a none {output} mkpart rootfs_a {start}s {end - 1}s")
|
|
60
|
-
self.log.info(f"挂载rootfs分区并复制内容,注意,此时会修改原始{rootfs}镜像并添加dtb以及启动参数")
|
|
61
|
-
self.tools.exec(f"fuse2fs {rootfs} {self.tmp_dir} -o fakeroot -o nonempty")
|
|
62
|
-
extlinux = os.path.join(self.tmp_dir, "boot/extlinux")
|
|
63
|
-
os.makedirs(extlinux, exist_ok=True)
|
|
64
|
-
with open(os.path.join(extlinux, "extlinux.conf"), "w+") as fp:
|
|
65
|
-
fp.write("menu title U-Boot menu\n")
|
|
66
|
-
fp.write("prompt 0\n")
|
|
67
|
-
fp.write("timeout 10\n")
|
|
68
|
-
fp.write("\n")
|
|
69
|
-
fp.write("label litebmc-active\n")
|
|
70
|
-
fp.write(" kernel /boot/Image\n")
|
|
71
|
-
fp.write(" fdt /boot/litebmc.dtb\n")
|
|
72
|
-
fp.write(" append console=ttyAMA0 loglevel=10 rootwait root=/dev/nvme0n1p4 rw\n")
|
|
73
|
-
self.tools.exec(f"cp {dtb} {self.tmp_dir}/boot/litebmc.dtb")
|
|
74
|
-
self.tools.exec(f"chown 0:0 {self.tmp_dir}/boot/ -R")
|
|
75
|
-
self.tools.exec(f"chmod 700 {self.tmp_dir}/boot/extlinux/")
|
|
76
|
-
self.tools.exec(f"chmod 600 {self.tmp_dir}/boot/extlinux/extlinux.conf")
|
|
77
|
-
self.tools.exec(f"chmod 600 {self.tmp_dir}/boot/Image")
|
|
78
|
-
self.tools.exec(f"chmod 600 {self.tmp_dir}/boot/litebmc.dtb")
|
|
79
|
-
self.tools.exec(f"umount {self.tmp_dir}")
|
|
80
60
|
self.log.info("复制镜像文件到rootfs_a区域")
|
|
81
61
|
self.tools.exec(f"dd if={rootfs} of={output} bs=512 seek={start} conv=notrunc")
|
|
82
62
|
self.log.info("制作rootfs_b")
|
|
@@ -106,4 +86,4 @@ class MakeImage():
|
|
|
106
86
|
|
|
107
87
|
if __name__ == "__main__":
|
|
108
88
|
mk = MakeImage()
|
|
109
|
-
mk.run("./
|
|
89
|
+
mk.run("./rootfs.img", "./qemu.img")
|
|
@@ -47,6 +47,7 @@ lbkit/integration/build_rootfs.py
|
|
|
47
47
|
lbkit/integration/config.py
|
|
48
48
|
lbkit/integration/task.py
|
|
49
49
|
lbkit/integration/template/conanfile.py.mako
|
|
50
|
+
lbkit/integration/template/rootfs.py.mako
|
|
50
51
|
lbkit/utils/__init__.py
|
|
51
52
|
lbkit/utils/images/__init__.py
|
|
52
53
|
lbkit/utils/images/emmc.py
|
lbkit-0.6.4/lbkit/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|