From nobody Mon Oct 10 16:15:12 2022 X-Original-To: freebsd-fs@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 4MmPCJ6rLqz4fjW2 for ; Mon, 10 Oct 2022 16:15:24 +0000 (UTC) (envelope-from archimedes.gaviola@gmail.com) Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MmPCJ1LFxz4DsF for ; Mon, 10 Oct 2022 16:15:24 +0000 (UTC) (envelope-from archimedes.gaviola@gmail.com) Received: by mail-yb1-xb36.google.com with SMTP id 81so13530930ybf.7 for ; Mon, 10 Oct 2022 09:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bq6ad8gI6nDldeHm57ua2h1eLfTEgv2Wfs1OqzoaeiQ=; b=YKd7tqcEgvQ0UebVPGcty9vRQQHtjC+jfKJ9Z2cGykjtWYkq1b6rCjnAjUAOhB66o+ JiFaRm+wbwrExqO6KLa9eAFoN3Z9RzvJW1kVpKCrcerI42hcSmJKB8VWntfUtpG5KMFq b2t0+fTXE/rmf4HaGV8inyre22z96b2QBIgh1t2C92fzWs+u4r6tfpYWPACzO6FOv1// EdBUWDJsqPXIus3thM6+YLd3aekkZhtOLpuxn75KFodWMV6Or6nke2AIbBoPTFk65+Ta jTUJqIKUQaKz9zR90Q+D3Qzl1S/AvOC8YvfOIWhafToRjLjv5sNISE+Nfq67whCGfJ4T SGNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bq6ad8gI6nDldeHm57ua2h1eLfTEgv2Wfs1OqzoaeiQ=; b=EGkhv85+5GJEyEybkFOwc3DGYFjf6KFGOpkVqOHibPkyfnrHoSwQBzf6tINF0/sSE9 46W/nrHRpqxlQFbLI1Azv228kiPya0jCLpXXmEzG00sqNW+0E4dlv3ejfxfoiYdOGDXe iG3nqaPkch1/PxGc3jr2eFpO4TLKY3jJ5W4TRKfJZ2dDQvisFCAr2y9edGcU86MI9qvt zi9nAnRNb8+ZH2qr+v3uvQQnFtkk8ewGBy7EFn+z9vZQtgegzl204+LXLvulpdw/oZQ7 8X8drbGJx0Tu/navYM9JgQxOfB+N/UD7siuyDAcUtquaf7NZbFEBr8P+GskERWkwyMZF Dz2g== X-Gm-Message-State: ACrzQf23q3PFn2WaaY+Cx0IujW6/4gWBvRtqKBax1qif6i+zUezTgnXP WrylKOcRKM1mmB5AIzDIZXv7elvaHxoFvdwdIRXn4GQheFY= X-Google-Smtp-Source: AMsMyM60qYQss3zzdsNZK47A+A6vNzvbJ2MZ65fTRijwpJmte6tSMjWZm+prwQ9MJ1C9uNYNhTSKPUnM05Zc92hxnAE= X-Received: by 2002:a25:2d4a:0:b0:6be:bf20:27cb with SMTP id s10-20020a252d4a000000b006bebf2027cbmr19615878ybe.331.1665418522776; Mon, 10 Oct 2022 09:15:22 -0700 (PDT) List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org MIME-Version: 1.0 References: <1630032913.129053.1665400270350@localhost> <896114746.217581.1665409172569@localhost> In-Reply-To: <896114746.217581.1665409172569@localhost> From: Archimedes Gaviola Date: Tue, 11 Oct 2022 00:15:12 +0800 Message-ID: Subject: Re: UFS in a USB flash drive (ufs:/dev/da0s1a) To: Ronald Klop Cc: freebsd-fs@freebsd.org Content-Type: multipart/alternative; boundary="00000000000073d5ea05eab0778f" X-Rspamd-Queue-Id: 4MmPCJ1LFxz4DsF X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=YKd7tqcE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of archimedes.gaviola@gmail.com designates 2607:f8b0:4864:20::b36 as permitted sender) smtp.mailfrom=archimedes.gaviola@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; MLMMJ_DEST(0.00)[freebsd-fs@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b36:from]; ARC_NA(0.00)[]; TAGGED_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --00000000000073d5ea05eab0778f Content-Type: text/plain; charset="UTF-8" On Mon, Oct 10, 2022 at 9:39 PM Ronald Klop wrote: > > > *Van:* Archimedes Gaviola > *Datum:* maandag, 10 oktober 2022 14:09 > *Aan:* Ronald Klop > *CC:* freebsd-fs@freebsd.org > *Onderwerp:* Re: UFS in a USB flash drive (ufs:/dev/da0s1a) > > > > On Mon, Oct 10, 2022 at 7:11 PM Ronald Klop wrote: > >> >> >> *Van:* Archimedes Gaviola >> *Datum:* maandag, 10 oktober 2022 12:40 >> *Aan:* freebsd-fs@freebsd.org >> *Onderwerp:* UFS in a USB flash drive (ufs:/dev/da0s1a) >> >> Hi, >> >> I have a scenario (see below) after which the FreeBSD kernel boots-up in >> my embedded system, it is looking for the root filesystem. Now, I want to >> build one from scratch based on the examples below using a UFS filesystem >> in a USB flash drive -> ufs:/dev/da0s1a. Are there any available >> step-by-step reference(s) that can help and guide me in the building >> process? >> >> ... >> >> >> Trying to mount root from cd9660:/dev/map/rootfs.uzip []... >> mountroot: waiting for device /dev/map/rootfs.uzip... >> Mounting from cd9660:/dev/map/rootfs.uzip failed with error 19. >> >> Loader variables: >> >> Manual root filesystem specification: >> : [options] >> Mount using filesystem >> and with the specified (optional) option list. >> >> eg. ufs:/dev/da0s1a >> zfs:tank >> cd9660:/dev/cd0 ro >> (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /) >> >> ? List valid disk boot devices >> . Yield 1 second (for background tasks) >> Abort manual input >> >> mountroot> >> >> ... >> >> Thanks and best regards, >> Archimedes >> >> >> >> Hi, >> >> From your mail I don't really understand what your level of skills with >> FreeBSD is. I assume the scenario with cd9660 and error 19 is not your >> biggest concern. You just want to install on a USB flash drive. >> >> Does this help: https://docs.freebsd.org/en/books/handbook/bsdinstall/ ? >> >> Regards, >> Ronald. >> >> > > Hi Ronald, > > > No, it's not about installing FreeBSD from scratch using a USB flash drive > as I already flashed and installed the FreeBSD kernel in the SPI flash RAM > using trivial FTP in the U-boot loader. What I want is mounting the root > filesystem that's been created in the USB flash drive (this hardware has > USB port) using the ufs:/dev/da0s1a method but before that happens, I need > to create that root filesystem (/) from scratch in the USB flash drive so > that it can be mounted right after the kernel is loaded. > > Not sure what level I am as a FreeBSD user but I can install and setup > FreeBSD system, networking, install packages and re-build or compile a > kernel. > > Thanks and best regards, > Archimedes > > > > Hi, > > To create the root filesystem on USB you can use several methods. 2 of > them are like this: > * the "bsdinstall" tool > * or > - fetch > https://download.freebsd.org/ftp/snapshots/arm64/13.1-STABLE/base.txz > (change the URL if you need a different architecture or FreeBSD version) > - newfs /dev/da0s1a (NB: this device name might be different > depending on the devices already available in your system) > - mount /dev/da0s1a /mnt > - tar xf -C /mnt /base.txz > - umount /mnt > > This is from the top of my head, so I might have forgotten something. > > Than plugin the USB on your embedded system and at the prompt type: > mountroot> ufs:/dev/da0s1a > > If it does not work type a "?" question mark to see what filesystems are > available. > > If you want to persist the FS used as root filesystem it depends on the > system you are running. > You can hardcode the root FS in the kernel you saved in the SPI RAM. But > depending on the system it is also possible to pass the rootfs in a > variable in loader.conf or some other place from which the kernel can read > variables. > > What kind of system are you running? > > Hope this helps. > > Regards, > Ronald. > Hi Ronald, Thanks for sharing the information, really appreciate it! I will try the newfs (newfs /dev/da0s1a) with my USB drive and then afterwards mount it to the host system. I can't fetch the base system since I'm cross-compiling a 32-bit MIPS (mipsel) system in an older FreeBSD 11.4 x86_64 release. I just downloaded the kernel source (/usrc/src). What I have at the moment is a successful cross-build of a system using the build command below; cd /usr/src; make KERNCONF=RT305X TARGET=mips TARGET_ARCH=mipsel kernel-toolchain buildkernel buildworld installkernel installworld distribution DESTDIR=/tmp/rt3050 that instead of using the DESTDIR= /tmp/rt3050, I will try replacing it with a mounted /dev/da0s1a. And then let me also try building without the kernel. > Than plugin the USB on your embedded system and at the prompt type: > mountroot> ufs:/dev/da0s1a > > If it does not work type a "?" question mark to see what filesystems are available. Noted on this. > If you want to persist the FS used as root filesystem it depends on the system you are running. > You can hardcode the root FS in the kernel you saved in the SPI RAM. This is quite interesting but does it matter with the size of the SPI RAM as this system is only having 4MB? > But depending on the system it is also possible to pass the rootfs in a variable in loader.conf or some other > place from which the kernel can read variables. > > What kind of system are you running? > > Hope this helps. Again, this is a 32-bit MIPS system based on Ralink SoC. Apologize for this one because I know the FreeBSD project already phased-out this architecture platform in the -CURRENT builds and for support and it happens that I came late on this architecture and eager to learn and explore. Yes, the one you've shared means a lot to me. Let me try and get back on the progress. Thanks and best regards, Archimedes --00000000000073d5ea05eab0778f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Mon, Oct 10, 2022 at 9:39 PM Ronal= d Klop <ronald-lists@klop.ws= > wrote:
=C2=A0

