From nobody Tue Jan 24 22:13:40 2023 X-Original-To: dev-commits-src-all@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 4P1h7n1DTqz3bgNy; Tue, 24 Jan 2023 22:13:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P1h7m5Jxgz3J2Y; Tue, 24 Jan 2023 22:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598420; 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=xAWB8Thz+I/v3MHdLifigjFHO1UHFB0iCOubwx6c2m8=; b=rYbPfdGmQm2KMiFoZzd6vRd9hEjifN137NzmTRHds4pLOBrlSlK8/UIDgzHIbKCkpa4sTP Klh9bMHsvNeISz0movst+hoNF1YNAxlepLxpdTGrI3KxjpsCwvubPf7fTg0j90YqwYh7Hv 5ymCqvkbvy5u4hRYo681Y39rUgV5TzhP2ABOpKsYklSxdk+N45tdZLFkUzJFHYuXNg7kvW lTDT/njSZAI50PzmQpmzxH7yj8RLqD0jeVyenud/eA7VeX5oVzngsFUfaiuKYSWAEfbED+ 9PQhlR359k/mBbOtXHidtpCCjAZJX5t2gm9fm3xEC0s2JS3Dcuo/dpnuCM1l0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598420; 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=xAWB8Thz+I/v3MHdLifigjFHO1UHFB0iCOubwx6c2m8=; b=S8V2lzhOdeJ+7R2LUCDGtUK5f9xpeWN/v8MIptZIKMHe4vNGzj+HoLeP2vGweZ70ljFXu/ GeYCeN6AQ12q3OR0XQo+9Lo1V/VkRDdpVwp505PmkOvnjUU5HUU+O5nbmrQseHUs312ZKS edwxOrF5k6bSEldgKcefvPL9v1kB6gOfe83qwj8lYbTTyjXLJAHpxnkJ+Z2rCAzMs2bSCg qTFveeeFlCBmtyzcI5euc4lLJ+YozINDcF68T+A1UC6+w+PGzE+GLIQUFJYkJ6RAXmbYO9 pFOA4TpgqEVV50Wa8HiyCY14G50ViLyUPT7CO7uq9PCH8wFT3Ai5Dm6zZKvWew== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598420; a=rsa-sha256; cv=none; b=NDGqkjhGp64OH0nOamJ5dl+2yAuQ9QSoHwy6GH5xjhPj4A0sjZHOQ130FBAZb89Q0aHgEN cO178efw/pYmxRV5BW7vjdRc0j62kNNLHHLrXBGd1KXmAnD8A/P0g6FNUKhCyQlSVqbUUG fTDoHiPEGeQT/nSXOnOzKxcU8QmDbYFa62UBmc2fwP2RtSEV5ihFoiC6X4J//zHxpyYMOK qp+/vdxE0HsZn7bqXA2N2x+SlDt9GSqNpdVyXDk7opFWiBLN+s1TyTxKAVkuAo1PPE949y 8HyOsZeYDmy/Ik/6KjlmwJkI/KKSbwDnrH1dY5ygWeHebenLjwBtVuzrYCQIcQ== 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 4P1h7m46hNzQYv; Tue, 24 Jan 2023 22:13:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30OMDevS088757; Tue, 24 Jan 2023 22:13:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMDesJ088756; Tue, 24 Jan 2023 22:13:40 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:13:40 GMT Message-Id: <202301242213.30OMDesJ088756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: fe0c839e2cb3 - stable/13 - kboot: Add readme List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fe0c839e2cb30f057d60ebb724a778bf13c503c9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fe0c839e2cb30f057d60ebb724a778bf13c503c9 commit fe0c839e2cb30f057d60ebb724a778bf13c503c9 Author: Warner Losh AuthorDate: 2022-12-03 19:48:16 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:41 +0000 kboot: Add readme Document how to test kboot and how to build a initrd. Sponsored by: Netflix (cherry picked from commit 59cbe840cffcd5513e1d3b8736fb6c0d10945ab2) --- stand/kboot/README | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/stand/kboot/README b/stand/kboot/README new file mode 100644 index 000000000000..ad390a023bb9 --- /dev/null +++ b/stand/kboot/README @@ -0,0 +1,48 @@ +So to make a Linux initrd: + +(1) mkdir .../initrd +(2) mkdir -p .../initrd/boot/defaults +(3) cd src/stand; make install DESTDIR=.../initrd +(4) Copy kernel to .../initrd/boot/kernel +(5) cd .../initrd +(6) cp boot/loader.kboot init +(7) find . | sort | cpio -o -H newc | gzip > /tmp/initrd.cpio +(8) download or build your linux kernel +(9) qemu-system-x86_64 -kernel ~/vmlinuz-5.19.0-051900-generic \ + -initrd /tmp/initrd.cpio \ + -m 256m -nographic \ + -monitor telnet::4444,server,nowait -serial stdio \ + -append "console=ttyS0" + (though you may need more than 256M of ram to actually boot FreeBSD and do + anything interesting with it and the serial console to stdio bit hasn't + been the most stable recipe lately). + +Notes: +For #6 you might need to strip loader.kboot if you copy it directly and don't + use make install. +For #7 the sort is important, and you may need LC_ALL=C for its invocation +For #7 gzip is but one of many methods, but it's the simplest to do. +For #9, this means we can automate it using methods from + src/tools/boot/rootgen.sh when the time comes. +#9 also likely generalizes to other architectures +For #8, see https://kernel.ubuntu.com/~kernel-ppa/mainline/ to download + a kernel suitable for testing... For arm, I've been using the + non 64k page kernels and 5.19 seems to not suck. + +aarch64: +qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt \ + -kernel ~/linuxboot/arm64/kernel/boot/vmlinuz-5.19.0-051900-generic \ + -initrd ~/linuxboot/arm64/initrd.img -m 256m -nographic \ + -monitor telnet::4444,server,nowait -serial stdio \ + -append "console=ttyAMA0" + +General + +Add -g -G to have gdb stop and wait for the debugger. This is useful for +debugging the trampoline (hbreak will set a hardware break that's durable across +code changes). If you set the breakpoint for the trampoline and it never hits, +then there's likely no RAM there and you got the PA to load to wrong. When +debugging the trampiline and up to that, use gdb /boot/loader. When debugging +the kernel, use kernel.full to get all the debugging. hbreak panic() is useful +on the latter since you'll see the original panic, not the panic you get from +there not being an early console.