Created
August 11, 2014 08:48
-
-
Save darth30joker/7eed5f541bc2c207e1fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
#apt-get update | |
#apt-get install -y unzip xz-utils curl bc git build-essential cpio gcc-multilib libc6-i386 libc6-dev-i386 kmod squashfs-tools genisoimage xorriso syslinux automake pkg-config | |
mkdir -p /workspace | |
export KERNEL_VERSION=3.15.3 | |
export AUFS_BRANCH=aufs3.15 | |
( cd /workspace || \ | |
wget -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-$KERNEL_VERSION.tar.xz && \ | |
xz -d linux-$KERNEL_VERSION.tar.xz && \ | |
tar xvf linux-$KERNEL_VERSION.tar && \ | |
rm -rf /linux-kernel && \ | |
mv /workspace/linux-$KERNEL_VERSION /linux-kernel ) | |
( cd /workspace && \ | |
rm -rf aufs3-standalone && \ | |
git clone --depth 1 git://git.code.sf.net/p/aufs/aufs3-standalone -b $AUFS_BRANCH ) | |
( cd /linux-kernel && \ | |
for patch in aufs3-kbuild aufs3-base aufs3-mmap aufs3-standalone; do | |
patch -p1 < /workspace/aufs3-standalone/$patch.patch; | |
done && \ | |
cp -r /workspace/aufs3-standalone/Documentation /linux-kernel && \ | |
cp -r /workspace/aufs3-standalone/fs/* /linux-kernel/fs/ && \ | |
cp -r /workspace/aufs3-standalone/include/uapi/linux/aufs_type.h /linux-kernel/include/uapi/linux/ ) | |
cp kernel_config /linux-kernel/.config | |
export jobs=$(nproc) | |
( cd /linux-kernel && \ | |
make -j ${jobs} oldconfig && \ | |
make -j ${jobs} bzImage && \ | |
make -j ${jobs} modules ) | |
export ROOTFS=/rootfs | |
export TCL_REPO_BASE=http://tinycorelinux.net/5.x/x86 | |
export TCZ_DEPS="iptables \ | |
iproute2 openssh openssl-1.0.0 \ | |
tar gcc_libs acpid xz liblzma \ | |
git expat2 libiconv libidn libgpg-error libgcrypt libssh2 \ | |
nfs-utils tcp_wrappers portmap rpcbind libtirpc \ | |
curl ntpclient" | |
mkdir -p $ROOTFS | |
# Install the kernel modules in $ROOTFS | |
( cd /linux-kernel || make INSTALL_MOD_PATH=$ROOTFS modules_install firmware_install ) | |
# Remove useless kernel modules, based on unclejack/debian2docker | |
( cd $ROOTFS/lib/modules && \ | |
rm -rf ./*/kernel/sound/* && \ | |
rm -rf ./*/kernel/drivers/gpu/* && \ | |
rm -rf ./*/kernel/drivers/infiniband/* && \ | |
rm -rf ./*/kernel/drivers/isdn/* && \ | |
rm -rf ./*/kernel/drivers/media/* && \ | |
rm -rf ./*/kernel/drivers/staging/lustre/* && \ | |
rm -rf ./*/kernel/drivers/staging/comedi/* && \ | |
rm -rf ./*/kernel/fs/ocfs2/* && \ | |
rm -rf ./*/kernel/net/bluetooth/* && \ | |
rm -rf ./*/kernel/net/mac80211/* && \ | |
rm -rf ./*/kernel/net/wireless/* ) | |
# Install libcap | |
( cd /workspace && curl -L ftp://ftp.de.debian.org/debian/pool/main/libc/libcap2/libcap2_2.22.orig.tar.gz | tar -C / -xz ) | |
( cd /workspace/libcap-2.22 && \ | |
sed -i 's/LIBATTR := yes/LIBATTR := no/' Make.Rules && \ | |
sed -i 's/\(^CFLAGS := .*\)/\1 -m32/' Make.Rules && \ | |
make && \ | |
mkdir -p output && \ | |
make prefix=`pwd`/output install && \ | |
mkdir -p $ROOTFS/usr/local/lib && \ | |
cp -av `pwd`/output/lib64/* $ROOTFS/usr/local/lib ) | |
# Make sure the kernel headers are installed for aufs-util, and then build it | |
( cd /linux-kernel && \ | |
make INSTALL_HDR_PATH=/tmp/kheaders headers_install && \ | |
cd / && \ | |
git clone git://git.code.sf.net/p/aufs/aufs-util && \ | |
cd /aufs-util && \ | |
git checkout aufs3.9 && \ | |
CPPFLAGS="-m32 -I/tmp/kheaders/include" CLFAGS=$CPPFLAGS LDFLAGS=$CPPFLAGS make && \ | |
DESTDIR=$ROOTFS make install && \ | |
rm -rf /tmp/kheaders ) | |
# Download the rootfs, don't unpack it though: | |
(cd /workspace && curl -L -o /tcl_rootfs.gz $TCL_REPO_BASE/release/distribution_files/rootfs.gz ) | |
# Install the TCZ dependencies | |
( cd /workspace && \ | |
for dep in $TCZ_DEPS; do \ | |
echo "Download $TCL_REPO_BASE/tcz/$dep.tcz" &&\ | |
curl -L -o /tmp/$dep.tcz $TCL_REPO_BASE/tcz/$dep.tcz && \ | |
unsquashfs -f -d $ROOTFS /tmp/$dep.tcz && \ | |
rm -f /tmp/$dep.tcz ;\ | |
done ) | |
cp VERSION $ROOTFS/etc/version | |
cp -r /rootfs/isolinux / | |
cp -r /rootfs/rootfs/* $ROOTFS | |
sh rootfs/make_iso.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment