kernel compiling in woof-ce

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
stemsee

kernel compiling in woof-ce

#1 Post by stemsee »

Sukk (stems unattended kernel kit) derived from woof-ce kernel kit by Iguleder > 01micko: builds x64 i686-pae and i486-nopae kernels (consecutively), or official .deb image/kernel packages.

EDIT: SUKK-2 is now available. Re-organised code and directory structures. No separate build.conf files to fiddle with. Builds 3x and 4x and 5x kernels, with support upto aufs9.

Completed packages will be in dist/packages

SUKK directory struture is flat
SUKK/vanilla contains downloaded kernels, firmware and aufs tar balls
SUKK/patches contains er patches
SUKK/configs_extra contains the .config files after configuration of recent kernel compile effort
SUKK/configs_extra_user contains DOTconfig-64, DOTconfig-pae, and DOTconfig-nopae
these could be variations of the same arch/kernel .... three 64 bit kernels etc
## SUKK/debs contains the initrd image.deb and kernel.deb packages incase of building official debian package. Need to add options to build also three consecutive kernels for .deb. ## no longer supported
SUKK/dist/ contains packages/ packages64/ packages-nopae/ packages-pae/ containing Huge*.tar.bz2 md5.txt kernel-modules.sfs* vmlinuz* kernel_sources*.sfs for the compiled kernel.

Firmware bundles (big or small) prepared by 01micko can be downloaded, if not already there, otherwise will be copied from running system if not.

Non-free firmware can be removed by librefree script.

I want to add basic cross compiling support for arm, even though I was advised not to!

TO USE unarchive and enter SUKK on a linux formatted partition ext2/3/4 or on ntfs/fat formatted partitions create a non-system savefile (use mksavefile script by me) on the alien formatted partition, and mount the savefile (mount /mnt/sda1/compiling.4fs /mnt/compiling) and move SUKK directory to /mnt/compiling and compile as usual. etc

open terminal in directory or cd into it, then

Code: Select all

./nubuild.sh
Follow prompts, kernel version is the only obligatory info needed to be entered.

Better to select option 2) makemenuconfig to update date default configs.

press keys 'ctrl+c' while terminal has focus to abort compile at anytime.

regards
stemsee
Attachments
SUKK.tar.bz2
real archive
SUKK-3 2019
(196.78 KiB) Downloaded 442 times
SUKK-2_April-2017.tar.gz
(119.2 KiB) Downloaded 795 times
Last edited by stemsee on Mon 18 Nov 2019, 16:58, edited 6 times in total.

stemsee

#2 Post by stemsee »

Needs Testers. Probably best to leave it running over night.
EDIT: 06/12/14
Last edited by stemsee on Sun 07 Dec 2014, 11:03, edited 1 time in total.

stemsee

#3 Post by stemsee »

Ok I have ironed aout a few more bugs, however in order for this to work over the long run it will be necessary to download up-to-date DOTconfig files which have been configured for new kernel features, otherwise the script will not be unattended, unless

Code: Select all

make allyesconfig
Actually the config file is no -j6, until i test for single or dual core/thread cpu.

test

Code: Select all

sh-4.3# cores=`cat /proc/cpuinfo | grep 'cpu cores' | cut -f3 -d ' ' | tr '\n' ' ' | cut -f1 -d ' '`

stemsee

#4 Post by stemsee »

Here is the script so far. You can appreciate it takes hours to test it. So if anyone wants to work on this with me, welcome!

Code: Select all

#!/bin/bash
# originally by Iguleder
# hacked to DEATH by 01micko
# re-hacked by stemsee to provide unattended version, which auto-builds 
#32bit-pae then 64bit then 32bit-nopae kernels and modules consecutively.
# see /usr/share/doc/legal NO WARRANTY, NO responsibility accepted

CWD=`pwd`

#if [[  -e dist/packages/linux_kernel-* ]]; then
#rename packages packages32-pae dist/packages
#touch /tmp/32-pae
#mkdir -p dist/packages
#elif [[ ! -d dist/packages32-pae && ! -d dist/packages/linux_kernel-* ]]; then
#mkdir -p dist/packages
#elif [[ -d dist/packages32-pae && -d dist/packages/linux_kernel-* ]]; then
#rename packages packages64 dist/packages
#touch /tmp/64
#mkdir -p dist/packages
#elif [[  -d dist/packages32-pae &&  -d dist/packages64 && ! -e  dist/packages32-nopae ]]; then
#rename packages packages32-nopae dist/packages
#exit
#fi


