aboutsummaryrefslogtreecommitdiff
blob: 5dd5c6bad0fcbad2d502e6b51badf354889b0194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash

get_official_arch() {
	if [ "${CMD_ARCHOVERRIDE}" != '' ]
	then
		ARCH=${CMD_ARCHOVERRIDE}
	else
		if [ "${ARCH_OVERRIDE}" != '' ]
		then
			ARCH=${ARCH_OVERRIDE}
		else
			ARCH=`uname -m`
			case "${ARCH}" in
				i?86)
					ARCH="x86"
				;;
				mips|mips64)
					ARCH="mips"
				;;
				*)
				;;
			esac
		fi
	fi

	if [ "${CMD_UTILS_ARCH}" != '' ]
	then
		UTILS_ARCH=${CMD_UTILS_ARCH}
	else
		if [ "${UTILS_ARCH}" != '' ]
		then
			UTILS_ARCH=${UTILS_ARCH}
		fi
	fi

	# sparc64 klibc is b0rked, so we force to 32
	if [ "${ARCH}" = 'sparc64' ]
	then
		UTILS_ARCH='sparc'
	fi
	
	ARCH_CONFIG="${GK_SHARE}/${ARCH}/config.sh"
	[ -f "${ARCH_CONFIG}" ] || gen_die "${ARCH} not yet supported by genkernel. Please add the arch-specific config file, ${ARCH_CONFIG}"
}

set_kernel_arch() {
	KERNEL_ARCH=${ARCH}
	case ${ARCH} in
# XXX: This doesn't seem to actually be necessary, as it still works just fine without it
#		ppc|ppc64)
#			if [ "${VER}" -eq "2" -a "${PAT}" -ge "6" ]
#			then
#				if [ "${PAT}" -eq "6" -a "${SUB}" -ge "16" ] || [ "${PAT}" -gt "6" ]
#				then
#					KERNEL_ARCH=powerpc
#				fi
#			fi
#			;;
		x86)
			if [ "${VER}" -eq "2" -a "${PAT}" -ge "6" ] || [ "${VER}" -gt "2" ]
			then
				if [ "${PAT}" -eq "6" -a "${SUB}" -ge "24" ] || [ "${PAT}" -gt "6" ]
				then
					KERNEL_ARCH=x86
				else
					KERNEL_ARCH=i386
				fi
			fi
			;;
		x86_64)
			if [ "${VER}" -eq "2" -a "${PAT}" -ge "6" ] || [ "${VER}" -gt "2" ]
			then
				if [ "${PAT}" -eq "6" -a "${SUB}" -ge "24" ] || [ "${PAT}" -gt "6" ]
				then
					KERNEL_ARCH=x86
				fi
			fi
			;;
	esac
	export KERNEL_ARCH
	print_info 2 "KERNEL_ARCH=${KERNEL_ARCH}"
}