Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Oct 2022 15:39:32 +0200 (CEST)
From:      Ronald Klop <ronald-lists@klop.ws>
To:        Archimedes Gaviola <archimedes.gaviola@gmail.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: UFS in a USB flash drive (ufs:/dev/da0s1a)
Message-ID:  <896114746.217581.1665409172569@localhost>
In-Reply-To: <CAJFbk7FTuV3eikhQaRAp8OgRmK7JpSWRxZ9DiBgMiQMwY2Nx_g@mail.gmail.com>
References:  <CAJFbk7G%2BULUbhOpjFiZZ_szEFzdTkw=FLdzHrrwFnZ7sz3u1oA@mail.gmail.com> <1630032913.129053.1665400270350@localhost> <CAJFbk7FTuV3eikhQaRAp8OgRmK7JpSWRxZ9DiBgMiQMwY2Nx_g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_217580_2099596757.1665409172565
Content-Type: text/plain; charset=us-ascii; format=flowed
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
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<html><head></head><body>&nbsp;
<p><strong>Van:</strong> Archimedes Gaviola &lt;archimedes.gaviola@gmail.com&gt;<br>
<strong>Datum:</strong> maandag, 10 oktober 2022 14:09<br>
<strong>Aan:</strong> Ronald Klop &lt;ronald-lists@klop.ws&gt;<br>
<strong>CC:</strong> freebsd-fs@freebsd.org<br>
<strong>Onderwerp:</strong> Re: UFS in a USB flash drive (ufs:/dev/da0s1a)</p>

<blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left: #000000 2px solid; margin-right: 0px">
<div class="MessageRFC822Viewer" id="P">
<div class="MultipartAlternativeViewer">
<div class="TextHTMLViewer" id="P.P.P">
<div>
<div>&nbsp;</div>
&nbsp;

<div class="gmail_quote">
<div class="gmail_attr">On Mon, Oct 10, 2022 at 7:11 PM Ronald Klop &lt;<a href="mailto:ronald-lists@klop.ws">ronald-lists@klop.ws</a>&gt; wrote:</div>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>&nbsp;
<p><b>Van:</b> Archimedes Gaviola &lt;<a href="mailto:archimedes.gaviola@gmail.com" target="_blank">archimedes.gaviola@gmail.com</a>&gt;<br>
<b>Datum:</b> maandag, 10 oktober 2022 12:40<br>
<b>Aan:</b> <a href="mailto:freebsd-fs@freebsd.org" target="_blank">freebsd-fs@freebsd.org</a><br>
<b>Onderwerp:</b> UFS in a USB flash drive (ufs:/dev/da0s1a)</p>

<blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:2px solid rgb(0,0,0);margin-right:0px">
<div id="m_3250660044061444343P">
<div>
<div id="m_3250660044061444343P.P.P">
<div>
<div>
<div>Hi,</div>

<div>&nbsp;</div>

<div>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 -&gt; ufs:/dev/da0s1a. Are there any available step-by-step reference(s) that can help and guide me in the building process?</div>

<div>&nbsp;</div>

<div>...</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>Trying to mount root from cd9660:/dev/map/rootfs.uzip []...<br>
mountroot: waiting for device /dev/map/rootfs.uzip...<br>
Mounting from cd9660:/dev/map/rootfs.uzip failed with error 19.<br>
<br>
Loader variables:<br>
<br>
Manual root filesystem specification:<br>
&nbsp; &lt;fstype&gt;:&lt;device&gt; [options]<br>
&nbsp; &nbsp; &nbsp; Mount &lt;device&gt; using filesystem &lt;fstype&gt;<br>
&nbsp; &nbsp; &nbsp; and with the specified (optional) option list.<br>
<br>
&nbsp; &nbsp; eg. ufs:/dev/da0s1a<br>
&nbsp; &nbsp; &nbsp; &nbsp; zfs:tank<br>
&nbsp; &nbsp; &nbsp; &nbsp; cd9660:/dev/cd0 ro<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /)<br>
<br>
&nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List valid disk boot devices<br>
&nbsp; . &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Yield 1 second (for background tasks)<br>
&nbsp; &lt;empty line&gt; &nbsp; &nbsp;Abort manual input<br>
<br>
mountroot&gt;</div>

<div>&nbsp;</div>

<div>...</div>

<div>&nbsp;</div>

<div>Thanks and best regards,</div>

<div>Archimedes</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>
Hi,<br>
<br>
>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.<br>
<br>
Does this help: <a href="https://docs.freebsd.org/en/books/handbook/bsdinstall/" target="_blank">https://docs.freebsd.org/en/books/handbook/bsdinstall/</a>; ?<br>
<br>
Regards,<br>
Ronald.<br>
&nbsp;</div>
</blockquote>

<div>&nbsp;</div>

<div>Hi Ronald,</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>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.</div>

<div>&nbsp;</div>

<div>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.</div>

<div>&nbsp;</div>

<div>Thanks and best regards,</div>

<div>Archimedes</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>
Hi,<br>
<br>
To create the root filesystem on USB you can use several methods. 2 of them are like this:<br>
* the "bsdinstall" tool<br>
* or<br>
&nbsp;&nbsp;&nbsp; - 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)<br>
&nbsp;&nbsp;&nbsp; - newfs /dev/da0s1a&nbsp;&nbsp;&nbsp; (NB: this device name might be different depending on the devices already available in your system)<br>
&nbsp;&nbsp;&nbsp; - mount /dev/da0s1a /mnt<br>
&nbsp;&nbsp;&nbsp; - tar xf -C /mnt &lt;path-to&gt;/base.txz<br>
&nbsp;&nbsp;&nbsp; - umount /mnt<br>
<br>
This is from the top of my head, so I might have forgotten something.<br>
<br>
Than plugin the USB on your embedded system and at the prompt type:<br>
mountroot&gt; ufs:/dev/da0s1a<br>
<br>
If it does not work type a "?" question mark to see what filesystems are available.<br>
<br>
If you want to persist the FS used as root filesystem it depends on the system you are running.<br>
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.<br>
<br>
What kind of system are you running?<br>
<br>
Hope this helps.<br>
<br>
Regards,<br>
Ronald.<br>
<br>
&nbsp;</body></html>
------=_Part_217580_2099596757.1665409172565--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?896114746.217581.1665409172569>