From 44623fb856d31b333dd3c80dd762638f466ecfb2 Mon Sep 17 00:00:00 2001 From: Kevin Alvarez Date: Thu, 26 Jun 2025 15:46:41 +0200 Subject: [PATCH] cmd: use dockerfile to generate win event messages Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- cli/winresources/README.md | 8 ------ cmd/dockerd/winresources/Dockerfile | 19 +++++++++++++ cmd/dockerd/winresources/event_messages.h | 33 ++++++++++++++++++++++ cmd/dockerd/winresources/event_messages.rc | 9 ++++++ 4 files changed, 61 insertions(+), 8 deletions(-) delete mode 100644 cli/winresources/README.md create mode 100644 cmd/dockerd/winresources/Dockerfile create mode 100644 cmd/dockerd/winresources/event_messages.h create mode 100644 cmd/dockerd/winresources/event_messages.rc diff --git a/cli/winresources/README.md b/cli/winresources/README.md deleted file mode 100644 index c1d425d4ff..0000000000 --- a/cli/winresources/README.md +++ /dev/null @@ -1,8 +0,0 @@ -## Generate `event_messages.bin` - -```console -$ docker run --rm -it -v "$(pwd):/winresources" debian:bookworm-slim bash -root@9ad2260f6ebc:/# apt-get update -y && apt-get install -y binutils-mingw-w64-x86-64 -root@9ad2260f6ebc:/# x86_64-w64-mingw32-windmc -v /winresources/event_messages.mc -root@9ad2260f6ebc:/# mv MSG00001.bin /winresources/event_messages.bin -``` diff --git a/cmd/dockerd/winresources/Dockerfile b/cmd/dockerd/winresources/Dockerfile new file mode 100644 index 0000000000..746e1c1da7 --- /dev/null +++ b/cmd/dockerd/winresources/Dockerfile @@ -0,0 +1,19 @@ +# syntax=docker/dockerfile:1 + +ARG DEBIAN_VERSION=bookworm +ARG XX_VERSION=1.6.1 + +# xx is a helper for cross-compilation +FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx + +FROM --platform=$BUILDPLATFORM debian:${DEBIAN_VERSION}-slim AS build +COPY --link --from=xx / / +ARG TARGETPLATFORM +RUN apt-get update && xx-apt-get --no-install-recommends install -y binutils +WORKDIR /out +RUN --mount=type=bind,target=/winresources \ + x86_64-w64-mingw32-windmc -v /winresources/event_messages.mc \ + && mv MSG00001.bin event_messages.bin + +FROM scratch +COPY --from=build /out / diff --git a/cmd/dockerd/winresources/event_messages.h b/cmd/dockerd/winresources/event_messages.h new file mode 100644 index 0000000000..f0ad00d54b --- /dev/null +++ b/cmd/dockerd/winresources/event_messages.h @@ -0,0 +1,33 @@ +/* Do not edit this file manually. + This file is autogenerated by windmc. */ + +// +// The values are 32 bit layed out as follows: +// +// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 +// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +// +---+-+-+-----------------------+-------------------------------+ +// |Sev|C|R| Facility | Code | +// +---+-+-+-----------------------+-------------------------------+ +// +// where +// +// C - is the Customer code flag +// +// R - is a reserved bit +// +// Code - is the facility's status code +// +// Sev - is the severity code +// +// Success - 00 +// Informational - 01 +// Warning - 02 +// Error - 03 +// +// Facility - is the facility code +// +// System - 00ff +// Application - 0fff +// + diff --git a/cmd/dockerd/winresources/event_messages.rc b/cmd/dockerd/winresources/event_messages.rc new file mode 100644 index 0000000000..6f6ce3344d --- /dev/null +++ b/cmd/dockerd/winresources/event_messages.rc @@ -0,0 +1,9 @@ +/* Do not edit this file manually. + This file is autogenerated by windmc. */ + + +// Country: United States +// Language: English +#pragma code_page(1252) +LANGUAGE 0x9, 0x1 +1 MESSAGETABLE "MSG00001.bin"