1#!/bin/bash 2# 3# NAME: 4# gen-repo.sh - extract linuxized sources from the ACPICA git 5# repository 6# 7# SYNOPSIS: 8# gen-repo.sh [-c] [-n hash] <commit> 9# 10# DESCRIPTION: 11# Extract linuxized repository from the git repository. 12# Options: 13# -c Force regeneration of acpisrc. 14# -n: Specify number of digits from commit hash to form a name. 15# NOTE: Be careful using this script on a repo in detached HEAD mode. 16# 17 18usage() { 19 echo "Usage: `basename $0` [-c] [-n hash] <commit>" 20 echo "Where:" 21 echo " -c: Force regeneration of acpisrc." 22 echo " -n: Specify number of digits from commit hash to form a name" 23 echo " (default to 8)." 24 echo " commit: GIT commit (default to HEAD)." 25 exit 1 26} 27 28INDEX=0 29HASH=8 30 31while getopts "cn:" opt 32do 33 case $opt in 34 c) FORCE_ACPISRC=force;; 35 n) HASH=$OPTARG;; 36 ?) echo "Invalid argument $opt" 37 usage;; 38 esac 39done 40shift $(($OPTIND - 1)) 41 42version=`git log -1 $1 --format=%H | cut -c 1-${HASH}` 43 44SCRIPT=`(cd \`dirname $0\`; pwd)` 45. $SCRIPT/libacpica.sh 46 47GR_acpica_repo=$CURDIR/acpica-$version 48GR_linux_repo=$CURDIR/linux-$version 49 50linuxize() 51{ 52 local repo_acpica repo_linux 53 54 # Be careful with local variable namings 55 repo_acpica=$1 56 repo_linux=$2 57 58 mkdir -p $repo_linux/source 59 cp -rf $repo_acpica/source $repo_linux/ 60 61 echo "[gen-repo.sh] Converting hierarchy..." 62 linuxize_hierarchy_noref $repo_linux 63 64 echo "[gen-repo.sh] Converting format..." 65 linuxize_format $repo_linux 66} 67 68echo "[gen-repo.sh] Extracting GIT ($SRCDIR)..." 69# Cleanup 70rm -rf $GR_acpica_repo 71git clone $SRCDIR $GR_acpica_repo > /dev/null || exit 2 72 73echo "[gen-repo.sh] Creating ACPICA repository (acpica-$version)..." 74( 75 cd $GR_acpica_repo 76 git reset $version --hard >/dev/null 2>&1 77) 78 79echo "[gen-repo.sh] Generating tool (acpisrc)..." 80make_acpisrc $GR_acpica_repo $FORCE_ACPISRC > /dev/null 81 82# Cleanup 83rm -rf $GR_linux_repo 84 85echo "[gen-repo.sh] Creating Linux repository (linux-$version)..." 86linuxize $GR_acpica_repo $GR_linux_repo 87