Fix uImage build

This commit is contained in:
hzy 2023-03-02 22:04:24 +08:00 committed by hzyitc
parent 577d0eaa28
commit 76ce4c3a3d
10 changed files with 20 additions and 47 deletions

View File

@ -16,6 +16,7 @@ export MAIN_CMDLINE='' # we set it in common, it was not set be
export KERNEL_COMPILER=' ' # hack: use single space for host gcc. won't work on arm64 hosts
export KERNEL_USE_GCC=' ' # more hacks.
export KERNEL_IMAGE_TYPE='bzImage' # Ubuntu Standard
export KERNEL_INSTALL_TYPE='install' # the only one
export KERNEL_EXTRA_TARGETS='modules' # default is "modules dtb" but x86_64 has no DTB
export KERNEL_BUILD_DTBS="no" # amd64 has no DTBs. that I know of.
export UBOOT_USE_GCC='none' # required by configuration.sh

View File

@ -12,9 +12,10 @@ export ARCH='arm64'
export ARCHITECTURE='arm64'
export KERNEL_SRC_ARCH='arm64'
export QEMU_BINARY='qemu-aarch64-static'
export KERNEL_IMAGE_TYPE='Image'
export KERNEL_INSTALL_TYPE='install'
export NAME_KERNEL='Image'
export NAME_INITRD='uInitrd'
export KERNEL_IMAGE_TYPE='Image'
[[ -z $KERNEL_COMPILER ]] && KERNEL_COMPILER="aarch64-linux-gnu-"
[[ -z $INITRD_ARCH ]] && INITRD_ARCH=arm64

View File

@ -12,10 +12,11 @@ export ARCH='armhf'
export ARCHITECTURE='arm'
export KERNEL_SRC_ARCH='arm'
export QEMU_BINARY='qemu-arm-static'
export NAME_KERNEL='zImage'
[[ -z $KERNEL_IMAGE_TYPE ]] && export KERNEL_IMAGE_TYPE='zImage'
[[ -z $KERNEL_INSTALL_TYPE ]] && export KERNEL_INSTALL_TYPE='zinstall'
[[ -z $NAME_KERNEL ]] && export NAME_KERNEL='zImage'
export NAME_INITRD='uInitrd'
export INITRD_ARCH='arm'
export KERNEL_IMAGE_TYPE='Image'
[[ -z $KERNEL_COMPILER ]] && KERNEL_COMPILER='arm-linux-gnueabihf-'
[[ -z $UBOOT_USE_GCC ]] && UBOOT_USE_GCC='> 8.0'

View File

@ -8,8 +8,10 @@
#
ARCH=armhf
LINUXFAMILY=meson
KERNEL_IMAGE_TYPE=uImage
KERNEL_IMAGE_TYPE='uImage'
KERNEL_INSTALL_TYPE='uinstall'
SRC_LOADADDR='LOADADDR=0x00208000'
NAME_KERNEL=uImage
SERIALCON="ttyAML0"

View File

@ -8,7 +8,6 @@
#
enable_extension "rkbin-tools"
ARCH=arm64
KERNEL_IMAGE_TYPE=Image
OFFSET=16
BOOTSCRIPT='boot-rockchip64.cmd:boot.cmd'
BOOTENV_FILE='rockchip64.txt'

View File

@ -14,7 +14,6 @@ KERNELBRANCH='branch:linux-5.15.y'
ARCH=arm64
#UBOOT_TARGET_MAP=";;u-boot.bin"
UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin:u-boot.bin u-boot-dtb.img"
KERNEL_IMAGE_TYPE=Image
ATF_COMPILE="no"
BOOTSCRIPT='boot-qemu.cmd:boot.cmd'

View File

@ -12,9 +12,10 @@ export ARCH='riscv64'
export ARCHITECTURE='riscv'
export KERNEL_SRC_ARCH='riscv'
export QEMU_BINARY='qemu-riscv64-static'
export KERNEL_IMAGE_TYPE='Image'
export KERNEL_INSTALL_TYPE='install'
export NAME_KERNEL='Image'
export NAME_INITRD='uInitrd'
export KERNEL_IMAGE_TYPE='Image'
export IMAGE_PARTITION_TABLE='gpt'
export SKIP_EXTERNAL_TOOLCHAINS='yes'

