summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2022-04-04 15:01:00 -0500
committerJohn Klug <john.klug@multitech.com>2022-04-04 15:01:00 -0500
commit7a33c71cb2493c60d83863191107e1f58733adde (patch)
tree353dc8976d7430e912c50fbe93ebb7e5b61c4e87 /scripts
parent64deb3b15d7ce3aba36fc0d457076d70887472bc (diff)
downloadmeta-mlinux-7a33c71cb2493c60d83863191107e1f58733adde.tar.gz
meta-mlinux-7a33c71cb2493c60d83863191107e1f58733adde.tar.bz2
meta-mlinux-7a33c71cb2493c60d83863191107e1f58733adde.zip
How to build an image from the source tarball
Diffstat (limited to 'scripts')
-rw-r--r--scripts/docker-build/Dockerfile42
-rw-r--r--scripts/docker-build/README28
-rwxr-xr-xscripts/docker-build/build-docker.sh11
-rwxr-xr-xscripts/docker-build/build-mlinux.sh9
4 files changed, 90 insertions, 0 deletions
diff --git a/scripts/docker-build/Dockerfile b/scripts/docker-build/Dockerfile
new file mode 100644
index 0000000..4491447
--- /dev/null
+++ b/scripts/docker-build/Dockerfile
@@ -0,0 +1,42 @@
+# To execut the Docker build:
+# ./build-docker.sh
+# This should lead to a shell prompt as root.
+# Then type:
+# # > su -l mlbuilder
+# $ > build-mlinux.sh
+#
+# Created user-id mlbuilder with password mlbuilder
+#
+#
+FROM ubuntu:bionic
+ENV APT="apt-get -y"
+
+USER root
+ENV DEBIAN_FRONTEND=noninteractive
+RUN cp /etc/apt/sources.list /etc/apt/sources.list~
+RUN sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
+RUN ${APT} update
+RUN useradd -G sudo -s /bin/bash -m mlbuilder
+RUN echo "export LANG=en_US.UTF-8" >>/home/mlbuilder/.profile
+RUN echo "export LANGUAGE=en_US:en" >>/home/mlbuilder/.profile
+RUN echo "export LC_ALL=en_US.UTF-8" >>/home/mlbuilder/.profile
+RUN ${APT} build-dep qemu
+RUN ${APT} remove oss4-dev
+RUN ${APT} install apt-utils gawk wget git-core diffstat unzip texinfo gcc-multilib \
+ build-essential chrpath socat iputils-ping locales language-pack-en cpio \
+ xz-utils cmake lsof strace
+RUN ${APT} install openssh-server
+RUN sed -i 's/.*PermitEmptyPasswords no.*/PermitEmptyPasswords yes/' /etc/ssh/sshd_config
+RUN echo "PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '" >>/home/mlbuilder/.bashrc
+COPY mlinux-6.0.0.tar.gz /tmp
+RUN mkdir -p /home/mlbuilder/.local/bin
+COPY build-mlinux.sh /home/mlbuilder/.local/bin
+RUN chmod 775 /home/mlbuilder/.local/bin/build-mlinux.sh
+RUN chown -R mlbuilder:mlbuilder /home/mlbuilder
+RUN su -l mlbuilder bash -c "tar -C /home/mlbuilder -xf /tmp/mlinux-6.0.0.tar.gz"
+RUN rm /tmp/mlinux-6.0.0.tar.gz
+RUN mkdir -p /run/sshd
+RUN echo "mlbuilder:mlbuilder" >/home/mlbuilder/password.txt
+RUN chpasswd < /home/mlbuilder/password.txt
+EXPOSE 22/tcp
+ENTRYPOINT /usr/sbin/sshd && bash
diff --git a/scripts/docker-build/README b/scripts/docker-build/README
new file mode 100644
index 0000000..c38fdb9
--- /dev/null
+++ b/scripts/docker-build/README
@@ -0,0 +1,28 @@
+Docker allows one to build on a specific version of an operating
+system without having that version installed on the host. This
+example was tested on Debian Bullseye, but the build was actually
+done on the Ubuntu Bionic Docker image.
+
+The following docker related packages were installed:
+
+ ii docker-ce 5:20.10.14~3-0~debian-bullseye amd64 Docker: the open-source application container engine
+ ii docker-ce-cli 5:20.10.14~3-0~debian-bullseye amd64 Docker CLI: the open-source application container engine
+ ii docker-ce-rootless-extras 5:20.10.14~3-0~debian-bullseye amd64 Rootless support for Docker.
+ ii docker-scan-plugin 0.17.0~debian-bullseye amd64 Docker scan cli plugin.
+
+build-docker.sh was run from the command line to create the docker container called mlinux-build
+
+The build starts sshd, but is is not needed if you use the docker
+exec command to attach to the Docker image as us done in
+build-mlinux.sh.
+
+After the build is complete you should have a login shell. You
+could the do:
+
+ su -l mlbuilder
+ build-mlinux.sh
+
+After the build completes, the output files can be copied from the host
+as follows:
+
+ docker cp mlinux-build:/home/mlbuilder/mlinux-6.0.0/build/tmp/deploy/images/mtcdt/mlinux-base-image-mtcdt-upgrade-withboot.bin .
diff --git a/scripts/docker-build/build-docker.sh b/scripts/docker-build/build-docker.sh
new file mode 100755
index 0000000..d6b6436
--- /dev/null
+++ b/scripts/docker-build/build-docker.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Build a Docker image to build mLinux 6
+docker container stop mlinux-build || true
+docker container rm mlinux-build || true
+docker build --network=host -t yocto-bionic .
+docker run -P -itd --name mlinux-build yocto-bionic:latest bash
+echo 'You should be able to ssh to the following address at port 22 (the ssh port):'
+docker inspect -f "{{ .NetworkSettings.IPAddress }}" mlinux-build
+echo 'Printing out the userid:password for ssh access'
+docker exec mlinux-build /bin/cat /home/mlbuilder/password.txt
+docker exec -it mlinux-build /bin/bash
diff --git a/scripts/docker-build/build-mlinux.sh b/scripts/docker-build/build-mlinux.sh
new file mode 100755
index 0000000..a317144
--- /dev/null
+++ b/scripts/docker-build/build-mlinux.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Script to do the build of mLinux 6 base image
+# First step after getting in:
+# su -l mlbuilder
+cd mlinux-6.0.0/
+export MACHINE=mtcdt
+export MLINUX_PASSWORD=root
+. oe-init-build-env
+bitbake mlinux-base-image