Headers are reused rom the downloaded kernel. ISO image is generated in custom shell script.
This commit is prerequisite for major switch from glibc to musl.
This commit is contained in:
parent
8b96da4dbe
commit
1ca057ee0b
@ -19,5 +19,8 @@ sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal\"/" .con
|
||||
# http://unix.stackexchange.com/questions/5518/what-is-the-difference-between-the-following-kernel-makefile-terms-vmlinux-vmlinux
|
||||
make bzImage -j $(grep ^processor /proc/cpuinfo | wc -l)
|
||||
|
||||
# We need the kernel headers later, so we install them now in ./usr (this is not /usr)
|
||||
make headers_install -j $(grep ^processor /proc/cpuinfo | wc -l)
|
||||
|
||||
cd ../../..
|
||||
|
||||
|
@ -12,51 +12,19 @@ cd $(ls -d *)
|
||||
|
||||
cd musl-installed/bin
|
||||
|
||||
unlink musl-ar
|
||||
unlink musl-ar 2>/dev/null
|
||||
ln -s `which ar` musl-ar
|
||||
|
||||
unlink musl-strip
|
||||
unlink musl-strip 2>/dev/null
|
||||
ln -s `which strip` musl-strip
|
||||
|
||||
cd ../include
|
||||
|
||||
#
|
||||
# Should work with headers from the newly downloaded kernel
|
||||
# but it diesn't work. Damn!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
#
|
||||
#unlink linux
|
||||
#ln -s $WORK_KERNEL_DIR/include/linux linux
|
||||
#
|
||||
#unlink mtd
|
||||
#ln -s $WORK_KERNEL_DIR/include/linux/mtd mtd
|
||||
#
|
||||
#unlink asm
|
||||
#ln -s $WORK_KERNEL_DIR/include/uapi/asm-generic asm
|
||||
#
|
||||
#unlink asm-generic
|
||||
#ln -s $WORK_KERNEL_DIR/include/uapi/asm-generic asm-generic
|
||||
#
|
||||
#unlink uapi
|
||||
#ln -s $WORK_KERNEL_DIR/include/uapi uapi
|
||||
#
|
||||
#unlink uapi
|
||||
#ln -s $WORK_KERNEL_DIR/include/uapi uapi
|
||||
# Copy all kernel headers to musl's 'include' folder
|
||||
cp -rf $WORK_KERNEL_DIR/usr/include/* .
|
||||
|
||||
unlink linux
|
||||
ln -s /usr/include/linux linux
|
||||
|
||||
unlink mtd
|
||||
ln -s /usr/include/mtd mtd
|
||||
|
||||
if [ -d /usr/include/asm ]
|
||||
then
|
||||
unlink asm
|
||||
ln -s /usr/include/asm asm
|
||||
else
|
||||
unlink asm
|
||||
ln -s /usr/include/asm-generic asm
|
||||
fi
|
||||
|
||||
unlink asm-generic
|
||||
ln -s /usr/include/asm-generic asm-generic
|
||||
# Make sure some C structs are not defined in kernel headers if thgey are already defined in musl
|
||||
sed -i "s/^\#if.__UAPI_DEF_IN6_ADDR$/#if !defined(_NETINET_IN_H) \&\& defined(__UAPI_DEF_IN6_ADDR)/" ./linux/in6.h
|
||||
sed -i "s/^\#if.__UAPI_DEF_SOCKADDR_IN6$/#if !defined(_NETINET_IN_H) \&\& defined(__UAPI_DEF_SOCKADDR_IN6)/" ./linux/in6.h
|
||||
sed -i "s/^\#if.__UAPI_DEF_IPV6_MREQ$/#if !defined(_NETINET_IN_H) \&\& defined(__UAPI_DEF_IPV6_MREQ)/" ./linux/in6.h
|
||||
|
||||
|
@ -8,7 +8,7 @@ rm -f rootfs.cpio.gz
|
||||
cd rootfs
|
||||
|
||||
# Packs the current folder structure in "cpio.gz" archive.
|
||||
find . | cpio -H newc -o | gzip > ../rootfs.cpio.gz
|
||||
find . | cpio -R root:root -H newc -o | gzip > ../rootfs.cpio.gz
|
||||
|
||||
cd ../..
|
||||
|
||||
|
@ -1,19 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f minimal_linux_live.iso
|
||||
|
||||
cd work/kernel
|
||||
cd $(ls -d *)
|
||||
|
||||
# Edit Makefile to look for genisoimage instead of mkisofs. This was added as a
|
||||
# workaround for some "Debian" and "Arch Linux" distributions. In general this
|
||||
# fix should be harmless.
|
||||
sed -i 's/mkisofs/genisoimage/g' arch/x86/boot/Makefile
|
||||
|
||||
# Generate the ISO image with optimization for "parallel jobs" = "number of processors"
|
||||
make isoimage FDINITRD=../../rootfs.cpio.gz -j $(grep ^processor /proc/cpuinfo | wc -l)
|
||||
|
||||
cp arch/x86/boot/image.iso ../../../minimal_linux_live.iso
|
||||
|
||||
WORK_KERNEL_DIR=$(pwd)
|
||||
cd ../../..
|
||||
|
||||
rm -f minimal_linux_live.iso
|
||||
rm -rf work/isoimage
|
||||
|
||||
# This is the root folder of the ISO image
|
||||
mkdir work/isoimage
|
||||
cd work/isoimage
|
||||
|
||||
# Search and copy the files 'isolinux.bin' and 'ldlinux.c32'
|
||||
for i in lib lib64 share end ; do
|
||||
if [ -f /usr/$i/syslinux/isolinux.bin ]; then
|
||||
cp /usr/$i/syslinux/isolinux.bin .
|
||||
if [ -f /usr/$i/syslinux/ldlinux.c32 ]; then
|
||||
cp /usr/$i/syslinux/ldlinux.c32 .
|
||||
fi;
|
||||
break;
|
||||
fi;
|
||||
if [ $i = end ]; then exit 1; fi;
|
||||
done
|
||||
|
||||
# Now we copy the kernel
|
||||
cp $WORK_KERNEL_DIR/arch/x86/boot/bzImage ./kernel.bz
|
||||
|
||||
# Now we copy the root file system
|
||||
cp ../rootfs.cpio.gz ./rootfs.gz
|
||||
|
||||
# Copy all source files to "/src". Note that the scripts won't work there.
|
||||
mkdir src
|
||||
cp ../../*.sh src
|
||||
cp ../../.config src
|
||||
chmod +rx src/*.sh
|
||||
chmod +r src/.config
|
||||
|
||||
# Create ISOLINUX configuration file
|
||||
echo 'default kernel.bz initrd=rootfs.gz' > ./isolinux.cfg
|
||||
|
||||
# Now we generate the ISO image file
|
||||
genisoimage -J -r -o ../minimal_linux_live.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ./
|
||||
|
||||
# This allows the ISO image to be bootable if it is burned on USB flash drive
|
||||
isohybrid ../minimal_linux_live.iso 2>/dev/null || true
|
||||
|
||||
# Copy the ISO image to the root project folder
|
||||
cp ../minimal_linux_live.iso ../../
|
||||
|
||||
cd ../..
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user