1 Star 0 Fork 0

wen/Open.HD_Image_Builder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Open.HD-Image-Builder

Short version: This project takes a Raspbian-lite base image and modifies it into a Open.HD compatible image. For the long version, read on.

1. Using

In order to be able to run this you need a Debian or Ubuntu Linux machine with 30 Gb free space on the main partition, and with the following packages:

sudo apt-get install unzip curl git qemu qemu-user-static binfmt-support build-essential gcc-arm*

If any of the packages fails to install, run apt update prior to the apt-get install command:

sudo apt update

Then git clone this repository to a suitable folder

git clone https://github.com/OpenHD/Open.HD_Image_Builder.git
cd Open.HD_Image_Builder

Elevate your prompt:

sudo -s

And run:

./build.sh pi stretch

or

./build.sh pi buster

2. More information (what’s going on?)

The earlier version of this builder did all of the work from a single script, while that is basically fine, there were some issues with the approach taken:

  • After every modification, the entire process needed to be re-run. (Which takes ~2 hours on a decent machine)

  • It was hard for new users to find the different steps and where to make additions

The main issue offcourse being the first one. So, on to this, the new and improved 'staged' image builder.

Note: if a build fails for some reason, be sure to run the cleanup script so that any temporarily mounted images are cleaned up:

./clean-fail.sh

2.1. STAGES

The core concept (and some code) was taken from pi-gen, the Raspbian image generator.

Whenever we make a OpenHd image, we basically perform several steps in order:

  • Download a base image

  • Increase the size of the root partition if necessary

  • Preinstall the OpenHD Packages

  • Update the /boot or /conf partition name

  • Set the system hostname

  • Cleanup

Remember, this was all done in a single script, and an error in the cleanup step basically meant running it all again.

So after thinking about the problem and looking for projects who had tackled this i looked at the actual Raspbian image generator, who’s output serves as our input (the basic Raspbian lite image). The concept used in the Raspbian image generator is dividing the entire creation process in stages, where the output of the previous stage serves as the input of the next. Stages that have been completed can be skipped in a next build.

This concept applies to the OpenHD image creation as well. So i modified the core logic into this system:

Flow

This allows us to run the build process once, and when we want to make a change in stage 3, we only run stage 3 and 4 again by removing the SKIP file from the stages/03-Packages and the stages/04-Wifibroadcast folders. The build system will copy the kernel IMAGE.img from stage 2 to stage 3 and re-run all the scripts in stage 3. The resulting image is copied to stage 4 and all those scripts are run. Finally, when there are no more stages, the IMAGE.img from the last stage is copied to the ./deploy directory and renamed to include the target board and OpenHD version.

2.1.1. Skipping

By placing a SKIP file in the stage folder, the entire stage will be skipped by the build system. Please be aware there is no sanity check in place, removing the SKIP file from stage 3 while leaving the SKIP file in stage 4 will produce an image based on the previous run, ignoring the modifications done in step 3.

It is also possible to put a SKIP-IMAGE file into a stage, this will disable any attempt to copy the image from the previous stage. This is mainly used to prevent image copying in stage 00 and 01 where no image is yet available.

2.1.2. Scripts

Every stage comprises one or more scripts. Scripts need to be named in the format XX-run.sh or XX-run-chroot.sh. The order is determined by the XX part, where any -chroot script is run AFTER the non-chroot script.

chroot? What’s that? Well, it’s a little complex, but basically it allows you to run statements within the image as if you were running the image on an actual target board like the Raspberry Pi. This is used to download and install the apt-get packages and several scripts to make the image ready for use with the OpenHD system. Please remember to use sudo in the -chroot scripts where approperiate.

MIT License Copyright (c) 2018 Jelle Tigchelaar 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 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.

简介

暂无描述 展开 收起
Shell 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kinpar_wen/Open.HD_Image_Builder.git
[email protected]:kinpar_wen/Open.HD_Image_Builder.git
kinpar_wen
Open.HD_Image_Builder
Open.HD_Image_Builder
master

搜索帮助