{"id":28430689,"url":"https://github.com/rt-thread/smart-build","last_synced_at":"2026-01-20T17:52:45.153Z","repository":{"id":268865292,"uuid":"901081174","full_name":"RT-Thread/smart-build","owner":"RT-Thread","description":"build kernel/rootfs/bootloader for rt-smart","archived":false,"fork":false,"pushed_at":"2025-06-12T16:22:40.000Z","size":35005,"stargazers_count":0,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-12T17:25:45.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RT-Thread.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-10T02:23:12.000Z","updated_at":"2025-06-12T16:22:44.000Z","dependencies_parsed_at":"2025-01-20T15:21:00.663Z","dependency_job_id":"e0ba27ab-1b17-4244-af04-cec92a725228","html_url":"https://github.com/RT-Thread/smart-build","commit_stats":null,"previous_names":["rt-thread/smart-build"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RT-Thread/smart-build","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread%2Fsmart-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread%2Fsmart-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread%2Fsmart-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread%2Fsmart-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RT-Thread","download_url":"https://codeload.github.com/RT-Thread/smart-build/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RT-Thread%2Fsmart-build/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263627972,"owners_count":23490883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-05T14:07:50.024Z","updated_at":"2026-01-20T17:52:45.112Z","avatar_url":"https://github.com/RT-Thread.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Build\n\n[![Manual Build Status](https://github.com/RT-Thread/smart-build/actions/workflows/manual-build.yml/badge.svg)](https://github.com/RT-Thread/smart-build/actions/workflows/manual-build.yml)\n\n# smart-build\nbuild kernel/rootfs/bootloader for smart\n\nThis README file contains information on the contents of the meta-smart layer.\n\nmeta-smart 依赖 openembedded-core，作为openembedded的一个layer存在。\n\n以下是基于Ubuntu22.04的编译流程：\n\n### 1. Host环境准备：\n```bash\n$ sudo apt install build-essential git curl vim python3 pip tmux bison flex file texinfo chrpath cpio diffstat gawk lz4 wget zstd qemu-system-arm\n$ sudo pip install requests scons kconfiglib tqdm\n```\n\n### 2. 下载smart-build:\n```bash\n$ git clone https://github.com/RT-Thread/smart-build.git\n```\n\n### 3. 进入smart-build目录，然后下载openembedded-core和bitbake仓库：\n\n```bash\n$ cd smart-build/\n$ git clone git://git.openembedded.org/openembedded-core oe-core\n$ git clone git://git.openembedded.org/bitbake\n```\n\n### 4. 设置bitbake编译环境：\n```bash\n$ source smart-env  #会自动进入build目录\n```\n或者指定自定义的构建目录名称：\n```bash\n$ source smart-env build-custom  #会自动进入build-custom目录\n```\n\n默认配置为 (参见 `build/conf/local.conf`)：\n```bash\nMACHINE ??= \"qemuarm64\"\n```\n\n也可以根据需要自行更改成 `qemuriscv64`\n\n### 5. 编译 smart-build 整个工程：\n\n```bash\n$ bitbake smart -c build_all  #\"smart\"是配方名称, build_all表示同时完成toolchain安装、busybox编译及生成ext4.img，以及smart的kernel的编译。\n```\n\n所以会依次下载smart-gcc，并解压到build/toolchain目录下；  \n然后编译busybox，将生成的ext4.img拷贝到build/$MACHINE目录下（如build/qemuarm64）；  \n最后编译smart kernel，并将生成的rtthread.bin拷贝到build/$MACHINE目录下。\n\n如果需要重新编译，可以执行清除处理：\n\n```bash\n$ bitbake smart -c clean  #同时清除toolchain，busybox， smart的编译文件\n```\n\n然后可以进去到build/$MACHINE目录运行qemu（以qemuarm64为例）：\n```bash\n$ cd build/qemuarm64\n$ ./run_qemuarm64.sh\n```\n### 6. smart-build常用的操作指令：\n\n1. 安装toolchain:\n```bash\n$ bitbake smart-gcc -c install_toolchain\n```\n\n2. 编译busybox并生成ext4.img (会先判断toolchain是否安装，否则会先安装)\n```bash\n$ bitbake busybox -c build_rootfs\n```\n\n3. 编译smart内核  (会先判断toolchain是否安装，否则会先安装)\n```bash\n$ bitbake smart -c build_kernel \n```\n\n4. 编译busybox及smart内核\n```bash\n$ bitbake smart -c build_all\n```\n\n5. 同时清除toolchain, busybox, smart的编译数据\n```bash\n$ bitbake smart -c clean/cleansstate/cleanall\n```\n\n参数说明：\n  * clean - 清除掉tmp下的编译目录；\n  * cleansstate - 清除掉编译状态；\n  * cleanall - 同时会清除掉下载的源文件；（慎用，否则又得下半天）\n\n### 7. Docker操作指南：\n本项目提供了开箱即用的Docker环境，位于 `tools/docker` 目录下。使用Docker可以避免环境配置问题，推荐使用此方式进行开发。\n\n1. 构建Docker镜像：\n```bash\n$ cd tools/docker\n$ sh ./docker_build.sh\n```\n这将创建一个名为 `smart-build` 的Docker镜像，基于Ubuntu 24.04，已预装所有必要的开发工具和依赖。\n\n2. 运行Docker容器：\n```bash\n$ sh ./docker_run.sh\n```\n\n该脚本会：\n- 以当前用户身份启动容器（避免权限问题）\n- 挂载当前用户的工作目录到容器中\n- 挂载用户配置文件（.bashrc, .profile等）\n- 设置合适的工作目录\n\n进入容器后，您可以按照上述第2步骤开始进行开发。所有在容器内的操作都会直接反映到主机的工作目录中。\n\n注意：\n- Docker环境已预配置了中国时区和国内镜像源，可加快开发效率\n- 容器是临时性的，退出后会自动删除，但您的工作目录数据会保留在主机上\n- 如需自定义Docker环境，可以修改 `tools/docker` 目录下的配置文件\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frt-thread%2Fsmart-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frt-thread%2Fsmart-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frt-thread%2Fsmart-build/lists"}