From nobody Sat Dec 03 20:08:10 2022 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 4NPgpy73mQz4jJm6; Sat, 3 Dec 2022 20:08:10 +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 4NPgpy6dQ9z4PBX; Sat, 3 Dec 2022 20:08:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670098090; 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=+EGrt94OHvhFHkqnbJ6M/hDEBX5/ouOVwj/DC0LCgWU=; b=vqUtBa4fDQfmxfeGKb6IyA2p20YfQ3w5F7hxD2Wo3LE23om7kmKP+FYB5zcooEZpKazgSO uRIQSoX0w0KOHTVFlmHdc+DHkaYnPSG2vXcd4gn1UGKcTlvvJucC8U9A4WEw5qBUwjstxs 3z1etGm5zuyHaXN8itB0ccT2HAgI5Z34py4Td6zDQGZ3RBH0/PYVbJu63MIahnblem4AZz GL9rT9EnxWrGgE5bSq6c2JCGAMEotreYmuiHF6RmoDiWaqblhGxJL1oBHfbVyCcwIE4Z7w 2KQHRHNvhDrPt12U2Ca30eqoRfr+w2I9nihNc7dnveca4BYTLkRlb8oyMpcg/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670098090; 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=+EGrt94OHvhFHkqnbJ6M/hDEBX5/ouOVwj/DC0LCgWU=; b=fRry3v3xg7JyybRIJSGWTgZx+iuGd8X8E/7YdOgNgI9JRKio8CJva+X5J6EJnNAIz7gBI0 K1XqqXQfEN+X3hOit7CsXw0K4E9tYm6NUZrE9gFMnuzLlWZ3/kP4QbRMChpljqBlRkgU4F hniyWgpWtSGHbcXeKZVyQjyZYPHAqKjSC6XsHYYGy8jHC8dwlWjkzhRVYBUJnFYNwsW30a kInHzUfYUz50eS9zfUSXDeS4HsL1cA3Nh4t3qkX2LfvY4lnNaKYrFR1m6GdzogWvbv4kX2 1SeUeqr8QVQqXo/NsvAi5sL55IiLwTppBvWCs6xi6BfY0753mBg2vHxyt8+kVQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670098090; a=rsa-sha256; cv=none; b=yxAwW8ktG1P0qNQ7ngGBsXj2m8Dof6NH7/HIlFsl9QlZXPfJTL72T4qfdbVZ08WQt8x5Sh +/2GoJEYilRLZmI/k5eiAe4wfpLxahOji3whSfiPbGyAveAo2JeRq9KNp61DXYp5MPrdWW ZRSPXJXJN8tQeRBbFGtoF7q7vZaxD98ffEv1P29KeAo3uvPlC66V+Gw1IZUqtdlH5CtpL0 HLFlSGPvhb6yaYRLm8WT7NWoVqrMYoicrLu5TCbXSOm8c+ujHm4kUqiZn/5S1NNXpei12o 49F1Itb+ucZBLAB97c+NkpBP1BMXvPoJZs/M3k+KgplIuLhvfbOx7SFZITYd7w== 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 4NPgpy5fM5z173t; Sat, 3 Dec 2022 20:08:10 +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 2B3K8Auk050037; Sat, 3 Dec 2022 20:08:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B3K8AJU050036; Sat, 3 Dec 2022 20:08:10 GMT (envelope-from git) Date: Sat, 3 Dec 2022 20:08:10 GMT Message-Id: <202212032008.2B3K8AJU050036@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 59cbe840cffc - main - 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/main X-Git-Reftype: branch X-Git-Commit: 59cbe840cffcd5513e1d3b8736fb6c0d10945ab2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=59cbe840cffcd5513e1d3b8736fb6c0d10945ab2 commit 59cbe840cffcd5513e1d3b8736fb6c0d10945ab2 Author: Warner Losh AuthorDate: 2022-12-03 19:48:16 +0000 Commit: Warner Losh CommitDate: 2022-12-03 19:48:45 +0000 kboot: Add readme Document how to test kboot and how to build a initrd. Sponsored by: Netflix --- 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.