Browse Source
Merge pull request #498 from lluiscampos/MEN-5979-grub-d-integration-i386
fix: Fix grub.d integration on architecture cross-build
4.0.x
Lluis Campos
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
27 additions and
3 deletions
-
modules/grub.sh
-
modules/probe.sh
|
|
@ -111,9 +111,10 @@ function grub_install_grub_d_config() { |
|
|
|
# build. Instead, use `--removable`, which creates entries that automate |
|
|
|
# booting if you put the image into a new device, which you almost certainly |
|
|
|
# will after using mender-convert. |
|
|
|
run_and_log_cmd_noexit "sudo chroot work/rootfs grub-install --removable --no-nvram" || ret=$? |
|
|
|
local -r target_name=$(probe_grub_install_target) |
|
|
|
run_and_log_cmd_noexit "sudo chroot work/rootfs grub-install --target=${target_name} --removable --no-nvram" || ret=$? |
|
|
|
if [ $ret -eq 0 ]; then |
|
|
|
run_and_log_cmd_noexit "sudo chroot work/rootfs grub-install --no-nvram" || ret=$? |
|
|
|
run_and_log_cmd_noexit "sudo chroot work/rootfs grub-install --target=${target_name} --no-nvram" || ret=$? |
|
|
|
fi |
|
|
|
|
|
|
|
if [ $ret -eq 0 ]; then |
|
|
|
|
|
@ -36,8 +36,10 @@ probe_arch() { |
|
|
|
fi |
|
|
|
|
|
|
|
target_arch="unknown" |
|
|
|
if grep -q x86-64 <<< "${file_info}"; then |
|
|
|
if grep -Eq "ELF 64-bit.*x86-64" <<< "${file_info}"; then |
|
|
|
target_arch="x86_64" |
|
|
|
elif grep -Eq "ELF 32-bit.*386" <<< "${file_info}"; then |
|
|
|
target_arch="i386" |
|
|
|
elif grep -Eq "ELF 32-bit.*ARM" <<< "${file_info}"; then |
|
|
|
target_arch="arm" |
|
|
|
elif grep -Eq "ELF 64-bit.*aarch64" <<< "${file_info}"; then |
|
|
@ -72,6 +74,27 @@ probe_grub_efi_name() { |
|
|
|
echo "$efi_name" |
|
|
|
} |
|
|
|
|
|
|
|
# Prints GRUB grub-install target name depending on target architecture |
|
|
|
# |
|
|
|
# No input parameters and these work on the assumption that boot and root parts |
|
|
|
# are mounted at work/boot and work/rootfs |
|
|
|
probe_grub_install_target() { |
|
|
|
local target_name="" |
|
|
|
local -r arch=$(probe_arch) |
|
|
|
case "${arch}" in |
|
|
|
"x86_64") |
|
|
|
target_name="x86_64-efi" |
|
|
|
;; |
|
|
|
"i386") |
|
|
|
target_name="i386-efi" |
|
|
|
;; |
|
|
|
*) |
|
|
|
log_fatal "Unsupported arch: ${arch}" |
|
|
|
;; |
|
|
|
esac |
|
|
|
echo "$target_name" |
|
|
|
} |
|
|
|
|
|
|
|
# Prints Debian arch name depending on target architecture |
|
|
|
# |
|
|
|
# No input parameters and these work on the assumption that boot and root parts |
|
|
|