mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-11-04 08:07:48 +00:00 
			
		
		
		
	miragesdk: fix the build after the switch from mirage tool to jbuilder
Signed-off-by: Thomas Gazagnaire <thomas@gazagnaire.org>
This commit is contained in:
		@@ -17,16 +17,6 @@ system:
 | 
				
			|||||||
     - /proc/sys/fs/binfmt_misc:/binfmt_misc
 | 
					     - /proc/sys/fs/binfmt_misc:/binfmt_misc
 | 
				
			||||||
    read_only: true
 | 
					    read_only: true
 | 
				
			||||||
    command: [/usr/bin/binfmt, -dir, /etc/binfmt.d/, -mount, /binfmt_misc]
 | 
					    command: [/usr/bin/binfmt, -dir, /etc/binfmt.d/, -mount, /binfmt_misc]
 | 
				
			||||||
  - name: dhcp-client
 | 
					 | 
				
			||||||
    network_mode: host
 | 
					 | 
				
			||||||
    image: "mobylinux/dhcp-client:aaf811d77ff8d8b2e16ca4dd9d0a2849ef8977b6"
 | 
					 | 
				
			||||||
    capabilities:
 | 
					 | 
				
			||||||
     - CAP_NET_ADMIN # to bring eth0 up
 | 
					 | 
				
			||||||
     - CAP_NET_RAW   # to read /dev/eth0
 | 
					 | 
				
			||||||
    binds:
 | 
					 | 
				
			||||||
     - /var/run/dhcp-client:/data
 | 
					 | 
				
			||||||
    command: [/dhcp-client, -vv]
 | 
					 | 
				
			||||||
    read_only: true
 | 
					 | 
				
			||||||
daemon:
 | 
					daemon:
 | 
				
			||||||
  - name: rngd
 | 
					  - name: rngd
 | 
				
			||||||
    image: "mobylinux/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9@sha256:1c93c1db7196f6f71f8e300bc1d15f0376dd18e8891c8789d77c8ff19f3a9a92"
 | 
					    image: "mobylinux/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9@sha256:1c93c1db7196f6f71f8e300bc1d15f0376dd18e8891c8789d77c8ff19f3a9a92"
 | 
				
			||||||
@@ -35,6 +25,16 @@ daemon:
 | 
				
			|||||||
    oom_score_adj: -800
 | 
					    oom_score_adj: -800
 | 
				
			||||||
    read_only: true
 | 
					    read_only: true
 | 
				
			||||||
    command: [/bin/tini, /usr/sbin/rngd, -f]
 | 
					    command: [/bin/tini, /usr/sbin/rngd, -f]
 | 
				
			||||||
 | 
					  - name: dhcp-client
 | 
				
			||||||
 | 
					    network_mode: host
 | 
				
			||||||
 | 
					    image: "mobylinux/dhcp-client:f40cafe2ade4b115704750a85d21eb35b1116b91"
 | 
				
			||||||
 | 
					    capabilities:
 | 
				
			||||||
 | 
					     - CAP_NET_ADMIN # to bring eth0 up
 | 
				
			||||||
 | 
					     - CAP_NET_RAW   # to read /dev/eth0
 | 
				
			||||||
 | 
					    binds:
 | 
				
			||||||
 | 
					     - /var/run/dhcp-client:/data
 | 
				
			||||||
 | 
					    command: [/dhcp-client, -vv]
 | 
				
			||||||
 | 
					    read_only: true
 | 
				
			||||||
files:
 | 
					files:
 | 
				
			||||||
  - path: /var/run/dhcp-client/README
 | 
					  - path: /var/run/dhcp-client/README
 | 
				
			||||||
    contents: 'data for dhcp-client'
 | 
					    contents: 'data for dhcp-client'
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								projects/miragesdk/src/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								projects/miragesdk/src/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -5,6 +5,7 @@ obj/
 | 
				
			|||||||
hash
 | 
					hash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generated by jbuilder
 | 
					# Generated by jbuilder
 | 
				
			||||||
 | 
					dhcp-client/calf/.merlin
 | 
				
			||||||
dhcp-client/bpf/.merlin
 | 
					dhcp-client/bpf/.merlin
 | 
				
			||||||
dhcp-client/.merlin
 | 
					dhcp-client/.merlin
 | 
				
			||||||
sdk/.merlin
 | 
					sdk/.merlin
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,14 @@ RUN opam pin -n add mirage-net-unix https://github.com/samoht/mirage-net-unix.gi
 | 
				
			|||||||
RUN opam depext -iy mirage-net-unix logs-syslog irmin-unix cohttp decompress
 | 
					RUN opam depext -iy mirage-net-unix logs-syslog irmin-unix cohttp decompress
 | 
				
			||||||
RUN opam depext -iy rawlink tuntap.1.0.0 jbuilder irmin-watcher inotify
 | 
					RUN opam depext -iy rawlink tuntap.1.0.0 jbuilder irmin-watcher inotify
 | 
				
			||||||
RUN opam install rresult
 | 
					RUN opam install rresult
 | 
				
			||||||
 | 
					RUN opam pin add cstruct --dev # for ppx/jbuilder
 | 
				
			||||||
 | 
					RUN opam pin add tuntap 1.0.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# TMP: to compile the calf
 | 
				
			||||||
 | 
					RUN opam pin add -n charrua-client https://github.com/yomimono/charrua-client.git#state-halfway
 | 
				
			||||||
 | 
					RUN opam depext -uiy ocamlfind topkg-care ocamlbuild lwt mirage-types-lwt mirage
 | 
				
			||||||
 | 
					RUN opam depext -uiy charrua-client cohttp conduit mirage-unix
 | 
				
			||||||
 | 
					RUN opam depext -uiy mirage-net-fd ptime mirage-logs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN sudo mkdir -p /src
 | 
					RUN sudo mkdir -p /src
 | 
				
			||||||
