From nobody Mon Oct 10 13:39:32 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 4MmKlX37Xhz4fS03 for ; Mon, 10 Oct 2022 13:39:36 +0000 (UTC) (envelope-from SRS0=7aXz=2L=klop.ws=ronald-lists@realworks.nl) Received: from smtp-relay-int.realworks.nl (smtp-relay-int.realworks.nl [194.109.157.24]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4MmKlV3JZDz3xl6 for ; Mon, 10 Oct 2022 13:39:34 +0000 (UTC) (envelope-from SRS0=7aXz=2L=klop.ws=ronald-lists@realworks.nl) Date: Mon, 10 Oct 2022 15:39:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=klop.ws; s=rw2; t=1665409172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ElWEMos4ud9l6DrnYc32nBR+PslRZ2OlDyVD1EKHt3c=; b=up610SQKtIhaG3P4XJQ7IszNEFmtUYykli1/BLu17/oLIJDpaVZOZc6XCUB/otg09RibwE Mkt0p2RYiKe++OBQYUsPfLUMQZdTFQPifgBQjPaR7bBElpnLA32Qi5VQpF5KMjLrqE0qbz 3W5NOgJGqcv/YYaP+KOIvwl+HeEJTyx/UH5G7qBAEZuU0/i1sL+459lHtzOI3pr6njF7fx LYHUGZpAp1iY01SwO9b60phCKUen9K0MoBYb+v65ksYAtoM3Euayre+m5Lz7fSwLZKwE2R StO7Jsti7fL8PS4wxmMGexmwOAWjUpZoAxy7x3Q9OKbbRQfSOxsv/8mA1ZaaIg== From: Ronald Klop To: Archimedes Gaviola Cc: freebsd-fs@freebsd.org Message-ID: <896114746.217581.1665409172569@localhost> In-Reply-To: References: <1630032913.129053.1665400270350@localhost> Subject: Re: UFS in a USB flash drive (ufs:/dev/da0s1a) 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 Content-Type: multipart/alternative; boundary="----=_Part_217580_2099596757.1665409172565" X-Mailer: Realworks (627.29) Importance: Normal X-Priority: 3 (Normal) X-Rspamd-Queue-Id: 4MmKlV3JZDz3xl6 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=klop.ws header.s=rw2 header.b=up610SQK; dmarc=pass (policy=quarantine) header.from=klop.ws; spf=pass (mx1.freebsd.org: domain of "SRS0=7aXz=2L=klop.ws=ronald-lists@realworks.nl" designates 194.109.157.24 as permitted sender) smtp.mailfrom="SRS0=7aXz=2L=klop.ws=ronald-lists@realworks.nl" X-Spamd-Result: default: False [-3.13 / 15.00]; NEURAL_HAM_SHORT(-1.00)[-0.999]; NEURAL_HAM_MEDIUM(-0.99)[-0.991]; NEURAL_HAM_LONG(-0.94)[-0.943]; DMARC_POLICY_ALLOW(-0.50)[klop.ws,quarantine]; MID_RHS_NOT_FQDN(0.50)[]; FORGED_SENDER(0.30)[ronald-lists@klop.ws,SRS0=7aXz=2L=klop.ws=ronald-lists@realworks.nl]; R_SPF_ALLOW(-0.20)[+ip4:194.109.157.0/24]; R_DKIM_ALLOW(-0.20)[klop.ws:s=rw2]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MLMMJ_DEST(0.00)[freebsd-fs@freebsd.org]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[klop.ws:+]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; HAS_X_PRIO_THREE(0.00)[3]; TAGGED_RCPT(0.00)[]; ASN(0.00)[asn:3265, ipnet:194.109.0.0/16, country:NL]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[ronald-lists@klop.ws,SRS0=7aXz=2L=klop.ws=ronald-lists@realworks.nl] X-ThisMailContainsUnwantedMimeParts: N ------=_Part_217580_2099596757.1665409172565 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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. ------=_Part_217580_2099596757.1665409172565 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit  

Van: Archimedes Gaviola <archimedes.gaviola@gmail.com>
Datum: maandag, 10 oktober 2022 14:09
Aan: Ronald Klop <ronald-lists@klop.ws>
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 <ronald-lists@klop.ws> wrote:
 

Van: Archimedes Gaviola <archimedes.gaviola@gmail.com>
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:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      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)
  <empty line>    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 <path-to>/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.

  ------=_Part_217580_2099596757.1665409172565--