Van: Archimedes Gaviola <archimedes.gaviola@gmail.com>
Datum: maandag, 10 oktober 2022 14:09
Aan: Ronald Klop <ronald-lists@klop.ws>
CC: free= bsd-fs@freebsd.org
Onderwerp: Re: UFS in a USB flash drive (ufs:/dev/da0s1a)

=C2=A0
=C2=A0
On Mon, Oct 10, 2022 at 7:11 PM Ronald Klop <<= a href=3D"mailto:ronald-lists@klop.ws" target=3D"_blank">ronald-lists@klop.= ws> wrote:
=C2=A0

Van: Archimedes Gaviola <archimedes.gaviola@gmail.com>
Datum: maandag, 10 oktober 2022 12:40
Aan: fre= ebsd-fs@freebsd.org
Onderwerp: UFS in a USB flash drive (ufs:/dev/da0s1a)

Hi,
=C2=A0
I have a scenario (see below) after which the FreeBSD kernel boots-up = in my embedded system, it is looking for the root filesystem. Now, I want t= o build one from scratch based on the examples below using a UFS filesystem= in a USB flash drive -> ufs:/dev/da0s1a. Are there any available step-b= y-step reference(s) that can help and guide me in the building process?
=C2=A0
...
=C2=A0
=C2=A0
Trying to mount root from cd9660:/dev/map/rootfs.uzip []...
mountroot: waiting for device /dev/map/rootfs.uzip...
Mounting from cd9660:/dev/map/rootfs.uzip failed with error 19.

