Giter Club home page Giter Club logo

blueprints's Introduction

Maru OS Container Blueprints

CI workflow

Container image builder for Maru OS.

Blueprints

Image building logic is separated into standalone plugins called blueprints.

To create your own blueprint, all you need to do is:

  1. Add a directory under blueprint/. Use this directory to store anything you need during the build process.

  2. Add a script called plugin.sh to the top-level of your new blueprint directory. This will be the entrypoint to your blueprint.

  3. Define the function blueprint_build in plugin.sh that will run your build logic.

  4. Define the function blueprint_cleanup in plugin.sh that will clean up any intermediate build artifacts.

See blueprint/debian as the canonical example for Debian.

Examples

Build the default container:

$ ./build.sh

Build a minimal Debian arm64 buster container called "buster-container":

$ ./build.sh -b debian -n buster-container -- -r buster -a arm64 --minimal

Tip: You will need root privileges to mount binfmt_misc for bootstrapping foreign architecture containers.

Building with Docker

If you have Docker set up on your machine, just substitute ./build.sh with ./build-with-docker.sh to run a build within a Docker container with all the necessary dependencies pre-installed. All args will be passed to build.sh just like usual.

Build a Debian arm64 buster container called "buster-container" with Docker (args will be passed to build.sh):

$ ./build-with-docker.sh -b debian -n buster-container -- -r buster -a arm64 --minimal

To stop the build early you can run:

$ docker stop $CONTAINER_ID

where $CONTAINER_ID is determined from docker ps.

Contributing

See the main Maru OS repository for more info.

Licensing

Apache 2.0

blueprints's People

Contributors

dependabot[bot] avatar ian-kelling avatar pdsouza avatar utzcoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

blueprints's Issues

firefox-esr crashed in debian buster

Hi @pdsouza , I have tried upgrade debian to buster, but I found the firefox-esr crashed in it, but firefox works fine in debian buster. Maybe when someone wants to upgrade to buster, he/she should be attention to this problem.

Thanks.

Build mclient from source to support alternate architectures

Right now, we only have a 32-bit armhf mclient binary.

Ideally, we ne need to build this from source depending on the target architecture so this scales to other architectures easily.

This is especially needed to support arm64 ports due to issues with 64-bit mflinger and 32-bit mclient communication.

Build LXC container - Faillure

HOST : DEBIAN 10
BUILD : BLUEPRINT DEBIAN

sudo ./build.sh -b debian -n stretch-container -- -r stretch -a arm64 --minimal
[] Loading distro plugin...
[ DEBIAN ] loading...
[
] Building image...
[ DEBIAN ] bootstrapping rootfs...
debootstrap is /usr/sbin/debootstrap
Checking cache download in /var/cache/lxc/debian/rootfs-stretch-arm64 ...
Copying rootfs to /home/zerocool/Android/maru/vendor/maruos/blueprints/out/stretch-container-intermediates/rootfs...Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
update-rc.d: error: cannot find a LSB script for checkroot.sh
update-rc.d: error: cannot find a LSB script for umountfs
update-rc.d: error: cannot find a LSB script for hwclockfirst.sh
Creating SSH2 RSA key; this may take some time ...
2048 SHA256:5UFQ5hLAd6QXcpuj2LcUpU7v2axP1UOUancFFJGJNQY root@debian (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:g9s7QkUUi8BGobM4+eDFPeuKqpMuApNtF+N0HDbKVF8 root@debian (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:Inghmld4lB2/mgC+ZluhUVCUzhBq2sLP1+Eog8JgcNY root@debian (ED25519)
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.

Current default time zone: 'Etc/UTC'
Local time is now: Mon May 18 07:57:03 UTC 2020.
Universal Time is now: Mon May 18 07:57:03 UTC 2020.

lxc-create: stretch-container: confile.c: parse_line: 2367 Unknown configuration key "lxc.tty"
lxc-create: stretch-container: parse.c: lxc_file_for_each_line_mmap: 141 Failed to parse config file "/var/lib/lxc/stretch-container/config" at line "lxc.tty = 4"
lxc-create: stretch-container: tools/lxc_create.c: main: 331 Failed to create container stretch-container
[*] Cleaning up...
rm: cannot remove 'maru_0.1-1_all.deb': No such file or directory
make: [Makefile:31: clean] Error 1 (ignored)

Build failures due to missing maruos PGP key

System: Ubuntu 16.04 LTS
Device: Mido
Vendor: Xiaomi

./build.sh -n jessie -- -a arm64
update-binfmts: warning: unable to open /proc/sys/fs/binfmt_misc/status for writing: Permission denied
[] Loading distro plugin...
[ DEBIAN ] loading...
[
] Building image...
[ DEBIAN ] bootstrapping rootfs...
lxc-create: conf.c: chown_mapped_root: 3626 No mapping for container root
lxc-create: lxccontainer.c: do_bdev_create: 1052 Error chowning /home/ghostzero0_r2/.local/share/lxc/jessie/rootfs to container root
lxc-create: conf.c: suggest_default_idmap: 4749 You must either run as root, or define uid mappings
lxc-create: conf.c: suggest_default_idmap: 4750 To pass uid mappings to lxc-create, you could create
lxc-create: conf.c: suggest_default_idmap: 4751 ~/.config/lxc/default.conf:
lxc-create: conf.c: suggest_default_idmap: 4752 lxc.include = /etc/lxc/default.conf
lxc-create: conf.c: suggest_default_idmap: 4753 lxc.id_map = u 0 231072 65536
lxc-create: conf.c: suggest_default_idmap: 4754 lxc.id_map = g 0 231072 65536
lxc-create: lxccontainer.c: do_lxcapi_create: 1516 Error creating backing store type (none) for jessie
lxc-create: tools/lxc_create.c: main: 318 Error creating container jessie
[*] Cleaning up...
rm: cannot remove 'maru_0.1-1_all.deb': No such file or directory
make: [clean] Error 1 (ignored)

Add minimal desktop image build

N7 only has 650MB of system space so it needs a desktop image < 350 MB.

Add a minimal option so that we can support devices with constrained system partitions.

mmap failed on rockchip devices

Hi @pdsouza , I encountered a problem that mclient's mmap failed on rockchip devices because of permission denied. After some days' debug, I found the rockchip set buffer fd's access mode to 0(READONLY), when it try to transfer shared buffer fd which created by rockchip gralloc implementation to user space. In AOSP, there is a code snippet to do the same thing. To fix this problem, I just #include <fcntl.h> and change 0 to O_RDWR to make sure the fd has the r/w access mode.

I don't have a better solution to avoid mclient's use of mmap, so I just note the problem I encountered, and hope it will be helpful for someone who has the same problem now or later.

Thanks.

Use a secure apt repository for maru packages

The current Maru APT archive doesn't use a signed Release file so packages cannot be verified. We currently get around this with --allow-unauthenticated, but it would be best to use secure APT asap.

To use secure APT, we need to create a signed Release.gpg file for the archive which contains hashes that apt-get will automatically check when installing a package. See docs for more info.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.