envkernel: Add run-script alias to run local scripts within the chroot (!1747)
Example usage: For kernels that need to run dtbTool after make. Create a script named post-make.sh in the kernel source directory: #!/bin/sh dtbTool -s 2048 -p "${srcdir}/scripts/dtc/" -o \ "${builddir}/arch/arm/boot/dt.img" \ "${builddir}/arch/arm/boot" To run this script inside the chroot: $ source ~/pmbootstrap/helpers/envkernel.sh $ make lineageos_bacon_defconfig $ make $ run-script post-make.sh
This commit is contained in:
parent
a6db644f00
commit
43326b551a
|
@ -188,6 +188,25 @@ set_alias_make() {
|
|||
cmd="$cmd CC=$cc HOSTCC=$hostcc"
|
||||
# shellcheck disable=SC2139
|
||||
alias make="$cmd"
|
||||
unset cmd
|
||||
|
||||
# Build run-script command
|
||||
cmd="_run_script() {"
|
||||
cmd="$cmd echo '*** pmbootstrap envkernel.sh active for $PWD! ***';"
|
||||
cmd="$cmd _script=\"\$1\";"
|
||||
cmd="$cmd if [ -e \"\$_script\" ]; then"
|
||||
cmd="$cmd echo \"Running \$_script in the chroot native /mnt/linux/\";"
|
||||
cmd="$cmd pmbootstrap -q chroot --user -- sh -c \"cd /mnt/linux;"
|
||||
cmd="$cmd srcdir=/mnt/linux/ builddir=/mnt/linux/.output"
|
||||
cmd="$cmd ./\"\$_script\"\";"
|
||||
cmd="$cmd else"
|
||||
cmd="$cmd echo \"Error: \$_script not found.\";"
|
||||
cmd="$cmd fi;"
|
||||
cmd="$cmd };"
|
||||
cmd="$cmd _run_script \"\$@\""
|
||||
# shellcheck disable=SC2139
|
||||
alias run-script="$cmd"
|
||||
unset cmd
|
||||
}
|
||||
|
||||
|
||||
|
@ -272,8 +291,8 @@ main() {
|
|||
echo " * output folder: $PWD/.output"
|
||||
echo " * architecture: $arch ($device is $deviceinfo_arch)"
|
||||
echo " * cross compile: $(cross_compiler_version)"
|
||||
echo " * aliases: make, kernelroot, pmbootstrap, pmbroot" \
|
||||
"(see 'type make' etc.)"
|
||||
echo " * aliases: make, kernelroot, pmbootstrap, pmbroot," \
|
||||
"run-script (see 'type make' etc.)"
|
||||
else
|
||||
# Failure
|
||||
echo "See also: <https://postmarketos.org/troubleshooting>"
|
||||
|
|
Loading…
Reference in New Issue