Message ID | 89c541d2bd6259c237900c3918ca0a3cfccccb90.1487829585.git.sam.bobroff@au1.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Feb 23, 2017 at 04:59:55PM +1100, Sam Bobroff wrote: > Refactor the architecture specific code to make it easier > to add new special case files. > > There should be no change in functionality. > > Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > --- > v2: > > I've factored the script to make it easier to add new files. > > scripts/update-linux-headers.sh | 25 +++++++++++-------------- > 1 file changed, 11 insertions(+), 14 deletions(-) > > diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh > index ef11a8ab42..c75c30da1b 100755 > --- a/scripts/update-linux-headers.sh > +++ b/scripts/update-linux-headers.sh > @@ -76,28 +76,25 @@ for arch in $ARCHLIST; do > fi > > make -C "$linux" INSTALL_HDR_PATH="$tmpdir" ARCH=$arch headers_install > + ARCH_EXTRA= > + ARCH_STD_EXTRA= > + case "$arch" in > + powerpc) ARCH_EXTRA=epapr_hcalls.h ;; > + s390) ARCH_STD_EXTRA="kvm_virtio.h virtio-ccw.h" ;; > + x86) ARCH_EXTRA="unistd_32.h unistd_x32.h unistd_64.h" ARCH_STD_EXTRA="hyperv.h" ;; > + esac > > rm -rf "$output/linux-headers/asm-$arch" > mkdir -p "$output/linux-headers/asm-$arch" > - for header in kvm.h kvm_para.h unistd.h; do > + for header in kvm.h kvm_para.h unistd.h $ARCH_EXTRA; do > cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" > done > - if [ $arch = powerpc ]; then > - cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/" > - fi > > rm -rf "$output/include/standard-headers/asm-$arch" > mkdir -p "$output/include/standard-headers/asm-$arch" > - if [ $arch = s390 ]; then > - cp_portable "$tmpdir/include/asm/kvm_virtio.h" "$output/include/standard-headers/asm-s390/" > - cp_portable "$tmpdir/include/asm/virtio-ccw.h" "$output/include/standard-headers/asm-s390/" > - fi > - if [ $arch = x86 ]; then > - cp_portable "$tmpdir/include/asm/hyperv.h" "$output/include/standard-headers/asm-x86/" > - cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/" > - cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" > - cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/" > - fi > + for header in $ARCH_STD_EXTRA; do > + cp_portable "$tmpdir/include/asm/$header" "$output/include/standard-headers/asm-$arch/" > + done > done > > rm -rf "$output/linux-headers/linux"
diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index ef11a8ab42..c75c30da1b 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -76,28 +76,25 @@ for arch in $ARCHLIST; do fi make -C "$linux" INSTALL_HDR_PATH="$tmpdir" ARCH=$arch headers_install + ARCH_EXTRA= + ARCH_STD_EXTRA= + case "$arch" in + powerpc) ARCH_EXTRA=epapr_hcalls.h ;; + s390) ARCH_STD_EXTRA="kvm_virtio.h virtio-ccw.h" ;; + x86) ARCH_EXTRA="unistd_32.h unistd_x32.h unistd_64.h" ARCH_STD_EXTRA="hyperv.h" ;; + esac rm -rf "$output/linux-headers/asm-$arch" mkdir -p "$output/linux-headers/asm-$arch" - for header in kvm.h kvm_para.h unistd.h; do + for header in kvm.h kvm_para.h unistd.h $ARCH_EXTRA; do cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" done - if [ $arch = powerpc ]; then - cp "$tmpdir/include/asm/epapr_hcalls.h" "$output/linux-headers/asm-powerpc/" - fi rm -rf "$output/include/standard-headers/asm-$arch" mkdir -p "$output/include/standard-headers/asm-$arch" - if [ $arch = s390 ]; then - cp_portable "$tmpdir/include/asm/kvm_virtio.h" "$output/include/standard-headers/asm-s390/" - cp_portable "$tmpdir/include/asm/virtio-ccw.h" "$output/include/standard-headers/asm-s390/" - fi - if [ $arch = x86 ]; then - cp_portable "$tmpdir/include/asm/hyperv.h" "$output/include/standard-headers/asm-x86/" - cp "$tmpdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/" - cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" - cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/" - fi + for header in $ARCH_STD_EXTRA; do + cp_portable "$tmpdir/include/asm/$header" "$output/include/standard-headers/asm-$arch/" + done done rm -rf "$output/linux-headers/linux"
Refactor the architecture specific code to make it easier to add new special case files. There should be no change in functionality. Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com> --- v2: I've factored the script to make it easier to add new files. scripts/update-linux-headers.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-)