From owner-freebsd-current@freebsd.org Wed Jun 17 18:19:16 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2305357400 for ; Wed, 17 Jun 2020 18:19:16 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49nCyC55gnz4HPt for ; Wed, 17 Jun 2020 18:19:15 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 05HIJB88086576; Wed, 17 Jun 2020 11:19:11 -0700 (PDT) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 05HIJBR2086575; Wed, 17 Jun 2020 11:19:11 -0700 (PDT) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <202006171819.05HIJBR2086575@gndrsh.dnsmgr.net> Subject: Re: CTF: UEFI HTTP boot support In-Reply-To: To: Warner Losh Date: Wed, 17 Jun 2020 11:19:11 -0700 (PDT) CC: "Rodney W. Grimes" , "Simon J. Gerraty" , Miguel C , FreeBSD Current X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49nCyC55gnz4HPt X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd-rwg@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd-rwg@gndrsh.dnsmgr.net X-Spamd-Result: default: False [1.07 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.04)[-0.036]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.31)[0.314]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.11)[-0.110]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; FREEMAIL_CC(0.00)[gndrsh.dnsmgr.net,juniper.net,gmail.com,freebsd.org]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 18:19:16 -0000 > On Wed, Jun 17, 2020 at 11:53 AM Rodney W. Grimes < > freebsd-rwg@gndrsh.dnsmgr.net> wrote: > > > > Rodney W. Grimes wrote: > > > > > The "fake cd drive" is in the kernel, loader just copies the iso into > > > > > memory like any other module, and by the time that's done you just > > > > > reboot into the newly installed system, which again uses > > > > > > > > > > vfs.root.mountfrom="cd9660:/dev/md0.uzip" > > > > ^^^ > > > > > > > > Argh, the cd9660 confused me, I think your doing a > > > > "root on mfs/md"? > > > > > > loader.conf says > > > > > > rootfs_load="yes" > > > rootfs_name="contents.izo" > > > rootfs_type="md_image" > > > vfs.root.mountfrom="cd9660:/dev/md0.uzip" > > > > > > contents.izo is uzip'd contents.iso which file(1) > > > describes as ISO 9660 CD-ROM filesystem data '' > > > > > > That's for normal boot, for the loader 'install' command > > > it expects an uncompressed iso for rootfs. > > > > Ok, now the puzzle is how much work to get from a stock FreeBSD .iso > > image to something that works with this. Obviously we need a non-stock > > /boot/loader.conf file, or to type some commands manually at a loader > > prompt. I believe the stock GENERIC kernel has the md_root support > > for this already, so it may not be that hard to do. > > > > Looking at the code, I think MD_ROOT alone is insufficient here... I was a bit worried about that, but hopefull. We do work out of the box with a NFS root as long as the NIC is found during boot. And given that I load the loader over NFS the loader can also find my /boot/ directory and the files in it, so that part is already solved. > If there's no MD root provided, we look for the symbols mfs_root and > mfs_root_end, which I think means that rootfs_ in the above example needs > to be md_root_ instead so that we find it. Isnt this all handled by the loader? I think we have 2 slightly different cases here. THe one sjg shows up, where you actually load the md_image from a seperate file, and the case your talking about where you actually embed the kernel and image into a single file. > > You may need to have a custom kernel with 'options MD_ROOT_READONLY' > because isofs is read-only. > > And there's a small chance you may need to define ROOTDEVNAME in the build > as well to be "cd9660:/dev/md0.uzip" I do not think that is necessesary but I'll keep it in mind, at present I do over ride the vfs.root.mountfrom to point to my version specific root file system using some ipxe variables. > > Every time I do stuff like this I have to re-puzzle it out, alas, but these > should give you some guide posts. It should be better documented in md(4), > but isn't at the moment. Thanks for exposing what may be some pointy sticks to stumble on. > > I'd honestly try to get this setup working first loading all the files off > a local disk before layering in the networking on top of that. Probalby a good idea, as the usually failure mode in the diskless word is black screens leaving little detail about what went wrong. > Warner -- Rod Grimes rgrimes@freebsd.org