From nobody Thu Aug 07 16:44:56 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4byY15279Dz64Tkn; Thu, 07 Aug 2025 16:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4byY150zDyz3Xh7; Thu, 07 Aug 2025 16:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754585097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=frmi9BWNRD+foyqhy8bPmP5mjSzgYPLSBjcGrW5xKm4=; b=OAKZqEK+hQTgqyabuvKDbMlNpOLNUylVoEzvVFjNu/DfM1MCU3ADk9BLBP39TwXP0pCGSm RDDgXL1BLXE/v9j4HjzWShEkQ6Jgchs2Vdm+qUdeGyHmpGbSaV1HGEsLVgBlGfXaMZN6Ml r9gNpOAS0RBQWTqMYkg03y//G9TAreu26b+43ie/SgBJ+6DaptCUlD308GjM15SxPEDbmV uKyBz0KnVQlVuXfr5EMKoNbMIAZ6VBgs+SrBB013LTY6Ulg0v8fmHnWwRKr+DGjDIV2Iv1 1dddfZ1RbMnHSFXG5uuJnNsrpzrjR5nRvBLib1b/rUqUegPn/QqRMaCuCBjk4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754585097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=frmi9BWNRD+foyqhy8bPmP5mjSzgYPLSBjcGrW5xKm4=; b=lTQI7qjLHfCFRckB6+C/4d+4GBmB3/OdhI7rokS0aIcbGuIhN1eP65Bcp+jtS6IWLSjY84 RXnODLUFewYDhTaqwnHuTDK5QSPhvtRmPHqD5rA+3y9cVHLm6DEjzgkxulzFfvrZ8TGlkD lnmozi5sTA8xZmaR+DGY5q7l9VtIEeusPJfo27hM/UOMyG7URCzMMC6tTbboxIAXKK7O2m ugTNk2BYp4JZNeIrJtAR0z9NRN44Puk0vGJtLRqwmjx/fD/STz51tfNkMQH9urZ/neb0iB bzMsG6iz9McisfQRStPFvGOtFTOYbcGZcMt9iSuhMCAoCDtApnsyv/VLGnrquQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754585097; a=rsa-sha256; cv=none; b=Fpbuv/ITXUg1Du4qqU77JukGI3vEDCgX/9zChsEKUiewQ0xQwpakC7/6BJcEgRffazRq1b Mj1pMV+J+uAircX+8EFYAGZs7Arx2tokirRgxYl98Rc2RopIP/1RtCpBCc/9YEi/iKBAr0 zpaXXBsr5V15LIcJ/GuEuj8C93Nb0+T4ZnmzqYqcMxGys16t8qeICUvHp6Ehcs0j73P7Lj 3+2/+9kDWvgvUDdNEKVVyFxOxzurNzx8wuZWZ42zfesgSvmuoZNSk/RZeTDj0KHwcfuBX9 6ijpVvAleoNdTFfQGzSJDXk6rc7y5QKP34x9A9g52cEVeUxt65+iMoaO7d2P9A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4byY150YBRz1DHL; Thu, 07 Aug 2025 16:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 577GiuCg094673; Thu, 7 Aug 2025 16:44:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 577GiuQQ094670; Thu, 7 Aug 2025 16:44:56 GMT (envelope-from git) Date: Thu, 7 Aug 2025 16:44:56 GMT Message-Id: <202508071644.577GiuQQ094670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: e4bfe8e96615 - main - arm: Generate the kernel.bin file in zImage format. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4bfe8e96615b16687271147ee2856e6f2a0c478 Auto-Submitted: auto-generated The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=e4bfe8e96615b16687271147ee2856e6f2a0c478 commit e4bfe8e96615b16687271147ee2856e6f2a0c478 Author: Michal Meloun AuthorDate: 2025-05-04 11:29:57 +0000 Commit: Michal Meloun CommitDate: 2025-08-07 16:44:40 +0000 arm: Generate the kernel.bin file in zImage format. This allows you to run the kernel using the bootz command, which can be useful on a board where the manufacturer's u-boot does not support EFI. The original behavior has not been changed, the zImage binary can still be run by jumping to the beginning of the binary file. MFC after: 2 weeks --- sys/conf/Makefile.arm | 2 +- sys/tools/arm_kernel_boothdr.awk | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm index 216f012d688e..15ccb982c2a4 100644 --- a/sys/conf/Makefile.arm +++ b/sys/conf/Makefile.arm @@ -93,7 +93,7 @@ ${KERNEL_KO}.bin: ${FULLKERNEL} --output-target=binary ${FULLKERNEL} ${.TARGET}.temp @{ ${NM} ${FULLKERNEL} | \ LC_ALL=C \ - ${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v7jump && \ + ${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v7bootz && \ cat ${.TARGET}.temp; \ } > ${.TARGET} @rm ${.TARGET}.temp diff --git a/sys/tools/arm_kernel_boothdr.awk b/sys/tools/arm_kernel_boothdr.awk index e0f193f7922c..37d8c4b5af0e 100644 --- a/sys/tools/arm_kernel_boothdr.awk +++ b/sys/tools/arm_kernel_boothdr.awk @@ -38,6 +38,7 @@ BEGIN { # The type of header we're writing is set using -v hdrtype= on # the command line, ensure we got a valid value for it. if (hdrtype != "v7jump" && + hdrtype != "v7bootz" && hdrtype != "v8jump" && hdrtype != "v8booti") { print "arm_kernel_boothdr.awk: " \ @@ -107,6 +108,35 @@ function write_v7jump() { write_le32(hexstr_to_num("ea000000") + (gStartOff / 4) - 2) } +function write_v7bootz() { + + # We are writing this struct... + # + # struct BootZ_header { + # uint32_t code0; /* Executable code */ + # uint32_t dummy[8]; /* dummy */ + # uint32_t magic; /* Magic number 0x016f2818*/ + # uint32_t load_offset; /* Image load offset, LE */ + # uint32_t image_size; /* Effective Image size, LE */ + # }; + # + # We write 'b _start' into code0. The image size is everything from + # the start of the loaded image to the offset given by the _end symbol. + + write_v7jump() # code0 + write_le32(0) # dummy[0] + write_le32(0) # dummy[1] + write_le32(0) # dummy[2] + write_le32(0) # dummy[3] + write_le32(0) # dummy[4] + write_le32(0) # dummy[5] + write_le32(0) # dummy[6] + write_le32(0) # dummy[7] + write_le32(hexstr_to_num("016f2818")) # magic marker + write_le32(0) # load_offset (0 -> auto) + write_le32(gEndOff) # image_size +} + function write_v8jump() { # Write the machine code for "b _start"... @@ -186,6 +216,8 @@ END { if (gHdrType == "v7jump") { write_v7jump() + } else if (gHdrType == "v7bootz") { + write_v7bootz() } else if (gHdrType == "v8jump") { write_v8jump() } else if (gHdrType == "v8booti") {