if [[ -e /tmp/32-pae && -e /tmp/32-nopae && -e /tmp/64 ]]; then
echo "32bit-pae 64bit and 32bit-no-pae kernels built."
#rm /tmp/32-pae
#rm /tmp/64
#rm  /tmp/32-nopae
exit
fi


if [[ ! -e /tmp/32-pae && ! -d dist/packages32-pae ]]; then
. ./build32-pae.conf
elif [[ -e /tmp/32-pae && ! -e /tmp/64 && ! -d dist/packages64 ]]; then
. ./build64.conf
elif [[ -e /tmp/64  && ! -e /tmp/32-nopae && ! dist/packages32-nopae ]]; then
. ./build32-nopae.conf
elif [[ -e /tmp/32-pae &&  -d dist/packages32-pae && -e /tmp/64 &&  -d dist/packages64 && -e /tmp/32-nopae && -d dist/packages32-nopae ]]; then
exit
fi

if [ "$1" = "" ];then
	echo -en "\033[1;35m""WARNING" #purple?
	echo -en "\033[0m" #reset
	echo ": This will delete aufs, kernel folder but wont touch configs or dist."
	sleep 2
	echo "Please wait..."
	rm -rf ./{aufs*,linux*,kernel*,build.log*}
	echo "Cleaning complete"
fi
if [[ -d ./aufs* ]];then
	echo "This is not a clean kit."
	echo " CTRL+C to quit"
	read notcleango
fi

