Date: Tue, 11 Oct 2022 00:15:12 +0800 From: Archimedes Gaviola <archimedes.gaviola@gmail.com> To: Ronald Klop <ronald-lists@klop.ws> Cc: freebsd-fs@freebsd.org Subject: Re: UFS in a USB flash drive (ufs:/dev/da0s1a) Message-ID: <CAJFbk7HnHuXveNWqCBNXmuJC1TLQ6vX-Ovun0i4Wp%2BNDirWPXw@mail.gmail.com> In-Reply-To: <896114746.217581.1665409172569@localhost> References: <CAJFbk7G%2BULUbhOpjFiZZ_szEFzdTkw=FLdzHrrwFnZ7sz3u1oA@mail.gmail.com> <1630032913.129053.1665400270350@localhost> <CAJFbk7FTuV3eikhQaRAp8OgRmK7JpSWRxZ9DiBgMiQMwY2Nx_g@mail.gmail.com> <896114746.217581.1665409172569@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000073d5ea05eab0778f Content-Type: text/plain; charset="UTF-8" On Mon, Oct 10, 2022 at 9:39 PM Ronald Klop <ronald-lists@klop.ws> wrote: > > > *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. > 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 <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 10, 2022 at 9:39 PM Ronal= d Klop <<a href=3D"mailto:ronald-lists@klop.ws">ronald-lists@klop.ws</a>= > wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px = 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div= >=C2=A0 <p><b>Van:</b> Archimedes Gaviola <<a href=3D"mailto:archimedes.gaviola@= gmail.com" target=3D"_blank">archimedes.gaviola@gmail.com</a>><br> <b>Datum:</b> maandag, 10 oktober 2022 14:09<br> <b>Aan:</b> Ronald Klop <<a href=3D"mailto:ronald-lists@klop.ws" target= =3D"_blank">ronald-lists@klop.ws</a>><br> <b>CC:</b> <a href=3D"mailto:freebsd-fs@freebsd.org" target=3D"_blank">free= bsd-fs@freebsd.org</a><br> <b>Onderwerp:</b> Re: UFS in a USB flash drive (ufs:/dev/da0s1a)</p> <blockquote style=3D"padding-right:0px;padding-left:5px;margin-left:5px;bor= der-left:2px solid rgb(0,0,0);margin-right:0px"> <div id=3D"m_-3043840754086938325P"> <div> <div id=3D"m_-3043840754086938325P.P.P"> <div> <div>=C2=A0</div> =C2=A0 <div class=3D"gmail_quote"> <div class=3D"gmail_attr">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</a>> wrote:</div> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left:1px solid rgb(204,204,204);padding-left:1ex"> <div>=C2=A0 <p><b>Van:</b> Archimedes Gaviola <<a href=3D"mailto:archimedes.gaviola@= gmail.com" target=3D"_blank">archimedes.gaviola@gmail.com</a>><br> <b>Datum:</b> maandag, 10 oktober 2022 12:40<br> <b>Aan:</b> <a href=3D"mailto:freebsd-fs@freebsd.org" target=3D"_blank">fre= ebsd-fs@freebsd.org</a><br> <b>Onderwerp:</b> UFS in a USB flash drive (ufs:/dev/da0s1a)</p> <blockquote style=3D"padding-right:0px;padding-left:5px;margin-left:5px;bor= der-left:2px solid rgb(0,0,0);margin-right:0px"> <div id=3D"m_-3043840754086938325m_3250660044061444343P"> <div> <div id=3D"m_-3043840754086938325m_3250660044061444343P.P.P"> <div> <div> <div>Hi,</div> <div>=C2=A0</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 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?</di= v> <div>=C2=A0</div> <div>...</div> <div>=C2=A0</div> <div>=C2=A0</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> =C2=A0 <fstype>:<device> [options]<br> =C2=A0 =C2=A0 =C2=A0 Mount <device> using filesystem <fstype><b= r> =C2=A0 =C2=A0 =C2=A0 and with the specified (optional) option list.<br> <br> =C2=A0 =C2=A0 eg. ufs:/dev/da0s1a<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 zfs:tank<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 cd9660:/dev/cd0 ro<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (which is equivalent to: mount -t cd9660= -o ro /dev/cd0 /)<br> <br> =C2=A0 ? =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 List valid disk b= oot devices<br> =C2=A0 . =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Yield 1 second (f= or background tasks)<br> =C2=A0 <empty line> =C2=A0 =C2=A0Abort manual input<br> <br> mountroot></div> <div>=C2=A0</div> <div>...</div> <div>=C2=A0</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 big= gest concern. You just want to install on a USB flash drive.<br> <br> Does this help: <a href=3D"https://docs.freebsd.org/en/books/handbook/bsdin= stall/" target=3D"_blank">https://docs.freebsd.org/en/books/handbook/bsdins= tall/</a> ?<br> <br> Regards,<br> Ronald.<br> =C2=A0</div> </blockquote> <div>=C2=A0</div> <div>Hi Ronald,</div> <div>=C2=A0</div> <div>=C2=A0</div> <div>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.</div> <div>=C2=A0</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 ker= nel.</div> <div>=C2=A0</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> =C2=A0=C2=A0=C2=A0 - fetch <a href=3D"https://download.freebsd.org/ftp/snap= shots/arm64/13.1-STABLE/base.txz" target=3D"_blank">https://download.freebs= d.org/ftp/snapshots/arm64/13.1-STABLE/base.txz</a> (change the URL if you n= eed a different architecture or FreeBSD version)<br> =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)<br> =C2=A0=C2=A0=C2=A0 - mount /dev/da0s1a /mnt<br> =C2=A0=C2=A0=C2=A0 - tar xf -C /mnt <path-to>/base.txz<br> =C2=A0=C2=A0=C2=A0 - 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> ufs:/dev/da0s1a<br> <br> If it does not work type a "?" question mark to see what filesyst= ems are available.<br> <br> If you want to persist the FS used as root filesystem it depends on the sys= tem you are running.<br> 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= .<br> <br> What kind of system are you running?<br> <br> Hope this helps.<br> <br> Regards,<br> Ronald.<br></div></blockquote><div><br></div></div><div class=3D"gmail_quot= e">Hi Ronald,</div><div class=3D"gmail_quote"><br></div><div class=3D"gmail= _quote">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; <br></div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quo= te">cd /usr/src; make KERNCONF=3DRT305X TARGET=3Dmips TARGET_ARCH=3Dmipsel = kernel-toolchain buildkernel buildworld installkernel installworld distribu= tion DESTDIR=3D/tmp/rt3050</div><div class=3D"gmail_quote"><br></div><div c= lass=3D"gmail_quote"> 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.</div><di= v class=3D"gmail_quote"><br></div><div class=3D"gmail_quote"> > Than plugin the USB on your embedded system and at the prompt type:</d= iv><div class=3D"gmail_quote">> mountroot> ufs:/dev/da0s1a</div><div = class=3D"gmail_quote">></div><div class=3D"gmail_quote">> If it does = not work type a "?" question mark to see what filesystems are ava= ilable.</div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote= ">Noted on this.<br></div><div class=3D"gmail_quote"><br></div><div class= =3D"gmail_quote"> > If you want to persist the FS used as root filesystem it depends on th= e system you are running.</div><div class=3D"gmail_quote">> You can hard= code the root FS in the kernel you saved in the SPI RAM.</div><div class=3D= "gmail_quote"><br></div><div class=3D"gmail_quote">This is quite interestin= g but does it matter with the size of the SPI RAM as this system is only ha= ving 4MB?<br></div><div class=3D"gmail_quote"><br></div><div class=3D"gmail= _quote">> But depending on the system it is also possible to pass the rootfs in a=20 variable in loader.conf or some other <br></div><div class=3D"gmail_quote">= > place from which the kernel can=20 read variables.</div><div class=3D"gmail_quote">></div><div class=3D"gma= il_quote">> What kind of system are you running?</div><div class=3D"gmai= l_quote">></div><div class=3D"gmail_quote"> > Hope this helps.=20 </div><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">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.</div= ><div class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">Thanks and= best regards,</div><div class=3D"gmail_quote">Archimedes</div><div class= =3D"gmail_quote"><br></div></div> --00000000000073d5ea05eab0778f--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJFbk7HnHuXveNWqCBNXmuJC1TLQ6vX-Ovun0i4Wp%2BNDirWPXw>