diff options
author | Rob Austein <sra@hactrn.net> | 2019-02-11 07:39:38 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2019-02-11 07:39:38 +0000 |
commit | e556e6643e5d2300a38e4373bde45e83178becaf (patch) | |
tree | c9e271d04b8564e0680bb1d58a25045db50d7ac8 | |
parent | 6f526cc4567cb551feb4cae121f9a067d491f711 (diff) |
debootstrap, XiLinx installation.
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile | 31 | ||||
-rw-r--r-- | stage1/Dockerfile | 17 | ||||
-rw-r--r-- | stage2/Dockerfile | 20 | ||||
-rwxr-xr-x | stage2/installer | 57 |
5 files changed, 64 insertions, 65 deletions
@@ -1,3 +1,5 @@ +framebuf/Xvfb_screen0 +screenlog.0 +*.stamp Xilinx_ISE_DS_Lin_14.7_1015_1.tar Xilinx.lic -framebuf/Xvfb_screen0 @@ -1,17 +1,30 @@ -all: debug +all: build -build: build-stage1 build-stage2 # build-stage3 +build: stage0.stamp stage1.stamp stage2.stamp # stage3.stamp -debug: build-stage2 +debug: stage2.stamp docker container prune -f mkdir -p framebuf docker run -it --mount type=bind,source=$(abspath framebuf),target=/framebuf xilinx:intalled -build-stage1: - cd stage1; docker build -t xilinx:loadonly . +stage0.stamp: + mkdir -p stage0/jessie_chroot + cd stage0; sudo /usr/sbin/debootstrap --foreign jessie jessie_chroot + sudo tar -C stage0/jessie_chroot -c . | docker import - xilinx:debootstrap + sudo rm -rf stage0/jessie_chroot + touch $@ -build-stage2: - cd stage2; docker build -t xilinx:intalled . +stage1.stamp: stage0.stamp + cd stage1; docker build -t xilinx:loaded . + touch $@ -build-stage3: - cd stage3; docker build -t cryptech-alpha . +stage2.stamp: stage1.stamp + cd stage2; docker build -t xilinx:installed . + touch $@ + +stage3.stamp: stage2.stamp + cd stage3; docker build -t cryptech-alpha-builder . + touch $@ + +clean: + rm -f *.stamp diff --git a/stage1/Dockerfile b/stage1/Dockerfile index 2881772..db6fad3 100644 --- a/stage1/Dockerfile +++ b/stage1/Dockerfile @@ -1,17 +1,12 @@ -FROM debian:jessie +FROM xilinx:debootstrap +# Finish debootstrap (stage0 did debootstrap --foreign) + +RUN sed -i '/mount -t proc /d; /mount -t sysfs /d' /debootstrap/functions && \ + /debootstrap/debootstrap --second-stage + # Our goal here is just to load the XiLinx tarball into a Debian Jessie image. # Overriding reason for making this a separate image: we don't want to have # to send 6GB of build context every time we touch a later stage. ADD Xilinx_ISE_DS_Lin_14.7_1015_1.tar /xilinx-unpack/ - -# Given our general paranoia level we probably should be building our -# own debian:jessie image from debootstrap, but leave that for another -# day. Process is reasonably well documented: instead of starting -# from a base image, start by running debootstrap in --foreign mode, -# import that into an initial Docker image, then run `debootstrap -# --second-stage` in the next Dockerfile. Something like: -# -# sudo debootstrap --foreign jessie jessie_chroot -# sudo tar -C jessie_chroot -c . | docker import - my-debian:jessie diff --git a/stage2/Dockerfile b/stage2/Dockerfile index 3878080..ae2b272 100644 --- a/stage2/Dockerfile +++ b/stage2/Dockerfile @@ -1,22 +1,14 @@ -FROM xilinx:loadonly - -# Whack /bin/sh (known issue with XiLinx tools not working with /bin/dash) +FROM xilinx:loaded RUN ln -sf /bin/bash /bin/sh -# Here's where it gets really fun: let's see if we can drive the -# frelling XiLinx installation under Xvfb. Need some tools first, -# then some manual debugging to get the details right. Don't expect -# to need all of the following once we've debugged this. - RUN apt-get update && apt-get install -y \ libglib2.0-0 \ python-xvfbwrapper \ - ratpoison \ - x11-apps \ - x11-utils \ - x11-xserver-utils \ - xautomation + ratpoison COPY installer /xilinx-unpack/ -CMD /xilinx-unpack/installer + +RUN /xilinx-unpack/installer + +#RUN rm -rf /xilinx-unpack diff --git a/stage2/installer b/stage2/installer index 0853c9c..b3bb5ba 100755 --- a/stage2/installer +++ b/stage2/installer @@ -5,65 +5,62 @@ import subprocess, os, time, xvfbwrapper, itertools def run(*args, **kwargs): return subprocess.Popen(args, **kwargs) -def xte(*cmds): - subprocess.check_call(("xte",) + cmds) - -def xwininfo(): - print(subprocess.check_output(("xwininfo", "-root", "-tree"))) - def ratpoison(*args): - cmd = ["ratpoison"] - cmd.extend(itertools.chain.from_iterable(("-c", a) for a in args)) - return subprocess.check_output(cmd) + return subprocess.check_output(("ratpoison",) + tuple(itertools.chain.from_iterable(("-c", a) for a in args))) + +def snooze(how_long = 15): + time.sleep(how_long) def main(): with xvfbwrapper.Xvfb(fbdir = "/framebuf"): print("DISPLAY={}".format(os.getenv("DISPLAY"))) - rat = run("ratpoison") - time.sleep(1) - if False: - run("xsetroot", "-gray").wait() - run("xsetroot", "-cursor_name", "left_ptr", "-fg", "yellow", "-bg", "yellow").wait() - time.sleep(1) - xwininfo() + print("Starting rodent-free window manager") + rat = run("ratpoison") + snooze() + print("Starting XiLinx installer") xsetup = run("./xsetup", cwd = "/xilinx-unpack/Xilinx_ISE_DS_Lin_14.7_1015_1") - time.sleep(1) - xwininfo() - snooze = lambda: time.sleep(15) - print("First screen") snooze() + print("First screen") ratpoison("ratwarp 650 610", "ratclick") - print("Second screen") snooze() + print("Second screen") ratpoison("ratwarp 250 420", "ratclick", "ratwarp 250 444", "ratclick", "ratwarp 650 610", "ratclick") - print("Third screen") snooze() + print("Third screen") ratpoison("ratwarp 600 560", "ratclick", "ratwarp 650 610", "ratclick") - print("Fourth screen") snooze() + print("Fourth screen") ratpoison("ratwarp 300 100", "ratclick", "ratwarp 650 610", "ratclick") - + for ith in ("Fifth", "Sixth", "Seventh"): - print(ith + " screen") snooze() + print(ith + " screen") ratpoison("ratclick") - print("Waiting a few minutes, ^C if you get bored") - time.sleep(1800) + print("Waiting half an hour for XiLinx installer to run, ^C if you get bored") + snooze(1800) + + # In theory we could use visgrep to check for the "finish" button. + # In practice ... this is such a kludge, what's one more, let's just + # try blindly clicking where the finish button should be and see + # if that results in a usable image. + + print("Blindly clicking where finish button should be, then shutting down") + ratpoison("ratwarp 720 610", "ratclick", + "quit") - # Need to do awful visgrep thing here to find the finish button. - # When we do find it: - #ratpoison("ratwarp 720 610", "ratclick", "quit") + print("xsetup exited with status {}".format(xsetup.wait())) + print("ratpoison exited with status {}".format(rat.wait())) if __name__ == "__main__": main() |