FW_URL=${FW_URL:-http://distro.ibiblio.org/puppylinux/firmware}
package_name_suffix=$package_name_suffix
custom_suffix=$custom_suffix
kernel_version=$kernel_version
kernel_mirror=$kernel_mirror

# depcheck
echo "Dependency check..."
if git --version &>/dev/null
	then echo -e "\033[1;32m""git is installed" #green 
else echo -e "\033[1;31m""git is not installed""\033[0m" && exit #red
fi
if gcc --version &>/dev/null
	then echo -e "\033[1;32m""gcc is installed" 
else
   echo -e "\033[1;31m""gcc is not installed""\033[0m" && exit
fi
MKSQ="$(which mksquashfs)"
if [ "$MKSQ" ]
	then 
   echo -e "\033[1;32m""mksquashfs is installed"
else #yellow
   echo -e "\033[1;30m""mksquashfs is not installed but you can continue"
fi
echo -e "\033[0m" #reset to original

# .configs
[ -f /tmp/kernel_configs ] && rm -f /tmp/kernel_configs

CONFIGS=$(ls ./configs_extra)

# list
echo "Choose a number of the config you want to try"
NUM=1
for C in $CONFIGS
  do echo "${NUM}. $C" >> /tmp/kernel_configs
  NUM=$(($NUM + 1))
  done
echo "z. Custom DOTconfig" >> /tmp/kernel_configs
echo "d. Default DOTconfig" >> /tmp/kernel_configs  
cat /tmp/kernel_configs
echo "Enter choice"
sleep 4

	if [[ ! -e /tmp/32 && ! -e /tmp/64 ]]; then
	Chosen=3
	elif [[ -e /tmp/32-pae && ! -e /tmp/64 ]]; then
	Chosen=1
	elif [[ -e /tmp/32 && -e /tmp/64 ]]; then
	Chosen=2
	fi

Choice=$(grep "^$Chosen\." /tmp/kernel_configs|cut -d ' ' -f2)
rm -r DOTconfig
cp -af configs_extra/$Choice DOTconfig
 

# the aufs major version
aufs_version=${kernel_version%%.*}
# get the major version (2.6.32 in the case of 2.6.32.40)
kernel_major_version=$kernel_version #blah, hack for 3.x
# get the kernel branch (32 in the case of 2.6.32.40; needed to download Aufs)
kernel_branch=`echo $kernel_major_version | cut -f 2 -d .` #3.x kernels

# create directories for the results
[ ! -d dist/sources/vanilla ] && mkdir -p dist/sources/{patches,vanilla}

# get today's date
today=`date +%d%m%y`

# delete the previous log
[ -f build.log ] && rm -f build.log
[ -f build.log.tar.bz2 ] && mv -f build.log.tar.bz2

downkern () {

if [ ! -e dist/sources/vanilla/linux-$kernel_version.tar.xz ]; then
# download the kernel
echo ${kernel_version##*-}|grep -q "rc"
[ "$?" -eq 0 ] && testing=testing||testing=
	if [[ ! -f dist/sources/vanilla/linux-$kernel_version.tar.xz ]]; then
	echo "Downloading the kernel sources"
	wget -P dist/sources/vanilla $kernel_mirror/$testing/linux-$kernel_version.tar.xz --no-check-certificate > build.log 2>&1
		if [[ $? -ne 0 ]]; then
			echo "Error: failed to download the kernel sources."
			exit 1
		fi
	fi
fi
if [ -e dist/sources/vanilla/linux-$kernel_version.tar.xz ]; then
echo "Kernel Sources already there!"
fi
}
downkern

downaufs () {
	# download Aufs
if [ ! -f dist/sources/vanilla/aufs$aufs_version-$kernel_branch-git$today.tar.bz2 ]; then
		echo "Downloading the Aufs sources"
		git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git aufs$aufs_version-$kernel_branch-git$today >> build.log 2>&1

		if [[ $? -ne 0 ]]; then
			echo "Error: failed to download the Aufs sources."
			exit 1
		fi
		cd aufs$aufs_version-$kernel_branch-git$today
		if [[ "$aufsv" ]];then #new far for new kernels
		git checkout origin/aufs$aufsv >> ../build.log 2>&1
		else
		git checkout origin/aufs$aufs_version.$kernel_branch >> ../build.log 2>&1
		fi
		if [[ $? -ne 0 ]]; then
		echo "Error: failed to download the Aufs sources."
		exit 1
		fi
	rm -rf .git
	cd ..
	echo "Creating the Aufs sources tarball"
	tar -c aufs$aufs_version-$kernel_branch-git$today | bzip2 -9 > dist/sources/vanilla/aufs$aufs_version-$kernel_branch-git$today.tar.bz2

elif  [ -f dist/sources/vanilla/aufs$aufs_version-$kernel_branch-git$today.tar.bz2 ]; then
	echo "Extracting the Aufs sources"
	tar xf dist/sources/vanilla/aufs$aufs_version-$kernel_branch-git$today.tar.bz2 >> build.log 2>&1
	if [[ $? -ne 0 ]]; then
		echo "Error: failed to extract the Aufs sources."
		exit 1
	fi
fi
}
downaufs

patchaufs () {
	# patch Aufs
if [ -f aufs-allow-sfs.patch ];then #removed for K3.9 experiment
	echo "Patching the Aufs sources"
	patch -d aufs$aufs_version-$kernel_branch-git$today -p1 < aufs-allow-sfs.patch >> build.log 2>&1
	if [[ $? -ne 0 ]]; then
		echo "Error: failed to patch the Aufs sources."
		exit 1
	fi
	cp aufs-allow-sfs.patch dist/sources/patches
fi
if [ -f aufs-kconfig.patch ];then #special for K3.9
	echo "Patching the Aufs sources"
	patch -d aufs$aufs_version-$kernel_branch-git$today -p1 < aufs-kconfig.patch >> build.log 2>&1
	if [[ $? -ne 0 ]]; then
		echo "Error: failed to patch the Aufs sources for kconfig."
		exit 1
	fi
	cp aufs-kconfig.patch dist/sources/patches
fi
}
patchaufs

extractkern () {
	# extract the kernel
echo "Extracting the kernel sources"
tar xf dist/sources/vanilla/linux-$kernel_version.tar.* >> build.log 2>&1
if [[ $? -ne 0 ]]; then
	echo "Error: failed to extract the kernel sources."
	exit 1
	extractkern
else
echo "extracted"
fi
}
extractkern

cd linux-$kernel_version

aufspatch () {
	echo "Adding Aufs to the kernel sources"
for i in kbuild base standalone mmap; do
	patch -N -p1 < ../aufs$aufs_version-$kernel_branch-git$today/aufs$aufs_version-$i.patch >> ../build.log 2>&1
	if [[ $? -ne 0 ]]; then
		echo "WARNING: failed to add some Aufs patches to the kernel sources."
		echo "Check it manually and either CRTL+C to bail or hit enter to go on"
		sleep 4
	fi
done
}
aufspatch

cp -r ../aufs$aufs_version-$kernel_branch-git$today/{fs,Documentation} .
cp ../aufs$aufs_version-$kernel_branch-git$today/include/linux/aufs_type.h include/linux 2>/dev/null
cp ../aufs$aufs_version-$kernel_branch-git$today/include/uapi/linux/aufs_type.h include/linux 2>/dev/null
[ -d ../aufs$aufs_version-$kernel_branch-git$today/include/uapi ] && \
cp -r ../aufs$aufs_version-$kernel_branch-git$today/include/uapi/linux/aufs_type.h include/uapi/linux

echo "Resetting the minor version number"
cp Makefile Makefile-orig
sed -i "s/^EXTRAVERSION =/EXTRAVERSION = $custom_suffix/" Makefile
diff -up Makefile-orig Makefile > ../dist/sources/patches/extra-version.patch
rm Makefile-orig

#echo "Reducing the number of consoles"
#if [ "$kernel_branch" -ge 12 ]; then
 #if [[ "${kernel_version%%.*}" -ge 3 -a "$kernel_branch" -ge 16 ]]; then
	 cp kernel/printk/printk.c kernel/printk/printk.c.orig
	 sed -i s/'#define MAX_CMDLINECONSOLES 8'/'#define MAX_CMDLINECONSOLES 5'/ kernel/printk/printk.c
	 diff -up kernel/printk/printk.c.orig kernel/printk/printk.c > ../dist/sources/patches/less-consoles.patch
	
	 echo "Reducing the verbosity level"
	 cp -f include/linux/printk.h include/linux/printk.h.orig
	 sed -i s/'#define CONSOLE_LOGLEVEL_DEFAULT 7 \/\* anything MORE serious than KERN_DEBUG \*\/'/'#define CONSOLE_LOGLEVEL_DEFAULT 3 \/\* anything MORE serious than KERN_ERR \*\/'/ include/linux/printk.h
	 diff -up include/linux/printk.h.orig include/linux/printk.h > ../dist/sources/patches/lower-verbosity.patch
 #else
	 #cp kernel/printk/printk.c kernel/printk/printk.c.orig
	 #sed -i s/'#define MAX_CMDLINECONSOLES 8'/'#define MAX_CMDLINECONSOLES 5'/ kernel/printk/printk.c
	 #diff -up kernel/printk/printk.c.orig kernel/printk/printk.c > ../dist/sources/patches/less-consoles.patch
	
	 #echo "Reducing the verbosity level"
	 #cp -f kernel/printk/printk.c kernel/printk/printk.c.orig
	 #sed -i s/'#define DEFAULT_CONSOLE_LOGLEVEL 7 \/\* anything MORE serious than KERN_DEBUG \*\/'/'#define DEFAULT_CONSOLE_LOGLEVEL 3 \/\* anything MORE serious than KERN_ERR \*\/'/ kernel/printk/printk.c
	 #diff -up kernel/printk/printk.c.orig kernel/printk/printk.c > ../dist/sources/patches/lower-verbosity.patch
  #fi
#else
 #cp kernel/printk.c kernel/printk.c.orig
 #sed -i s/'#define MAX_CMDLINECONSOLES 8'/'#define MAX_CMDLINECONSOLES 5'/ kernel/printk.c
 #diff -up kernel/printk.c.orig kernel/printk.c > ../dist/sources/patches/less-consoles.patch

 #echo "Reducing the verbosity level"
 #cp -f kernel/printk.c kernel/printk.c.orig
 #sed -i s/'#define DEFAULT_CONSOLE_LOGLEVEL 7 \/\* anything MORE serious than KERN_DEBUG \*\/'/'#define DEFAULT_CONSOLE_LOGLEVEL 3 \/\* Puppy linux hack \*\/'/ kernel/printk.c
 #diff -up kernel/printk.c.orig kernel/printk.c > ../dist/sources/patches/lower-verbosity.patch
#fi

patches () {
for patch in ../patches/*; do
	echo "Applying $patch"
	patch -p1 < $patch >> ../build.log 2>&1
	if [[ $? -ne 0 ]]; then
		echo "Error: failed to apply $patch on the kernel sources."
		exit 1
	fi
	cp $patch ../dist/sources/patches
done
}
patches

cleaningsrc () {
echo "Cleaning the kernel sources"
make clean
make mrproper
find . -name '*.orig' -delete
find . -name '*.rej' -delete
find . -name '*~' -delete
cp ../DOTconfig .config
}
cleaningsrc

#pause to configure
configure () {
echo "You now should configure your kernel. The supplied .config is
already configured but you may want to make changes, plus the date 
should be updated. You can choose to run \"make menuconfig\" for
an ncurses based gui (recommended if you don't change stuff or
for advanced users)

1. make olddefconfig
s) skip"
echo
sleep 4
kernelconfig=1
case $kernelconfig in
1) make olddefconfig;;
s)echo "skipping";;
esac
echo
echo "Ok, kernel is configured. CTRL+C to quit"
sleep 4

[ ! -d ../dist/packages ] && mkdir -p ../dist/packages
}
configure
krnheads () {
	echo "Creating the kernel headers package"
make headers_check >> ../build.log 2>&1
make INSTALL_HDR_PATH=kernel_headers-$kernel_major_version-$package_name_suffix/usr headers_install >> ../build.log 2>&1
find kernel_headers-$kernel_major_version-$package_name_suffix/usr/include \( -name .install -o -name ..install.cmd \) -delete
mv kernel_headers-$kernel_major_version-$package_name_suffix ../dist/packages
}
krnheads

krncompile () {
echo "Compiling the kernel"
cores=`cat /proc/cpuinfo | grep 'cpu cores' | cut -f3 -d ' ' | tr '\n' ' ' | cut -f1 -d ' '`
if [[ $cores -ge 2 ]]; then
make -d -j6
else
make -d
fi
if [[ ! -f arch/x86/boot/bzImage || ! -f System.map ]]; then
	echo "Error: failed to compile the kernel sources."
	exit 1
fi
cp .config ../dist/sources/DOTconfig-$kernel_version-
}

krncompile
echo "Creating the kernel package"
make INSTALL_MOD_PATH=linux_kernel-$kernel_major_version-$package_name_suffix modules_install >> ../build.log 2>&1
rm -f linux_kernel-$kernel_major_version-$package_name_suffix/lib/modules/${kernel_major_version}$custom_suffix/{build,source}
mkdir -p linux_kernel-$kernel_major_version-$package_name_suffix/boot
mkdir -p linux_kernel-$kernel_major_version-$package_name_suffix/etc/modules
cp .config linux_kernel-$kernel_major_version-$package_name_suffix/etc/modules/DOTconfig-$kernel_version-
cp arch/x86/boot/bzImage linux_kernel-$kernel_major_version-$package_name_suffix/boot/vmlinuz
BZIMAGE=`find . -type f -name bzImage`
cp System.map linux_kernel-$kernel_major_version-$package_name_suffix/boot/
cp linux_kernel-$kernel_major_version-$package_name_suffix/lib/modules/${kernel_major_version}$custom_suffix/{modules.builtin,modules.order} \
 linux_kernel-$kernel_major_version-$package_name_suffix/etc/modules/
 mkdir -p ../dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix/{lib,etc/modules}
[ "$FD" = "1" ] || \
mv linux_kernel-$kernel_major_version-$package_name_suffix/lib/modules/${kernel_major_version}$custom_suffix/modules* ../dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix/lib/
mv linux_kernel-$kernel_major_version-$package_name_suffix ../dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix/etc/modules/

if [ "$FD" = "1" ];then #make fatdog kernel module package
	mv ../dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix/boot/vmlinuz ../dist/packages/vmlinuz-$kernel_major_version-$package_name_suffix/vmlinuz-${kernel-major-version}$custom_suffix
	[ -f ../dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix/boot/bzImage ] &&
rm -f ../dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix/boot/bzImage
	echo "Huge kernel $kernel_major_version-$package_name_suffix is ready in dist"
fi

echo "Cleaning the kernel sources"
make clean >> ../build.log 2>&1
make prepare >> ../build.log 2>&1

cd ..

echo "Creating a kernel sources SFS"
mkdir -p kernel_sources-$kernel_major_version-$package_name_suffix/usr/src
mv linux-$kernel_version kernel_sources-$kernel_major_version-$package_name_suffix/usr/src/linux
mkdir -p kernel_sources-$kernel_major_version-$package_name_suffix/lib/modules/${kernel_major_version}$custom_suffix
ln -s /usr/src/linux kernel_sources-$kernel_major_version-$package_name_suffix/lib/modules/${kernel_major_version}$custom_suffix/build
[ ! -f kernel_sources-${kernel_major_version}-$package_name_suffix/usr/src/linux/include/linux/version.h ] && \
ln -s /usr/src/linux/include/generated/uapi/linux/version.h kernel_sources-${kernel_major_version}-$package_name_suffix/usr/src/linux/include/linux/version.h 
ln -s /usr/src/linux kernel_sources-$kernel_major_version-$package_name_suffix/lib/modules/${kernel_major_version}$custom_suffix/source
mksquashfs kernel_sources-$kernel_major_version-$package_name_suffix dist/sources/kernel_sources-$kernel_major_version-$package_name_suffix.sfs $COMP

# build aufs-utils userspace modules
echo "Now to build the aufs-utils for userspace"
if [ ! -f dist/sources/vanilla/aufs-util${today}.tar.bz2 ];then
	git clone git://aufs.git.sourceforge.net/gitroot/aufs/aufs-util.git aufs-util >> build.log 2>&1
	[[ $? -ne 0 ]] && echo "Failed to get aufs-util from git, do it manually. Kernel is compiled OK :)" && exit
	
	cd aufs-util
	
	git branch -a | grep 'aufs3' |grep -v 'rcN' | cut -d '.' -f2 > /tmp/aufs-util-version #we go for stable only
	while read line
	  do 
	    if [[ "$kernel_branch" = "$line" ]];then branch=$line
	    else
	      while [[ "$kernel_branch" -gt "$line" ]]
	        do branch=$line
	        echo $branch && break
	        done 
	    fi
	  done < /tmp/aufs-util-version
	git checkout origin/aufs3.${branch} >> ../build.log 2>&1
	
	[[ $? -ne 0 ]] && echo "Failed to get aufs-util from git, do it manually. Kernel is compiled OK :)" && exit
	echo "Patching aufs-util sources"
	cp Makefile Makefile.orig
	sed -i 's/-static //' Makefile
	diff -ru Makefile.orig Makefile > ../dist/sources/patches/aufs-util-dynamic.patch
	rm *.orig
	else
	echo "Extracting the Aufs-util sources"
	tar xf dist/sources/vanilla/aufs-util$today.tar.bz2 >> ../build.log 2>&1
	if [[ $? -ne 0 ]]; then
		echo "Error: failed to extract the aufs-util sources."
		exit 1
	fi	
	cd aufs-util	
	patch -p1 < ../dist/sources/patches/aufs-util-dynamic.patch >> ../build.log 2>&1
	[[ "$?" -ne 0 ]] && echo "Failed to patch the aufs-util sources, do it manually. Kernel is compiled ok"
fi
arch=`uname -m`
CONFIG=`find $CWD/dist/sources -type f -name 'DOTconfig*'`
grep -q 'CONFIG_AUFS_FHSM=y' $CONFIG
[[ "$?" -eq 0 ]] && export MAKE=make || export MAKE="make BuildFHSM=no"
LinuxSrc=`find $CWD -type d -name 'kernel_headers*'`
export CPPFLAGS="-I $LinuxSrc/usr/include"
$MAKE >> ../build.log 2>&1
[[ $? -ne 0 ]] && echo "Failed to compile aufs-util, do it manually. Kernel is compiled OK :)"
make DESTDIR=$CWD/dist/packages/aufs-util-$kernel_version-$arch install >> ../build.log 2>&1 #maybe needs absolute path
make clean >> ../build.log 2>&1
if [[ "$arch" = "x86_64" ]];then
 mv $CWD/dist/packages/aufs-util-$kernel_version-$arch/usr/lib \
$CWD/dist/packages/aufs-util-$kernel_version-$arch/usr/lib64
fi
echo "aufs-util-$kernel_version is in dist"
cd ..
if [[ "$FD" = "1" ]];then #shift aufs-utils to kernel-modules.sfs
	echo "Installing aufs-utils into kernel package"
	cp -a dist/packages/aufs-util-$kernel_version-$arch/* \
	dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix
	cp -r /lib/firmware dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix/lib/
	mksquashfs dist/packages/linux_kernel-$kernel_major_version-$package_name_suffix dist/packages/kernel-modules.sfs-$kernel_major_version-$package_name_suffix $COMP
	[[ "$?" = 0 ]] && echo "Huge compatible kernel packages are ready to package./" || exit 1
	echo "Packaging huge-$kernel_major_version-$package_name_suffix kernel"
	cd dist/packages/
	tar -cjvf huge-$kernel_major_version-${package_name_suffix}.tar.bz2 \
	vmlinuz-$kernel_major_version-$package_name_suffix kernel-modules.sfs-$kernel_major_version-$package_name_suffix
	[[ "$?" = 0 ]] && echo "huge-$kernel_major_version-${package_name_suffix}.tar.bz2 is in dist/packages" || exit 1
	md5sum huge-$kernel_major_version-${package_name_suffix}.tar.bz2 > huge-$kernel_major_version-${package_name_suffix}.tar.bz2.md5.txt
	echo
	cd $CWD
	
fi

tar -c aufs-util | bzip2 -9 > dist/sources/vanilla/aufs-util$today-$-$arch.tar.bz2

echo "Compressing the log"
bzip2 -9 build.log
cp build.log.bz2 dist/sources

echo "Done!"
if [[ -e /tmp/32-nopae ]]; then
exit
elif [[ -e /tmp/64 ]]; then
touch /tmp/32-nopae
elif [[ -e /tmp/32-pae && ! -e /tmp/64 ]]; then
touch /tmp/64
elif [[ ! -e /tmp/32-pae ]]; then
touch /tmp/32-pae
fi

[ -f /usr/share/sounds/2barks.au ] && aplay /usr/share/sounds/2barks.au

if [[ -e /tmp/32-pae && ! -e /tmp/64 ]]; then
rename packages packages32-pae dist/packages
mkdir dist/packages
if [[ -e /tmp/32-pae &&  -e /tmp/64 ]]; then
rename packages packages64 dist/packages
mkdir dist/packages
if [[ -e /tmp/32-nopae &&  -e /tmp/64 ]]; then
rename packages packages32-nopae dist/packages
exit
fi
cd $CWD
./ubuild.sh
exit
Attachments
stemskernelkit(1).zip
added patches dir ...
(113.07 KiB) Downloaded 1010 times
Last edited by stemsee on Wed 21 Jan 2015, 23:39, edited 3 times in total.

l0wt3ch
Posts: 182
Joined: Thu 24 Apr 2014, 01:30

#5 Post by l0wt3ch »

Here is the output when I tried it, without me pressing any keys after selecting a config:

Code: Select all

# ./ubuild.sh
WARNING: This will delete aufs, kernel folder but wont touch configs or dist.
Please wait...
Cleaning complete
Dependency check...
git is installed
gcc is installed
mksquashfs is installed

Choose a number of the config you want to try
1. DOTconfig-3.14.25-64
2. DOTconfig-3.14.25-pae
3. DOTconfig-3.17.4-64
4. DOTconfig-3.17.4-nopae
5. DOTconfig-3.17.4-pae
z. Custom DOTconfig
d. Default DOTconfig
Enter choice
rm: cannot remove ‘DOTconfig’: No such file or directory
Downloading the kernel sources
2
Kernel Sources already there!
Downloading the Aufs sources
Creating the Aufs sources tarball
Extracting the kernel sources
extracted
Adding Aufs to the kernel sources
WARNING: failed to add some Aufs patches to the kernel sources.
Check it manually and either CRTL+C to bail or hit enter to go on
Resetting the minor version number
Reducing the verbosity level
Applying ../patches/*
./ubuild.sh: line 292: ../patches/*: No such file or directory
Error: failed to apply ../patches/* on the kernel sources.
# 2
bash: 2: command not found

stemsee

#6 Post by stemsee »

added the patches dir. Should be unattended, ie don't select anything, until the logic is improved to allow user input as well.

l0wt3ch
Posts: 182
Joined: Thu 24 Apr 2014, 01:30

#7 Post by l0wt3ch »

Looks like it worked... :D

Attached the build.log file.
Attachments
build.log.bz2
(28.27 KiB) Downloaded 956 times

stemsee

#8 Post by stemsee »

I scanned the build log..... but I think it built only one kernel, not three. Also when I did it packages do not end up in the assigned locations. Although they are all in the sources. The script (original) gets messy, and I cannot follow it clearly. 'exit' needs to be removed from the end of the script. Not sure how to make the script call itself, maybe I will just make it into a function and call the function 3 times!

stemsee

#9 Post by stemsee »

The function idea didn't work! Guess I will have to copy the script appended to itself twice more.

stemsee

#10 Post by stemsee »

reworked base script. Not tested ... who wants to be first.
Builds 64 bit first then pae then non-pae

Known issues: Everything gets compiled but squashed with sources.
Last edited by stemsee on Mon 18 Nov 2019, 18:07, edited 1 time in total.

stemsee

#11 Post by stemsee »

I just ran this script and got three kernels compiled. However the packages were copied to $kernel_version/etc/$kernel_version/* but everything is there, so should be easy to sort out the last few bugs.

EDIT: ALso need to update .config scripts so as not to get any prompts during compilation. I thought 'make olddefconfig' would sort that out but maybe I didn't copy the apropriate DOTconfig to .config.old first!

stemsee

#12 Post by stemsee »

Here is kernel-3.18.3-pae . i am posting from it now!! Compiled 2nd in the script.

https://drive.google.com/folderview?id= ... sp=sharing

stemsee

#13 Post by stemsee »

Updated the script (needs testing), removed duplicate sources mksquashfs, left only one after final kernel is compiled, remove duplicate patching etc. Changed path errors (hopefully).
Last edited by stemsee on Mon 18 Nov 2019, 18:07, edited 1 time in total.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#14 Post by amigo »

That's pretty long there -I should have showed you how to make the script re-run itself, with:
exec $0 (options)

stemsee

#15 Post by stemsee »

That would have been useful, but actually the script is more versatile stretched out! Did you try it?

stemsee

#16 Post by stemsee »

Here is the latest. 'make olddefconfig' resorts to arch/x86/configs/* for a default config so I needed the script to copy the DDOTconfigs there too so as not to get a prompt.

DOTconfigs now up to date with 3.18.3 features. The no-pae config, no-smp, 4g, 300mhz, i486.
pae and x86_64 smp=8cpus, 1000mhz, i686.

I am running the script now.
Attachments
unattended-kernel-kit.zip
(119.5 KiB) Downloaded 722 times

stemsee

#17 Post by stemsee »

OK test run reached end of first compile then tried to move non-existing file (renamed) then exited code 1.

Two bugs squashed. Script should work as expected.

To Do: Re-enable user interaction when desiring to build only one or two, not three kernels. And 'make menuconfig' real option so as to update configs (consecutively pre-compile).
Attachments
unattended-kernel-kit.zip
(119.5 KiB) Downloaded 706 times

stemsee

#18 Post by stemsee »

Uh oh!

Found another bug which prevented the script continuing. Same one as before which I thought I fixed - apparently not. But it is now!!
Attachments
unattended-kernel-kit.zip
(119.5 KiB) Downloaded 694 times

Gobbi
Posts: 255
Joined: Fri 09 Mar 2012, 14:01

#19 Post by Gobbi »

Hi, @stemsee
First I want to appologize for the stand I took on you last time I posted to you ! Due to my ignorance , I missunderstood your good advice about solving hardware related problems I have and building a specific kernel with the necessary modules. I should simply have said I lack skills to achieve that .Reading more on old posts about Puppy , helped me understand a little more what's going on until the desktop shows up.

About your kernel-kit . I gave it a go on your Emsee V2.3-Cafe Editon 64bit. It took a little less than 10 minutes to complete .798 MB built.
Then I tried it on Fatdog630 editing very little of the config files .It took a little more than 10 minutes . 832 MB built. For this last try I attached the build log .
I don't know if these builds are working , it's early for me to implement them - need more study first .
Attachments
k_kit_log.tar.gz
(149.3 KiB) Downloaded 683 times

stemsee

#20 Post by stemsee »

Hi Gobbi

We are people, fallible, impatient, lacking knowledge and experience! Learning from mistakes is our second best chance, being perfectly obedient and not making mistakes is too difficult for most of us - look at Adam!!

Here is the latest unattended-kernel-kit. With a few more 'bugs' sorted out. This should be much improved. It should take at least two hours on a newer machine; even three to four hours is not unexpected, as three kernels are being built consecutively, not in parallel.
So you can safely assume that you didn't have a successful build even of the first kernel, maybe only the kernel-headers package!

Anyway, disregard previous ubuild.sh and replace with this one. If you have already downloaded the kernel source.tar.xz it should use it without re-downloading. Make sure /tmp/64 and /tmp/32-pae and /tmp/32-nopae are deleted if you didn't restart your machine first.
Attachments
unattended-kernel-kit.zip
(120.12 KiB) Downloaded 712 times

Post Reply