Loader variables:

Manual root filesystem specification:
=C2=A0 <fstype>:<device> [options]
=C2=A0 =C2=A0 =C2=A0 Mount <device> using filesystem <fstype> =C2=A0 =C2=A0 =C2=A0 and with the specified (optional) option list.

=C2=A0 =C2=A0 eg. ufs:/dev/da0s1a
=C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs:tank
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cd9660:/dev/cd0 ro
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (which is equivalent to: mount -t cd9660= -o ro /dev/cd0 /)

=C2=A0 ? =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 List valid disk b= oot devices
=C2=A0 . =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Yield 1 second (f= or background tasks)
=C2=A0 <empty line> =C2=A0 =C2=A0Abort manual input

mountroot>
=C2=A0
...
=C2=A0
Thanks and best regards,
Archimedes


Hi,

>From your mail I don't really understand what your level of skills with= FreeBSD is. I assume the scenario with cd9660 and error 19 is not your big= gest concern. You just want to install on a USB flash drive.

Does this help: https://docs.freebsd.org/en/books/handbook/bsdins= tall/ ?

Regards,
Ronald.
=C2=A0
=C2=A0
Hi Ronald,
=C2=A0
=C2=A0
No, it's not about installing FreeBSD from scratch using a USB fla= sh drive as I already flashed and installed the FreeBSD kernel in the SPI f= lash RAM using trivial FTP in the U-boot loader. What I want is mounting th= e root filesystem that's been created in the USB flash drive (this hard= ware has USB port) using the ufs:/dev/da0s1a method but before that happens= , I need to create that root filesystem (/) from scratch in the USB flash d= rive so that it can be mounted right after the kernel is loaded.
=C2=A0
Not sure what level I am as a FreeBSD user but I can install and setup= FreeBSD system, networking, install packages and re-build or compile a ker= nel.
=C2=A0
Thanks and best regards,
Archimedes


