summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-05-19 22:54:40 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-05-19 22:54:40 +0300
commite6955a667587dce5069ada868f831516d9faac05 (patch)
treeb42ecc968cc3646301a9075bb62c4382cb9e2537
parentcf37abf4b59405c730af52373631c8e819e1693b (diff)
Move target directory configuration to config.sh
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--arch/arm.sh1
-rw-r--r--arch/arm64.sh1
-rw-r--r--arch/x86.sh1
-rw-r--r--config.sh21
-rwxr-xr-xkbuild.sh63
-rw-r--r--platforms/gen3.sh1
-rw-r--r--platforms/imx7.sh2
-rw-r--r--platforms/omap3.sh1
-rw-r--r--platforms/omap4+.sh1
-rw-r--r--platforms/scarlet.sh1
-rw-r--r--platforms/soraka.sh1
-rw-r--r--platforms/x86.sh1
-rw-r--r--platforms/zynqmp.sh3
13 files changed, 66 insertions, 32 deletions
diff --git a/arch/arm.sh b/arch/arm.sh
index 4995c00..81393ae 100644
--- a/arch/arm.sh
+++ b/arch/arm.sh
@@ -1,2 +1 @@
-arch_dir=arm32
image_kernel=zImage
diff --git a/arch/arm64.sh b/arch/arm64.sh
index e5fbed3..0718c0a 100644
--- a/arch/arm64.sh
+++ b/arch/arm64.sh
@@ -1,2 +1 @@
-arch_dir=arm64
image_kernel=Image
diff --git a/arch/x86.sh b/arch/x86.sh
index 249a8f7..c4ec2a0 100644
--- a/arch/x86.sh
+++ b/arch/x86.sh
@@ -1,2 +1 @@
-arch_dir=x86
image_kernel=bzImage
diff --git a/config.sh b/config.sh
index cedf643..d6b6db8 100644
--- a/config.sh
+++ b/config.sh
@@ -5,3 +5,24 @@
#
cross_compile[arm]=arm-buildroot-linux-uclibcgnueabihf-
cross_compile[arm64]=aarch64-buildroot-linux-gnu-
+
+#
+# Directories
+#
+# Variable name: target_root[]
+#
+# Path to the root directory of the target file system for each architecture.
+# If set, the kernel image and DTBs are installed to $target_root[$arch]/boot,
+# and the kernel modules to $target_root[$arch]/lib/modules. Platform files can
+# override the NFS root by setting $target_dir.
+#
+target_root[arm]=$HOME/src/netboot/arm32
+target_root[arm64]=$HOME/src/netboot/arm64
+target_root[x86]=$HOME/src/netboot/x86
+#
+# Variable name: tftp_root
+#
+# Path to the root directory of the TFTP server. If set, the kernel image and
+# DTBs are installed to $tftp_root/$platform if the directory exists.
+#
+tftp_root=$HOME/tftpboot
diff --git a/kbuild.sh b/kbuild.sh
index 15e1dc7..1f530a0 100755
--- a/kbuild.sh
+++ b/kbuild.sh
@@ -6,6 +6,7 @@ set -e
kbuild_root=$(dirname $(readlink -f "$0"))
declare -A cross_compile
+declare -A target_root
if [[ -r $kbuild_root/config.sh ]] ; then
source $kbuild_root/config.sh || exit 1
@@ -15,9 +16,6 @@ fi
#kbuild_options='C=1'
kbuild_options="KALLSYMS_EXTRA_PASS=0"
-nfs_root=$HOME/src/netboot
-tftp_root=$HOME/tftpboot
-
#
# Options parsing
#
@@ -119,8 +117,15 @@ fi
source "${kbuild_root}/arch/$arch.sh" || exit 1
-target_dir=${target_dir:-${target_root[$arch]}}
-output_dir=$PWD/output/$arch_dir
+# Override the output directory for ARM for historical reasons
+case $arch in
+ arm)
+ output_dir=$PWD/output/arm32
+ ;;
+ *)
+ output_dir=$PWD/output/$arch
+ ;;
+esac
#
# Build environment and tools
@@ -141,7 +146,7 @@ if [[ -n "$opt_defconfig" ]] ; then
rm $output_dir/arch/$arch/configs/build_defconfig
fi
-if [[ $do_menu_config = 1 ]] ; then
+if [[ $do_menu_config == 1 ]] ; then
$make menuconfig
exit 0
fi
@@ -150,7 +155,7 @@ fi
# Compile documentation if requested
#
-if [[ $do_compile_doc = 1 ]] ; then
+if [[ $do_compile_doc == 1 ]] ; then
$pmake DOCBOOKS='' htmldocs
fi
@@ -185,38 +190,58 @@ else
fi
#
-# Copy the files to their destination directories
+# Copy the files to their destination directories.
+#
+# The kernel image and DTBs are copied to both $target_dir/boot and $tftp_dir
+# (if available). When the image format is CrOS, installation to $tftp_dir is
+# skipped as Chrome OS devices can't boot from TFTP.
#
+# The modules are installed to $target_dir if available, or to
+# $output_dir/modules otherwise.
+#
+
+target_dir=${target_dir:-${target_root[$arch]}}
+tftp_dir=${tftp_dir:-$tftp_root/$platform}
copy_dtbs() {
+ local dest_dir=$1
local dtb
- local target_dir=$1
+
+ if [[ $image == FIT || $image == CrOS ]] ; then
+ return
+ fi
for dtb in $dtbs ; do
local src=${dtb/:*/}
local dst=${dtb/*:/}
dst=${dst/*\//}
- cp $output_dir/arch/${ARCH}/boot/dts/$src* $target_dir/$dst
+ cp $output_dir/arch/${ARCH}/boot/dts/$src* $dest_dir/$dst
done
}
-mkdir -p $boot_dir
-cp $image_file $boot_dir/
+if [[ -d "$target_dir" ]] ; then
+ mkdir -p $target_dir/boot
+ cp $image_file $target_dir/boot/
+ copy_dtbs $target_dir/boot/
+fi
-if [[ $image != FIT && $image != CrOS ]] ; then
- copy_dtbs $boot_dir/
+if [[ $image != CrOS && -d "$tftp_dir" ]] ; then
+ cp $image_file $tftp_dir/
+ copy_dtbs $tftp_dir/
fi
-if [[ x$modules = xmodules ]] ; then
- $pmake INSTALL_MOD_PATH=$target_dir modules_install
+if [[ x$modules == xmodules ]] ; then
+ mod_path=${target_dir:-$output_dir/modules}
+ mkdir -p $mod_path
+ $pmake INSTALL_MOD_PATH=$mod_path modules_install
fi
#
# Create the Debian package if requested
#
-if [[ $do_package_deb = 1 ]] ; then
+if [[ $do_package_deb == 1 ]] ; then
$pmake bindeb-pkg
fi
@@ -225,7 +250,7 @@ fi
#
echo "Kernel image available in $image_file"
-if [[ x$modules = xmodules ]] ; then
- echo "Kernel modules installed to $target_dir/lib/modules/$version"
+if [[ x$modules == xmodules ]] ; then
+ echo "Kernel modules installed to $mod_path/lib/modules/$version"
fi
echo "Build $version completed at $(date)"
diff --git a/platforms/gen3.sh b/platforms/gen3.sh
index f7ace45..44cdacd 100644
--- a/platforms/gen3.sh
+++ b/platforms/gen3.sh
@@ -1,7 +1,6 @@
platform=gen3
dir_pattern=renesas
arch=arm64
-boot_dir=$tftp_root/gen3
dtbs="renesas/r8a7795-es1-h3ulcb.dtb renesas/r8a7795-es1-salvator-x.dtb renesas/r8a7795-h3ulcb.dtb renesas/r8a7795-h3ulcb-kf.dtb renesas/r8a7795-salvator-x.dtb renesas/r8a7795-salvator-xs.dtb renesas/r8a7796-m3ulcb.dtb renesas/r8a7796-salvator-x.dtb renesas/r8a77995-draak.dtb"
dtbs=$(cd arch/arm64/boot/dts ; ls renesas/*.dts | sed 's/\.dts/.dtb/')
#dtbs="renesas/r8a77965-salvator-xs.dtb"
diff --git a/platforms/imx7.sh b/platforms/imx7.sh
index 5f27052..88add42 100644
--- a/platforms/imx7.sh
+++ b/platforms/imx7.sh
@@ -1,8 +1,6 @@
platform=imx7
dir_pattern=plusoptix
arch=arm
-#boot_dir=$tftp_root/imx7
-boot_dir=$nfs_root/arm32/boot
dtbs="imx7d-sx-pl-emar.dtb imx7d-sx-pl-test.dtb"
image=zImage
loadaddr=0x80008000
diff --git a/platforms/omap3.sh b/platforms/omap3.sh
index af5261a..1c2ca71 100644
--- a/platforms/omap3.sh
+++ b/platforms/omap3.sh
@@ -1,6 +1,5 @@
platform=omap3
dir_pattern=media
arch=arm
-boot_dir=$tftp_root/omap3
dtbs="omap3-beagle-xm.dtb omap3-overo-storm-tobi.dtb"
image=zImage
diff --git a/platforms/omap4+.sh b/platforms/omap4+.sh
index 3616c02..a5e8071 100644
--- a/platforms/omap4+.sh
+++ b/platforms/omap4+.sh
@@ -1,7 +1,6 @@
platform=omap4+
dir_pattern=omap
arch=arm
-boot_dir=$tftp_root/omap4
dtbs="omap4-panda.dtb omap4-panda-es.dtb am57xx-evm-reva3.dtb:am57xx-beagle-x15.dtb"
image=FIT
loadaddr=0x80008000
diff --git a/platforms/scarlet.sh b/platforms/scarlet.sh
index 908d200..d9f46a4 100644
--- a/platforms/scarlet.sh
+++ b/platforms/scarlet.sh
@@ -1,6 +1,5 @@
platform=scarlet
arch=arm64
-boot_dir=$nfs_root/arm64/boot
cmdline="console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8 console=tty1 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw noinitrd ignore_loglevel"
cmdline="console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8 console=tty1 ip=dhcp root=/dev/nfs rootwait rw noinitrd ignore_loglevel"
dtbs="rockchip/rk3399-gru-scarlet-inx.dtb"
diff --git a/platforms/soraka.sh b/platforms/soraka.sh
index 3166e99..29286b8 100644
--- a/platforms/soraka.sh
+++ b/platforms/soraka.sh
@@ -1,7 +1,6 @@
platform=soraka
dir_pattern=libcamera
arch=x86
-boot_dir=$tftp_root/x86
cmdline="console=ttyS0,115200n8 earlyprintk=ttyS0,115200n8 console=tty1 ip=dhcp root=/dev/nfs rootwait rw noinitrd ignore_loglevel"
image=CrOS
kcflags="$kcflags -Wno-error=frame-larger-than="
diff --git a/platforms/x86.sh b/platforms/x86.sh
index f635611..03960ad 100644
--- a/platforms/x86.sh
+++ b/platforms/x86.sh
@@ -1,5 +1,4 @@
platform=x86
arch=x86
-boot_dir=$tftp_root/x86
image=bzImage
kcflags="$kcflags -Wno-error=frame-larger-than="
diff --git a/platforms/zynqmp.sh b/platforms/zynqmp.sh
index 73bab8d..5018dda 100644
--- a/platforms/zynqmp.sh
+++ b/platforms/zynqmp.sh
@@ -1,9 +1,8 @@
platform=zynqmp
dir_pattern=xilinx
arch=arm64
-boot_dir=$tftp_root/xilinx
dtbs="xilinx/zynqmp-zcu106-revA.dtb"
image=Image
loadaddr=0x10000000
kcflags="$kcflags -Wno-error=packed-not-aligned -Wno-error=sizeof-pointer-memaccess -Wno-error=stringop-truncation -Wno-error=stringop-overflow"
-target_dir=$nfs_root/zynqmp
+target_dir=$HOME/src/netboot/$platform