xref: /linux/arch/arm64/tools/gen-kernel-hwcaps.sh (revision 53597deca0e38c30e6cd4ba2114fa42d2bcd85bb)
1#!/bin/sh -e
2# SPDX-License-Identifier: GPL-2.0
3#
4# gen-kernel-hwcap.sh - Generate kernel internal hwcap.h definitions
5#
6# Copyright 2026 Arm, Ltd.
7
8if [ "$1" = "" ]; then
9	echo "$0: no filename specified"
10	exit 1
11fi
12
13echo "#ifndef __ASM_KERNEL_HWCAPS_H"
14echo "#define __ASM_KERNEL_HWCAPS_H"
15echo ""
16echo "/* Generated file - do not edit */"
17echo ""
18
19grep -E '^#define HWCAP[0-9]*_[A-Z0-9_]+' $1 | \
20	sed 's/.*HWCAP\([0-9]*\)_\([A-Z0-9_]\+\).*/#define KERNEL_HWCAP_\2\t__khwcap\1_feature(\2)/'
21
22echo ""
23echo "#endif /* __ASM_KERNEL_HWCAPS_H */"
24