View File

@ -64,18 +64,8 @@ function prepare_kernel_packaging_debs() {
# display_alert "tmp_kernel_install_dirs INSTALL_HDR_PATH:" "${tmp_kernel_install_dirs[INSTALL_HDR_PATH]}" "debug"
# display_alert "tmp_kernel_install_dirs INSTALL_DTBS_PATH:" "${tmp_kernel_install_dirs[INSTALL_DTBS_PATH]}" "debug"
# For armhf, kernel's "make install" gives us the wrong "vmlinuz-xx" file. We want the arch/arm/boot/zImage.
if [[ "${ARCH}" == "armhf" ]]; then # @TODO: if you know a better way? some kbuild var? send PR.
display_alert "armhf: using arch/arm/boot/zImage as vmlinuz" "armhf zImage" "info"
run_host_command_logged ls -la "${kernel_work_dir}/arch/arm/boot/zImage" || true
run_host_command_logged file "${kernel_work_dir}/arch/arm/boot/zImage" || true
run_host_command_logged ls -la "${tmp_kernel_install_dirs[INSTALL_PATH]}/vmlinuz-${kernel_version_family}" || true
run_host_command_logged file "${tmp_kernel_install_dirs[INSTALL_PATH]}/vmlinuz-${kernel_version_family}" || true
# Just overwrite it...
run_host_command_logged cp -v "${kernel_work_dir}/arch/arm/boot/zImage" "${tmp_kernel_install_dirs[INSTALL_PATH]}/vmlinuz-${kernel_version_family}"
run_host_command_logged file "${tmp_kernel_install_dirs[INSTALL_PATH]}/vmlinuz-${kernel_version_family}"
display_alert "armhf: using arch/arm/boot/zImage as vmlinuz" "done with armhf zImage" "debug"
fi
# Due to we call `make install` twice, we will get some `.old` files
run_host_command_logged rm -rf "${tmp_kernel_install_dirs[INSTALL_PATH]}/*.old" || true
# package the linux-image (image, modules, dtbs (if present))
display_alert "Packaging linux-image" "${LINUXFAMILY} ${LINUXCONFIG}" "info"

View File

@ -96,6 +96,7 @@ function kernel_prepare_build_and_package() {
declare -A kernel_install_dirs
build_targets=("all") # "All" builds the vmlinux/Image/Image.gz default for the ${ARCH}
build_targets+=( "${KERNEL_IMAGE_TYPE}" )
declare cleanup_id="" kernel_dest_install_dir=""
prepare_temp_dir_in_workdir_and_schedule_cleanup "k" cleanup_id kernel_dest_install_dir # namerefs
@ -106,7 +107,12 @@ function kernel_prepare_build_and_package() {
#["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install` - disabled, only used for libc headers
)
build_targets+=(install modules_install) # headers_install disabled, only used for libc headers
[ -z "${SRC_LOADADDR}" ] || install_make_params_quoted+=( "${SRC_LOADADDR}" ) # For uImage
# @TODO: Only combining `install` and `modules_install` enable mixed-build and __build_one_by_one
# We should spilt the `build` and `install` into two make steps as the kernel required
build_targets+=( "install" "${KERNEL_INSTALL_TYPE:-install}" )
build_targets+=( "modules_install" ) # headers_install disabled, only used for libc headers
if [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]]; then
display_alert "Kernel build will produce DTBs!" "DTBs YES" "debug"
build_targets+=("dtbs_install")

View File

@ -1,27 +0,0 @@
Generate uImage instand of zImage
---
scripts/package/builddeb | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 91a502bb9..196889f1d 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -218,6 +218,13 @@ if [ "$ARCH" != "um" ]; then
create_package linux-libc-dev debian/linux-libc-dev
fi
+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst
+cat >> $tmpdir/DEBIAN/postinst <<EOT
+mkimage -A arm -O linux -T kernel -C none -a 0x2080000 -e 0x2080000 -n "Linux" -d /boot/zImage /boot/uImage > /dev/null 2>&1
+rm -f /boot/zImage
+exit 0
+EOT
+
create_package "$packagename" "$tmpdir"
if [ -n "$BUILD_DEBUG" ] ; then
--
2.25.1