162306a36Sopenharmony_ci#!/bin/sh 262306a36Sopenharmony_ci# SPDX-License-Identifier: LGPL-2.1 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciif [ $# -ne 1 ] ; then 562306a36Sopenharmony_ci linux_header_dir=tools/include/uapi/linux 662306a36Sopenharmony_cielse 762306a36Sopenharmony_ci linux_header_dir=$1 862306a36Sopenharmony_cifi 962306a36Sopenharmony_ci 1062306a36Sopenharmony_cilinux_mman=${linux_header_dir}/mman.h 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ciprintf "static const char *mremap_flags[] = {\n" 1362306a36Sopenharmony_ciregex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MREMAP_([[:alnum:]_]+)[[:space:]]+((0x)?[[:xdigit:]]+)[[:space:]]*.*' 1462306a36Sopenharmony_cigrep -E -q $regex ${linux_mman} && \ 1562306a36Sopenharmony_ci(grep -E $regex ${linux_mman} | \ 1662306a36Sopenharmony_ci sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 1762306a36Sopenharmony_ci xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MREMAP_%s\n#define MREMAP_%s %s\n#endif\n") 1862306a36Sopenharmony_ciprintf "};\n" 19