kernel-module-build icon indicating copy to clipboard operation
kernel-module-build copied to clipboard

Can't build for OS_VERSION: 5.2.8

Open goedonsopjani opened this issue 1 year ago • 2 comments

this is the dockerfile:

FROM ubuntu:jammy-20220531 as kernel-build

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC

RUN apt-get update && \
    apt-get install -y \
    bison \
    build-essential \
    flex \
    libelf-dev \
    libssl-dev \
    wget

WORKDIR /usr/src/app

ARG SRC_DIR=src
ARG OUT_DIR=out
ARG OS_VERSION

COPY src $SRC_DIR/
COPY include include/
COPY build.sh .
COPY load.sh .
COPY workarounds.sh .
RUN ./build.sh -s %%BALENA_MACHINE_NAME%% -v $OS_VERSION -i $SRC_DIR -o $OUT_DIR

FROM alpine

ARG SRC_DIR=src
ARG OUT_DIR=out
ARG OS_VERSION

# Set the location for kernel modules
ARG MOD_PATH=/opt/lib/modules/$OS_VERSION
# Required for access when the container starts
ENV MOD_PATH="$MOD_PATH"

# Copy the built kernel module into your app
COPY --from=kernel-build /usr/src/app/"$OUT_DIR"/"$SRC_DIR"_%%BALENA_MACHINE_NAME%%_"$OS_VERSION" "$MOD_PATH"

# Copy the startup script for loading the modules
COPY --from=kernel-build /usr/src/app/load.sh /usr/src/app/load.sh

# Start the script that loads the modules.
ENTRYPOINT ["sh", "/usr/src/app/load.sh"]

I got the error here: RUN ./build.sh -s %%BALENA_MACHINE_NAME%% -v $OS_VERSION -i $SRC_DIR -o $OUT_DIR

Logs:

[load]     Step 14/23 : RUN ./build.sh -s raspberrypi4-64 -v $OS_VERSION -i $SRC_DIR -o $OUT_DIR
[load]      ---> Running in 7cea94e1b099
[load]     [build.sh][INFO] Building source from src into out/src_raspberrypi4-64_5.2.8 for:
[load]                          OS versions: 5.2.8
[load]                          Device types: raspberrypi4-64
[load]     
[load]     make: Entering directory '/tmp/tmp.635xJF3OgQ'
[load]       SYNC    include/config/auto.conf.cmd
[load]       HOSTCC  scripts/basic/fixdep
[load]       HOSTCC  scripts/kconfig/conf.o
[load]       HOSTCC  scripts/kconfig/confdata.o
[load]       HOSTCC  scripts/kconfig/expr.o
[load]       LEX     scripts/kconfig/lexer.lex.c
[load]       YACC    scripts/kconfig/parser.tab.[ch]
[load]       HOSTCC  scripts/kconfig/lexer.lex.o
[load]       HOSTCC  scripts/kconfig/menu.o
[load]       HOSTCC  scripts/kconfig/parser.tab.o
[load]       HOSTCC  scripts/kconfig/preprocess.o
[load]       HOSTCC  scripts/kconfig/symbol.o
[load]       HOSTCC  scripts/kconfig/util.o
[load]       HOSTLD  scripts/kconfig/conf
[load]       HOSTCC  scripts/dtc/dtc.o
[load]       HOSTCC  scripts/dtc/flattree.o
[load]       HOSTCC  scripts/dtc/fstree.o
[load]       HOSTCC  scripts/dtc/data.o
[load]       HOSTCC  scripts/dtc/livetree.o
[load]       HOSTCC  scripts/dtc/treesource.o
[load]       HOSTCC  scripts/dtc/srcpos.o
[load]       HOSTCC  scripts/dtc/checks.o
[load]       HOSTCC  scripts/dtc/util.o
[load]       LEX     scripts/dtc/dtc-lexer.lex.c
[load]       YACC    scripts/dtc/dtc-parser.tab.[ch]
[load]       HOSTCC  scripts/dtc/dtc-lexer.lex.o
[load]       HOSTCC  scripts/dtc/dtc-parser.tab.o
[load]       HOSTLD  scripts/dtc/dtc
[load]       HOSTCC  scripts/dtc/libfdt/fdt.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_ro.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_wip.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_sw.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_rw.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_strerror.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_empty_tree.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_addresses.o
[load]       HOSTCC  scripts/dtc/libfdt/fdt_overlay.o
[load]       HOSTCC  scripts/dtc/fdtoverlay.o
[load]       HOSTLD  scripts/dtc/fdtoverlay
[load]       HOSTCC  scripts/genksyms/genksyms.o
[load]       YACC    scripts/genksyms/parse.tab.[ch]
[load]       HOSTCC  scripts/genksyms/parse.tab.o
[load]       LEX     scripts/genksyms/lex.lex.c
[load]       HOSTCC  scripts/genksyms/lex.lex.o
[load]       HOSTLD  scripts/genksyms/genksyms
[load]       HOSTCC  scripts/kallsyms
[load]       HOSTCC  scripts/sorttable
[load]       HOSTCC  scripts/asn1_compiler
[load]       HOSTCC  scripts/extract-cert
[load]       WRAP    arch/arm64/include/generated/uapi/asm/kvm_para.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/errno.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/ioctl.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/ioctls.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/ipcbuf.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/msgbuf.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/poll.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/resource.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/sembuf.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/shmbuf.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/siginfo.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/socket.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/sockios.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/stat.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/swab.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/termbits.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/termios.h
[load]       WRAP    arch/arm64/include/generated/uapi/asm/types.h
[load]       WRAP    arch/arm64/include/generated/asm/early_ioremap.h
[load]       WRAP    arch/arm64/include/generated/asm/mcs_spinlock.h
[load]       WRAP    arch/arm64/include/generated/asm/qrwlock.h
[load]       WRAP    arch/arm64/include/generated/asm/qspinlock.h
[load]       WRAP    arch/arm64/include/generated/asm/user.h
[load]       WRAP    arch/arm64/include/generated/asm/bugs.h
[load]       WRAP    arch/arm64/include/generated/asm/delay.h
[load]       WRAP    arch/arm64/include/generated/asm/div64.h
[load]       WRAP    arch/arm64/include/generated/asm/dma-mapping.h
[load]       WRAP    arch/arm64/include/generated/asm/dma.h
[load]       WRAP    arch/arm64/include/generated/asm/emergency-restart.h
[load]       WRAP    arch/arm64/include/generated/asm/hw_irq.h
[load]       WRAP    arch/arm64/include/generated/asm/irq_regs.h
[load]       WRAP    arch/arm64/include/generated/asm/kdebug.h
[load]       WRAP    arch/arm64/include/generated/asm/kmap_size.h
[load]       WRAP    arch/arm64/include/generated/asm/local.h
[load]       WRAP    arch/arm64/include/generated/asm/local64.h
[load]       WRAP    arch/arm64/include/generated/asm/mmiowb.h
[load]       WRAP    arch/arm64/include/generated/asm/msi.h
[load]       WRAP    arch/arm64/include/generated/asm/serial.h
[load]       WRAP    arch/arm64/include/generated/asm/softirq_stack.h
[load]       WRAP    arch/arm64/include/generated/asm/switch_to.h
[load]       WRAP    arch/arm64/include/generated/asm/trace_clock.h
[load]       WRAP    arch/arm64/include/generated/asm/unaligned.h
[load]       WRAP    arch/arm64/include/generated/asm/vga.h
[load]       GEN     arch/arm64/include/generated/asm/cpucaps.h
[load]       CC      scripts/mod/empty.o
[load]       HOSTCC  scripts/mod/mk_elfconfig
[load]       MKELF   scripts/mod/elfconfig.h
[load]       HOSTCC  scripts/mod/modpost.o
[load]       CC      scripts/mod/devicetable-offsets.s
[load]       UPD     scripts/mod/devicetable-offsets.h
[load]       HOSTCC  scripts/mod/file2alias.o
[load]       HOSTCC  scripts/mod/sumversion.o
[load]       HOSTLD  scripts/mod/modpost
[load]       CC      kernel/bounds.s
[load]     /bin/sh: 1: bc: not found
[load]     
[load]     make[1]: *** [Kbuild:24: include/generated/timeconst.h] Error 127
[load]     
[load]     make: *** [Makefile:1255: prepare0] Error 2
[load]     
[load]     make: Leaving directory '/tmp/tmp.635xJF3OgQ'
[load]     Removing intermediate container 7cea94e1b099
[load]     The command '/bin/sh -c ./build.sh -s raspberrypi4-64 -v $OS_VERSION -i $SRC_DIR -o $OUT_DIR' returned a non-zero code: 2

goedonsopjani avatar Apr 30 '24 11:04 goedonsopjani

The error says you're missing the bc package:

[load]     /bin/sh: 1: bc: not found

aschen-builder avatar May 01 '24 09:05 aschen-builder

Thank you, it builds.

I want to install v4l2loopback.

Can you help me somehow to install it inside balena container?

goedonsopjani avatar May 01 '24 11:05 goedonsopjani