# Recipe for Linux 2.6.10 by Lucas Correia Villa Real
# Recipe for Linux 2.6.10 by Lucas Correia Villa Real
compile_version=1.7.1
url="http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.bz2"
file_size=36533484
file_md5=cffcd2919d9c8ef793ce1ac07a440eda

# Will not use a different directory for it, so just keep the default
# dir=

# Recipe type
recipe_type=makefile

# Targets
build_target="all"
install_target="modules_install"

sandbox_options=(
	"--no-sandbox"
)

pre_build() {
	ln -nfs $goboModules/$version-Gobo /lib/modules
	[ ! -f .config ] && {
		[ ! -f $goboStatus/config.gz ] && {
			cp "$recipedir"/dot-config .config
		} || {
			cp $goboStatus/config.gz .
			gzip -d config.gz && mv config .config
			yes "" | make oldconfig
		}
	}
	make menuconfig
}

post_install() {
	#
	# This is arch-dependent. It should be preferred to parse .config
	# and discover the architecture, but this is ok for now.
	#
	count=`ls $goboBoot/kernel-$version* 2> /dev/null | sort -n | wc -l | awk '{print $1}'`
	[ "$count" = "0" ] && {
		suffix="-Gobo"
	} || {
		let count="$count"+1
		suffix="-$count-Gobo"
	}
	
	# Copy and symlink the kernel image
	cp arch/i386/boot/bzImage $goboBoot/kernel-$version$suffix
	cp System.map $goboBoot/System.map-$version$suffix
	
	ln -sf kernel-$version$suffix $goboBoot/kernel
	ln -sf System.map-$version$suffix $goboBoot/System.map
	ln -nfs $goboModules/$version-Gobo $goboModules/Current
}
