Skip to content

Commit

Permalink
Merge pull request #24 from bobuhiro11/cleanup
Browse files Browse the repository at this point in the history
Add scripts/prepare.bash.
  • Loading branch information
bobuhiro11 authored Oct 10, 2023
2 parents db3ca15 + 3707ae9 commit 87c18a0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
31 changes: 2 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,8 @@ QEMU_OPTS := -kernel linux-$(LINUX_VERSION)/arch/x86/boot/bzImage -m size=512 -i

.PHONY: prepare
prepare:
cat centos6.Dockerfile | sudo docker build -t buildenv-busybox -
cat ${DOCKERFILE} | sudo docker build -t buildenv-${LINUX_VERSION} -
test -d linux-${LINUX_VERSION} \
|| git clone ${GIT_URL} --depth 1 -b ${GIT_BRANCH} linux-${LINUX_VERSION}
sudo docker run --sysctl net.ipv6.conf.all.disable_ipv6=1 --cap-add=NET_ADMIN \
--rm -v $(CWD)/linux-$(LINUX_VERSION):/tmp \
buildenv-${LINUX_VERSION} \
/bin/bash -c "\
cd tmp; \
ls -la; \
cp /boot/config* .config; \
make oldconfig; \
sed -i -e 's/^CONFIG_SYSTEM_TRUSTED_KEYS=.*/CONFIG_SYSTEM_TRUSTED_KEYS=n/g' .config; \
sed -i -e 's/^CONFIG_DIGSIG.*/CONFIG_DIGSIG=n/g' .config; \
sed -i -e 's/^CONFIG_MODULE_SIG=.*/CONFIG_MODULE_SIG=n/g' .config; \
sed -i -e 's/^CONFIG_CRYPTO_SIGNATURE=.*/CONFIG_CRYPTO_SIGNATURE=n/g' .config; \
sed -i -e 's/^CONFIG_CRYPTO_SIGNATURE_DSA=.*/CONFIG_CRYPTO_SIGNATURE_DSA=n/g' .config; \
sed -i -e 's/^CONFIG_DEBUG_INFO_BTF=.*/CONFIG_DEBUG_INFO_BTF=n/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_NET=.*/CONFIG_VIRTIO_NET=y/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_RING=.*/CONFIG_VIRTIO_RING=y/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_BLK=.*/CONFIG_VIRTIO_BLK=y/g' .config; \
sed -i -e 's/^CONFIG_BLK_DEV=.*/CONFIG_BLK_DEV=y/g' .config; \
sed -i -e 's/^CONFIG_EXT2_FS=.*/CONFIG_EXT2_FS=y/g' .config; \
sed -i -e 's/^CONFIG_EXT3_FS=.*/CONFIG_EXT3_FS=y/g' .config; \
sed -i -e 's/^CONFIG_EXT4_FS=.*/CONFIG_EXT4_FS=y/g' .config; \
sed -i -e 's/^CONFIG_SYSTEM_REVOCATION_KEYS=.*/CONFIG_SYSTEM_REVOCATION_KEYS=""/g' .config; \
sed -i -e 's/^CONFIG_MODVERSIONS=.*/CONFIG_MODVERSIONS=n/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_PCI=.*/CONFIG_VIRTIO_PCI=y/g' .config; \
make modules_prepare"
./scripts/prepare.bash $(CWD) ${DOCKERFILE} ${LINUX_VERSION} \
${GIT_URL} ${GIT_BRANCH}

.PHONY: busybox/initrd
busybox/initrd:
Expand Down
37 changes: 37 additions & 0 deletions scripts/prepare.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash -x

CWD=$1
DOCKERFILE=$2
LINUX_VERSION=$3
GIT_URL=$4
GIT_BRANCH=$5

sudo bash -c "docker build -t buildenv-busybox - < centos6.Dockerfile"
sudo bash -c "docker build -t \"buildenv-${LINUX_VERSION}\" - < $DOCKERFILE"
test -d "linux-${LINUX_VERSION}" \
|| git clone "${GIT_URL}" --depth 1 -b "${GIT_BRANCH}" "linux-${LINUX_VERSION}"
sudo docker run --sysctl net.ipv6.conf.all.disable_ipv6=1 --cap-add=NET_ADMIN \
--rm -v "${CWD}/linux-${LINUX_VERSION}:/tmp" \
"buildenv-${LINUX_VERSION}" \
/bin/bash -c "\
cd tmp; \
ls -la; \
cp /boot/config* .config; \
make oldconfig; \
sed -i -e 's/^CONFIG_SYSTEM_TRUSTED_KEYS=.*/CONFIG_SYSTEM_TRUSTED_KEYS=n/g' .config; \
sed -i -e 's/^CONFIG_DIGSIG.*/CONFIG_DIGSIG=n/g' .config; \
sed -i -e 's/^CONFIG_MODULE_SIG=.*/CONFIG_MODULE_SIG=n/g' .config; \
sed -i -e 's/^CONFIG_CRYPTO_SIGNATURE=.*/CONFIG_CRYPTO_SIGNATURE=n/g' .config; \
sed -i -e 's/^CONFIG_CRYPTO_SIGNATURE_DSA=.*/CONFIG_CRYPTO_SIGNATURE_DSA=n/g' .config; \
sed -i -e 's/^CONFIG_DEBUG_INFO_BTF=.*/CONFIG_DEBUG_INFO_BTF=n/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_NET=.*/CONFIG_VIRTIO_NET=y/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_RING=.*/CONFIG_VIRTIO_RING=y/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_BLK=.*/CONFIG_VIRTIO_BLK=y/g' .config; \
sed -i -e 's/^CONFIG_BLK_DEV=.*/CONFIG_BLK_DEV=y/g' .config; \
sed -i -e 's/^CONFIG_EXT2_FS=.*/CONFIG_EXT2_FS=y/g' .config; \
sed -i -e 's/^CONFIG_EXT3_FS=.*/CONFIG_EXT3_FS=y/g' .config; \
sed -i -e 's/^CONFIG_EXT4_FS=.*/CONFIG_EXT4_FS=y/g' .config; \
sed -i -e 's/^CONFIG_SYSTEM_REVOCATION_KEYS=.*/CONFIG_SYSTEM_REVOCATION_KEYS=""/g' .config; \
sed -i -e 's/^CONFIG_MODVERSIONS=.*/CONFIG_MODVERSIONS=n/g' .config; \
sed -i -e 's/^CONFIG_VIRTIO_PCI=.*/CONFIG_VIRTIO_PCI=y/g' .config; \
make modules_prepare"

0 comments on commit 87c18a0

Please sign in to comment.