18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: LGPL-2.1 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ciif [ $# -ne 1 ] ; then 58c2ecf20Sopenharmony_ci linux_header_dir=tools/include/uapi/linux 68c2ecf20Sopenharmony_cielse 78c2ecf20Sopenharmony_ci linux_header_dir=$1 88c2ecf20Sopenharmony_cifi 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cilinux_mman=${linux_header_dir}/mman.h 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciprintf "static const char *mremap_flags[] = {\n" 138c2ecf20Sopenharmony_ciregex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MREMAP_([[:alnum:]_]+)[[:space:]]+((0x)?[[:xdigit:]]+)[[:space:]]*.*' 148c2ecf20Sopenharmony_ciegrep -q $regex ${linux_mman} && \ 158c2ecf20Sopenharmony_ci(egrep $regex ${linux_mman} | \ 168c2ecf20Sopenharmony_ci sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \ 178c2ecf20Sopenharmony_ci xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MREMAP_%s\n#define MREMAP_%s %s\n#endif\n") 188c2ecf20Sopenharmony_ciprintf "};\n" 19