FROM retrodebian/package-builder
RUN apt-get install -y  linux-headers-2.6.24-etchnhalf.1-686 \
                        squashfs-source-etchnhalf \
                        linux-source-2.6.24 && \
    apt-get build-dep -y linux-image-2.6.24-etchnhalf.1-686 && \
    apt-get clean 

    # Preparing Kernel + patchs + modules
WORKDIR /usr/src
COPY unionfs-2.2.3_for_2.6.24.diff.gz ./
RUN tar xjf linux-source-2.6.24.tar.bz2 && \
    tar xjf etchnhalf/squashfs.tar.bz2 && \
    ln -s linux-headers-2.6.24-etchnhalf.1-686/ linux-headers && \

# Building Kernel + patchs + modules
WORKDIR /usr/src/linux-source-2.6.24
#COPY config-kernel ./
RUN (zcat /usr/src/unionfs-2.2.3_for_2.6.24.diff.gz | patch -p1) && \
#    (cat config-kernel > .config) && \
    make oldconfig &&\
    make-kpkg --initrd --arch $ARCH kernel_headers kernel_image modules_image