On Having Built Linux for a Small System


Explanation: Config/lxheaders/v2.0.40.mak

${EXTTEMP}/linux-${VERSION}/.configured:
	${MAKE} extract LIST="$(strip ${SOURCES})"
	( cd ${EXTTEMP}/linux-${VERSION} || exit 1 ;\
		sed 's%dev/tty%dev/stdin%' scripts/Configure > scripts/Configure.auto || exit 1 ;\
		[ -r Makefile.OLD ] || mv Makefile Makefile.OLD ;\
		cat Makefile.OLD \
			| sed	' /^HOSTCC/	s%gcc%'${NATIVE_GCC}'% ; /[(]CROSS_COMPILE[)]/	s%$$(CROSS_COMPILE)%$$(shell if [ -n "$${CROSS_COMPILE}" ] ; then echo $${CROSS_COMPILE} ; else echo "'`echo ${HTC_GCC} | sed 's/gcc$$//'`'" ; fi)% ; /^	/ s%scripts/Configure%scripts/Configure.auto% ' > Makefile || exit 1 ;\
	) || exit 1
	touch ${EXTTEMP}/linux-${VERSION}/.configured

${EXTTEMP}/linux-${VERSION}/.built: ${EXTTEMP}/linux-${VERSION}/.configured
	(	cd ${EXTTEMP}/linux-${VERSION} || exit 1 ;\
		echo "*** MAKE [kernel] mrproper,etc... ***" ;\
			make ARCH=${TARGET_CPU} \
			  mrproper \
			  include/linux/version.h \
			  symlinks || exit 1 ;\
		touch include/linux/autoconf.h ;\
		case "${TARGET_CPU}-${VERSION}" in \
		i386-2.0.40) \
			sed	' /^CONFIG_M.86/	s/^/# / ; /CONFIG_M386/		s/^# // ; /^CONFIG.*not set/	s/ is not set/=y/ ; /^#.*=y/		s/=y/ is not set/ ' arch/i386/defconfig > .config || exit 1 ;\
		;; \
		i386-2.4.x) \
			sed	' /CONFIG_MPENT*/	s/^/# / ; /CONFIG_M386/		s/^# // ; /^CONFIG.*not set/	s/ is not set/=y/ ; /^#.*=y/		s/=y/ is not set/ ' arch/i386/defconfig > .config || exit 1 ;\
		;; \
		mips-2.4.x) \
			cp arch/mips/defconfig-ip22 .config || exit 1 ;\
		;; \
		*) \
			echo "Unexpected TARGET_CPU '${TARGET_CPU}' or VERSION '${VERSION}'" 1>&2 ;\
			exit 1 \
		;; \
		esac ;\
		echo "*** MAKE [kernel] oldconfig... ***" ;\
		yes '' | ${MAKE} ARCH=${TARGET_CPU} oldconfig || exit 1 ;\
		mkdir -p ${XTC_ROOT}/etc || exit 1 ;\
		cp .config ${XTC_ROOT}/etc/linux-${VERSION}-config || exit 1 ;\
		echo "*** MAKE [kernel] dep... ***" ;\
		${MAKE} dep || exit 1 \
	) || exit 1
	touch ${EXTTEMP}/linux-${VERSION}/.built \

.PHONY: install-xtc
install-xtc: ${EXTTEMP}/linux-${VERSION}/.built
	(	cd ${EXTTEMP}/linux-${VERSION} || exit 1 ;\
		mkdir -p ${XTC_ROOT}/usr/${TARGET_SPEC}/include ;\
		( cd ${EXTTEMP}/linux-${VERSION}/include/ > /dev/null && tar cvf - asm asm-${TARGET_CPU} linux ) | ( cd ${XTC_ROOT}/usr/${TARGET_SPEC}/include/ && tar xf - ) ;\
		mkdir -p ${XTC_ROOT}/usr/${TARGET_SPEC}/src/linux-${VERSION} ;\
		( cd ${XTC_ROOT}/usr/${TARGET_SPEC}/src && ln -sf linux-${VERSION} linux ) || exit 1 ;\
		tar cvf - ./ | ( cd ${XTC_ROOT}/usr/${TARGET_SPEC}/src/linux && tar xvf - ) \
	) || exit 1