Hi,

To create the root filesystem on USB you can use several methods. 2 of them= are like this:
* the "bsdinstall" tool
* or
=C2=A0=C2=A0=C2=A0 - fetch https://download.freebs= d.org/ftp/snapshots/arm64/13.1-STABLE/base.txz (change the URL if you n= eed a different architecture or FreeBSD version)
=C2=A0=C2=A0=C2=A0 - newfs /dev/da0s1a=C2=A0=C2=A0=C2=A0 (NB: this device n= ame might be different depending on the devices already available in your s= ystem)
=C2=A0=C2=A0=C2=A0 - mount /dev/da0s1a /mnt
=C2=A0=C2=A0=C2=A0 - tar xf -C /mnt <path-to>/base.txz
=C2=A0=C2=A0=C2=A0 - umount /mnt

This is from the top of my head, so I might have forgotten something.

Than plugin the USB on your embedded system and at the prompt type:
mountroot> ufs:/dev/da0s1a

If it does not work type a "?" question mark to see what filesyst= ems are available.

If you want to persist the FS used as root filesystem it depends on the sys= tem you are running.
You can hardcode the root FS in the kernel you saved in the SPI RAM. But de= pending on the system it is also possible to pass the rootfs in a variable = in loader.conf or some other place from which the kernel can read variables= .

What kind of system are you running?

Hope this helps.

Regards,
Ronald.

Hi Ronald,

Thanks for sharing the information, really appreciate it! I will tr= y the newfs (newfs /dev/da0s1a) with my USB drive and then afterwards mount= it to the host system. I can't fetch the base system since I'm cro= ss-compiling a 32-bit MIPS (mipsel) system in an older FreeBSD 11.4 x86_64 = release. I just downloaded the kernel source (/usrc/src). What I have at th= e moment is a successful cross-build of a system using the build command be= low;

cd /usr/src; make KERNCONF=3DRT305X TARGET=3Dmips TARGET_ARCH=3Dmipsel = kernel-toolchain buildkernel buildworld installkernel installworld distribu= tion DESTDIR=3D/tmp/rt3050

that instead of using the DESTDIR=3D /tmp/rt3050, I will try replacing it with a mounted=20 /dev/da0s1a. And then let me also try building without the kernel.

> Than plugin the USB on your embedded system and at the prompt type:
> mountroot> ufs:/dev/da0s1a
>
> If it does = not work type a "?" question mark to see what filesystems are ava= ilable.

Noted on this.

> If you want to persist the FS used as root filesystem it depends on th= e system you are running.
> You can hard= code the root FS in the kernel you saved in the SPI RAM.

This is quite interestin= g but does it matter with the size of the SPI RAM as this system is only ha= ving 4MB?

> But depending on the system it is also possible to pass the rootfs in a=20 variable in loader.conf or some other
= > place from which the kernel can=20 read variables.
>
> What kind of system are you running?
>
> Hope this helps.=20

Again= , this is a 32-bit MIPS system based on Ralink SoC. Apologize for this one = because I know the FreeBSD project already phased-out this architecture pla= tform in the -CURRENT builds and for support and it happens that I came lat= e on this architecture and eager to learn and explore. Yes, the one you'= ;ve shared means a lot to me. Let me try and get back on the progress.

Thanks and= best regards,
Archimedes

--00000000000073d5ea05eab0778f--