From owner-freebsd-current@freebsd.org Wed Jun 17 18:06:41 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 4B8EA356AA2 for ; Wed, 17 Jun 2020 18:06:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49nCgh2W05z4GGd for ; Wed, 17 Jun 2020 18:06:40 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf33.google.com with SMTP id er17so1480681qvb.8 for ; Wed, 17 Jun 2020 11:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EFal6ZOZwvFAyp+zl3piGdSvgPJVMKcGlSwl176ZNMU=; b=wY/suLwHzPaT7oh/FWYvQZ4IuY7My8cuUZcitJg/wXCz8isU5IROEQbb92X8KqKVsj oSJIvb6u3bf87LAdpU5Ac16FlRxzj9VN9DuX4RV+eafWG9XqiwFikytRj5KyE2hoJTMI WqANJjcQkjzYwlwBg3jf7CyaqcxNb9o7ucQgSCyyhKfLe3SDivKHONFV+eIxK+dvD89H H3TKpb4zJexcCMkGWlNkgq3dBjTqCtIqFFB31/wkByEau6yCq2B9JPXeNlp3sZlQF+Ao HcuPRjtRfz1i9f2rXxGZLzReq2QGiYGTUYdDuVGNxYjzex12WqW29Ov+ZAisjHr3mUUY aHMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EFal6ZOZwvFAyp+zl3piGdSvgPJVMKcGlSwl176ZNMU=; b=FUHDQfKhod7k1AN0ugRMUXk7Z74HlnWS7vjzU/9rNruNyBXatqA227ZEQuz8LG6bUk dH6gtpucuieeKzHn4KnX4YU45gcnH3u5ByXsZ5tejqHmCMoY6zk9u89xu8TwLMabaXyQ P8oBgXAvK0RnO2t3hwJLm74Dz29hyjztrxLZD0A3YqdpbirMDU1HIE50hXqlxo54NOsx MDaQ9XVigKeRcMUrk+TrITXC9gmTJel9VegdmgWuDQobuofFH1Orq1p549G0uyi76NNj qbssItBS8WlUCLycb1AyT3WZybOA4ivPuMoT3cPSaq8a0J5V7s4I25TFmgGwAk8UdBKG SWew== X-Gm-Message-State: AOAM531nBK2xjynUDNzBzRDJ1BTm1webjEOhRm1vcUc46oapcEJsT1Q5 e35MN6GJo6jbSpyObPy1z28MfjLoh4et0DleBzyJrg== X-Google-Smtp-Source: ABdhPJzpYnsRVgMArr2P5zE6XhuPiyDRvPQXcubcr6xBXM4lTU7H3yUROehgpFkqRTUMd8VmKfwyCYeqeMMY8p8Gii0= X-Received: by 2002:a05:6214:17cb:: with SMTP id cu11mr8726549qvb.202.1592417199103; Wed, 17 Jun 2020 11:06:39 -0700 (PDT) MIME-Version: 1.0 References: <46934.1592351291@kaos.jnpr.net> <202006171752.05HHqo0E086454@gndrsh.dnsmgr.net> In-Reply-To: <202006171752.05HHqo0E086454@gndrsh.dnsmgr.net> From: Warner Losh Date: Wed, 17 Jun 2020 12:06:27 -0600 Message-ID: Subject: Re: CTF: UEFI HTTP boot support To: "Rodney W. Grimes" Cc: "Simon J. Gerraty" , Miguel C , FreeBSD Current X-Rspamd-Queue-Id: 49nCgh2W05z4GGd X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=wY/suLwH; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f33) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.66 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.31)[-0.310]; FREEMAIL_CC(0.00)[juniper.net,gmail.com,freebsd.org]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-0.98)[-0.979]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.37)[-0.369]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f33:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 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:06:41 -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... 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. 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" 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. 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. Warner