Boot kernel from ufs:md0 gives error 22 on AVILA arm board
Monthadar Al Jaberi
monthadar at gmail.com
Mon Nov 14 18:15:29 UTC 2011
sorry I mixed little endiean with big endiean.
br,
On Mon, Nov 14, 2011 at 6:15 PM, Monthadar Al Jaberi
<monthadar at gmail.com> wrote:
> Hi,
>
> I am having problems booting from ufs:md0 and hope you can help me.
>
> I changed the default configuration file AVILA so that it boots from
> MD instead of NFS.
> options MD_ROOT #MD is a potential root device
> options MD_ROOT_SIZE=4096
> options ROOTDEVNAME=\"ufs:md0\"
>
> I then generated a filesystem and embedded it inside kernel like this:
> makefs -t ffs -B little -s 4m avila.img path/to/root
>
> addr=($(strings -td kernel.bin | grep "MFS Filesystem" | awk '{print
> $1}')) #calculate start and end address for mdroot
> rootfs_start=${addr[0]}
> rootfs_end=$((${addr[1]}+1))
> echo "Generating kernel image for AVILA from ${rootfs_start} to ${rootfs_end}"
> head -c ${rootfs_start} kernel.bin > kernel.new
> cat avila.img >> kernel.new
> tail -c +${rootfs_end} kernel.bin >> kernel.new
>
> then from redboot:
> load -b 0x00200000 kernel.new
> go
>
> and I get following error:
> Trying to mount root from ufs:/dev/md0 []...
> Mounting from ufs:/dev/md0 failed with error 22.
> Trying to mount root from ufs:md0 []...
> Mounting from ufs:md0 failed with error 22.
>
> 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/acd0 ro
> (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /)
>
> ? List valid disk boot devices
> . Yield 1 second (for background tasks)
> <empty line> Abort manual input
>
> mountroot> ?
>
> List of GEOM managed disk devices:
> redboot/FIS directory redboot/RedBoot config redboot/RedBoot cfid0 md0
>
> mountroot>
>
> The md0 partition is there. And this is how I do it for the
> RouterStation Pro and it works there.
>
> When I debug the kernel code I see that the EINVAL is generated from
> /*
> * Common code for mount and mountroot
> */
> static int
> ffs_mountfs(devvp, mp, td)
> struct vnode *devvp;
> struct mount *mp;
> struct thread *td;
> {
> ...
> /*
> * Try reading the superblock in each of its possible locations.
> */
> for (i = 0; sblock_try[i] != -1; i++) {
> ...
> }
> if (sblock_try[i] == -1) {
> error = EINVAL; /* XXX needs translation */
> goto out;
> }
> ...
> }
>
> What am I doing wrong? any help is very appreciated.
> Best regards
> --
> Monthadar Al Jaberi
>
--
Monthadar Al Jaberi
More information about the freebsd-fs
mailing list