Re: UFS in a USB flash drive (ufs:/dev/da0s1a)
- Reply: Ronald Klop : "Re: UFS in a USB flash drive (ufs:/dev/da0s1a)"
- In reply to: Ronald Klop : "Re: UFS in a USB flash drive (ufs:/dev/da0s1a)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Oct 2022 16:15:12 UTC
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