COPY ./sdk /src/sdk
 | 
					COPY ./sdk /src/sdk
 | 
				
			||||||
@@ -16,7 +24,8 @@ RUN sudo chown opam -R /src
 | 
				
			|||||||
USER opam
 | 
					USER opam
 | 
				
			||||||
WORKDIR /src
 | 
					WORKDIR /src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN opam pin add cstruct --dev # for ppx/jbuilder
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN opam config exec -- jbuilder build dhcp-client/main.exe
 | 
					RUN opam config exec -- jbuilder build dhcp-client/main.exe
 | 
				
			||||||
RUN sudo cp /src/_build/default/dhcp-client/main.exe /dhcp-client
 | 
					RUN sudo cp /src/_build/default/dhcp-client/main.exe /dhcp-client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN opam config exec -- jbuilder build dhcp-client/calf/unikernel.exe
 | 
				
			||||||
 | 
					RUN sudo cp /src/_build/default/dhcp-client/calf/unikernel.exe /dhcp-client-calf
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,8 @@ OBJS=obj/dhcp-client
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
MIRAGE_COMPILE=mobylinux/mirage-compile:f903b0e1b4328271364cc63f123ac49d56739cef@sha256:a54d9ca84d3f5998dba92ce83d60d49289cee8908a8b0f6ec280d30ab8edf46c
 | 
					MIRAGE_COMPILE=mobylinux/mirage-compile:f903b0e1b4328271364cc63f123ac49d56739cef@sha256:a54d9ca84d3f5998dba92ce83d60d49289cee8908a8b0f6ec280d30ab8edf46c
 | 
				
			||||||
CALF_OBJS=obj/dhcp-client-calf
 | 
					CALF_OBJS=obj/dhcp-client-calf
 | 
				
			||||||
CALF_FILES=dhcp-client/calf/config.ml dhcp-client/calf/unikernel.ml
 | 
					CALF_FILES=dhcp-client/calf/config.ml dhcp-client/calf/unikernel.ml \
 | 
				
			||||||
 | 
						   dhcp-client/calf/jbuild
 | 
				
			||||||
 | 
					
 | 
				
			||||||
default: push
 | 
					default: push
 | 
				
			||||||
	@
 | 
						@
 | 
				
			||||||
@@ -34,18 +35,18 @@ enter-build: .build
 | 
				
			|||||||
enter-dev: .dev
 | 
					enter-dev: .dev
 | 
				
			||||||
	docker run --privileged -it -v `pwd`:/src $(shell cat .dev)
 | 
						docker run --privileged -it -v `pwd`:/src $(shell cat .dev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(CALF_OBJS): $(CALF_FILES)
 | 
					#$(CALF_OBJS): $(CALF_FILES)
 | 
				
			||||||
	mkdir -p obj/bin
 | 
					#	mkdir -p obj/bin
 | 
				
			||||||
	( cd obj && \
 | 
					#	( cd obj && \
 | 
				
			||||||
	  tar -C ../dhcp-client/calf -cf - $(CALF_FILES:dhcp-client/calf/%=%) | \
 | 
					#	  tar -C ../dhcp-client/calf -cf - $(CALF_FILES:dhcp-client/calf/%=%) | \
 | 
				
			||||||
	    docker run --rm -i --log-driver=none $(MIRAGE_COMPILE) -o dhcp-client-calf | \
 | 
					#	    docker run --rm -i --log-driver=none $(MIRAGE_COMPILE) -o dhcp-client-calf | \
 | 
				
			||||||
	    tar xf - || exit 1) && \
 | 
					#	    tar xf - || exit 1) && \
 | 
				
			||||||
	touch $@
 | 
					#	touch $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(OBJS): .build $(FILES)
 | 
					$(OBJS) $(CALF_OBJS): .build $(FILES) $(CALF_FILES)
 | 
				
			||||||
	mkdir -p obj/usr/lib obj/bin
 | 
						mkdir -p obj/usr/lib obj/bin
 | 
				
			||||||
	( cd obj && \
 | 
						( cd obj && \
 | 
				
			||||||
	  docker run --rm --net=none --log-driver=none -i $(IMAGE):build tar -cf - $(OBJS:obj/%=/%) | tar xf - ) && \
 | 
						  docker run --rm --net=none --log-driver=none -i $(IMAGE):build tar -cf - $(OBJS:obj/%=/%) $(CALF_OBJS:obj/%=/%) | tar xf - ) && \
 | 
				
			||||||
	touch $@
 | 
						touch $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
hash: Makefile Dockerfile.build Dockerfile.pkg $(FILES) $(CALF_FILES) .build
 | 
					hash: Makefile Dockerfile.build Dockerfile.pkg $(FILES) $(CALF_FILES) .build
 | 
				
			||||||
@@ -77,7 +78,8 @@ dev-clean:
 | 
				
			|||||||
	rm -rf _build dhcp-client/calf/_build
 | 
						rm -rf _build dhcp-client/calf/_build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dev:
 | 
					dev:
 | 
				
			||||||
	cd dhcp-client/calf && mirage configure && make
 | 
					 | 
				
			||||||
	jbuilder build dhcp-client/main.exe --dev
 | 
						jbuilder build dhcp-client/main.exe --dev
 | 
				
			||||||
 | 
						jbuilder build dhcp-client/calf/unikernel.exe --dev
 | 
				
			||||||
 | 
					#	cd dhcp-client/calf && mirage configure && make
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.DELETE_ON_ERROR:
 | 
					.DELETE_ON_ERROR:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user