From a1e68d882f07894dd3048270a359fc2b543c580e Mon Sep 17 00:00:00 2001 From: NADAL Jean-Baptiste Date: Wed, 10 Apr 2019 18:58:11 +0200 Subject: [PATCH] update docker --- bsp/include/buildroot.mk | 26 ++++++------------- bsp/include/docker.mk | 3 ++- bsp/scripts/docker-build.sh | 17 ++++++++++-- projects/x86_64_domo/configs/Dockerfile | 1 + .../x86_64_domo/configs/buildroot_defconfig | 4 +-- projects/x86_64_domo/ovl/init | 14 ++++++++++ 6 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 projects/x86_64_domo/ovl/init diff --git a/bsp/include/buildroot.mk b/bsp/include/buildroot.mk index 8986fa91..f3cba938 100644 --- a/bsp/include/buildroot.mk +++ b/bsp/include/buildroot.mk @@ -14,6 +14,12 @@ buildroot.menuconfig: buildroot.config $(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ savedefconfig @echo "Saving defconfig done." +buildroot.nconfig: buildroot.config + $(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ nconfig + @echo "Saving defconfig (Waiting) ...." + $(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ savedefconfig + @echo "Saving defconfig done." + buildroot: buildroot.config $(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ $(BR_TARGET) @@ -29,24 +35,8 @@ $(BR_STAGING)/buildroot/.config: $(BR_PROJECT)/configs/buildroot_defconfig @cp $(BR_PROJECT)/configs/buildroot_defconfig $(BR_STAGING)/buildroot/.config $(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ defconfig -# should be deprecated. -buildroot.menuconfig.old: buildroot.config.old - $(MAKE) $(BR_ENV) -C $(BR_PROJECT)/../../bsp/buildroot/ menuconfig - cmp -s $(BR_STAGING)/buildroot/.config $(BR_PROJECT)/configs/buildroot.config; \ - if test $$? -ne 0; then echo "Config Files has changed......"; \ - cp $(BR_STAGING)/buildroot/.config $(BR_PROJECT)/configs/buildroot.config; \ - fi - -buildroot.config.old: - @mkdir -p $(BR_STAGING)/buildroot/ -ifeq ("$(wildcard $(BR_STAGING)/buildroot/.config)","") - @cp $(BR_PROJECT)/configs/buildroot.config $(BR_STAGING)/buildroot/.config -else - cmp -s $(BR_PROJECT)/configs/buildroot.config $(BR_STAGING)/buildroot/.config; \ - if test $$? -ne 0; then echo "Config Files has changed......"; \ - cp $(BR_PROJECT)/configs/buildroot.config $(BR_STAGING)/buildroot/.config; \ - fi -endif +buildroot.check-package: + find $(BR_PROJECT)/../../bsp/buildroot_external/package/ -type f \( -name '*.mk' -o -name '*.hash' -o -name 'Config.*' \) -exec $(BR_PROJECT)/../../bsp/buildroot/utils/check-package -b {} \; install.sd: sudo dd if=$(BR_STAGING)/buildroot/images/sdcard.img of=/dev/sdb && sync && sync diff --git a/bsp/include/docker.mk b/bsp/include/docker.mk index cd3e7631..a0fd599f 100644 --- a/bsp/include/docker.mk +++ b/bsp/include/docker.mk @@ -8,4 +8,5 @@ docker.build: docker.run: @echo "Docker run image." - docker -D run -t -i $(BR_PROJECT_NAME):v$(VERSION) /bin/bash + @docker -D run --privileged -p 2000:2000 -p 8080:34080 -v $(BR_STAGING)/buildroot/target/usr:/usr \ + -t -i $(BR_PROJECT_NAME):v$(VERSION) diff --git a/bsp/scripts/docker-build.sh b/bsp/scripts/docker-build.sh index f732dfac..af9c4936 100755 --- a/bsp/scripts/docker-build.sh +++ b/bsp/scripts/docker-build.sh @@ -1,5 +1,15 @@ #!/bin/bash +# Catch build Error +function error { + + echo "Docker build Failed." + exit 1; +} + +set -e +trap error ERR + echo "Build Docker Image." stagingPath=$1 @@ -37,9 +47,12 @@ cp -a $stagingPath/buildroot/target/bin $stagingPath/docker-build/rootfs/ cp -a $stagingPath/buildroot/target/etc $stagingPath/docker-build/rootfs/ cp -a $stagingPath/buildroot/target/lib $stagingPath/docker-build/rootfs/ cp -a $stagingPath/buildroot/target/sbin $stagingPath/docker-build/rootfs/ -cp -a $stagingPath/buildroot/target/var $stagingPath/docker-build/rootfs/ touch $stagingPath/docker-build/rootfs/etc/resolv.conf -touch $stagingPath/docker-build/rootfs/sbin/init + +cp /lib/x86_64-linux-gnu/libpthread.so.0 $stagingPath/docker-build/rootfs/lib +cp /usr/lib/x86_64-linux-gnu/libltdl.so.7 $stagingPath/docker-build/rootfs/lib +cp /lib/x86_64-linux-gnu/libc.so.6 $stagingPath/docker-build/rootfs/lib +cp /lib64/ld-linux-x86-64.so.2 $stagingPath/docker-build/rootfs/lib64 docker build -t ${projectName}:v${version} $stagingPath/docker-build diff --git a/projects/x86_64_domo/configs/Dockerfile b/projects/x86_64_domo/configs/Dockerfile index 07d96274..fd28eb24 100644 --- a/projects/x86_64_domo/configs/Dockerfile +++ b/projects/x86_64_domo/configs/Dockerfile @@ -1,2 +1,3 @@ FROM scratch ADD rootfs / +CMD /init \ No newline at end of file diff --git a/projects/x86_64_domo/configs/buildroot_defconfig b/projects/x86_64_domo/configs/buildroot_defconfig index ee2e9179..736221bb 100644 --- a/projects/x86_64_domo/configs/buildroot_defconfig +++ b/projects/x86_64_domo/configs/buildroot_defconfig @@ -14,8 +14,8 @@ BR2_TOOLCHAIN_EXTERNAL_WCHAR=y BR2_TOOLCHAIN_EXTERNAL_HAS_SSP=y BR2_TOOLCHAIN_EXTERNAL_CXX=y BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y -BR2_TARGET_GENERIC_HOSTNAME="" -BR2_TARGET_GENERIC_ISSUE="Welcome to QuartetIII" +BR2_TARGET_GENERIC_HOSTNAME="docker_Domo" +BR2_TARGET_GENERIC_ISSUE="Welcome to Domo" BR2_INIT_NONE=y BR2_ROOTFS_DEVICE_CREATION_STATIC=y BR2_SYSTEM_BIN_SH_BASH=y diff --git a/projects/x86_64_domo/ovl/init b/projects/x86_64_domo/ovl/init new file mode 100644 index 00000000..edbb91b1 --- /dev/null +++ b/projects/x86_64_domo/ovl/init @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +/sbin/ubusd & + +/usr/sbin/logd & + +#/usr/local/bin/domod & + +#/usr/local/bin/uhttpd -p 8080 -f -h /usr/local/share/uhttpd/ -U /usr/local/configs/uhttpd/ -u /usr/local/bin/plugins/ & + +/usr/bin/gdbserver --multi :2000 & + +exec /bin/bash