LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices


Reply
  Search this Thread
Old 12-27-2013, 05:35 AM   #1
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 634
Blog Entries: 20

Rep: Reputation: 81
slackware arm 14.1 and ubifs


This morning I had a go at using ubifs on my dockstar. The journey was far from smooth.

I followed examples from the official ubifs documentation and faq (where possible), supplemanting with some bits and pieces here and there as the official documentation does not guide you trough the whole process step by step (very usefull if you're doing it for the first time).

I've the tree I want to create the image from in /root_image
I've decided to use custom mtd layout:
Code:
root@printserver:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 0ff00000 00020000 "rootfs"
root@printserver:/#
I formated /dev/mdt1, attached is and create a ubi volume:

ubiformat /dev/mtd1
ubiattach -p /dev/mtd1
ubimkvol /dev/ubi0 -N rootfs -m

I then create the ubifs image with mkfs.ubifs:

mkfs.ubifs -r /root_image -o /tmp/rootfs.img -R 1MiB -e 128KiB -m 512 -c 1500

I then update the volune with the image:
ubiupdatevol /dev/ubi0_0 /tmp/rootfs.img

But when I mount it I get this error:
root@printserver:/# mount -t ubifs ubi0_0 /mnt/floppy/
mount: wrong fs type, bad option, bad superblock on ubi0_0,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so

root@printserver:/#


Ok upon better look at dmesg it was lamenting that I issued incorrect parameters during image creation. Well I don't have any idea what would be sensible so I used stuff from examples, erroneously thinking that at worse I'd have bad performance.

After several attempts, each time correcting one option at a time, this created something I was able to write to volume and mount:
mkfs.ubifs -r /root_image -o /tmp/rootfs.img -R 2MiB -e 129024 -m 2048 -c 1500

but I still cannot boot because the initrd incorrectly parses cmdline ignoring the ubi root device spefification, replacing it with the content of rootdev in the initrd resulting in this error:
Code:
[   15.756468] UBIFS error (pid 156): ubifs_mount: cannot open "/dev/sda2", error -22
mount: mounting /dev/sda2 on /mnt failed: Invalid argument
ERROR:  No /sbin/init found on rootdev (or not mounted).  Trouble ahead.
        You can try to fix it. Type 'exit' when things are done.

/bin/sh: can't access tty; job control turned off
/ #
I think that something like this need to go in the cmdline parsin section:
Code:
root=ubi*)                                                                  
      ROOTDEV=$(echo $ARG | cut -f2- -d=)                        
    ;;
There was still more trouble ahead:
I mounted the volume manually and hoped that it would then boot but when rc.S is executed I started getting errors dew to not correctly remounting root rw and fsck.ufifs missing.

To make a dirty quick workaround I sckipped fsck on root alltogether and changed the remounting lines as follows :
# /sbin/mount -n -o remount,ro /
/sbin/mount -n -o remount,ro /dev/ubi0_0 /
# /sbin/mount -w -v -n -o remount /
/sbin/mount -w -v -n -o remount /dev/ubi0_0 /

and this got the thing booting right.
To workaround the initrd parsing problem I just recreated the initrd with "-r /dev/ubi0_0" amongst the options so that even if it's not parsed at least the content of rootdev is right.

Regards
David

Last edited by louigi600; 12-27-2013 at 04:51 PM. Reason: Reediting
 
Old 12-29-2013, 04:44 AM   #2
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,535

Rep: Reputation: 1305Reputation: 1305Reputation: 1305Reputation: 1305Reputation: 1305Reputation: 1305Reputation: 1305Reputation: 1305Reputation: 1305Reputation: 1305
Quote:
Originally Posted by louigi600 View Post
I think that something like this need to go in the cmdline parsin section:
Code:
root=ubi*)                                                                  
      ROOTDEV=$(echo $ARG | cut -f2- -d=)                        
    ;;
Did you change the cmdline though? The code in the initrd's 'init' will overwrite the defaults that the initrd was built with, if you specify root=/dev/anything - and since the ubifs (according to what you pasted in) is also under the /dev/ filesystem, the initrd should be looking for the ubi fs in the correct location.

Quote:
Originally Posted by louigi600 View Post
There was still more trouble ahead:
I mounted the volume manually and hoped that it would then boot but when rc.S is executed I started getting errors dew to not correctly remounting root rw and fsck.ufifs missing.
There is no fsck for ubifs filesystems - it doesn't exist. What needs to happen is for Slackware to skip fsck for such filesystems.
Can you see if you can get it working properly by specifying the root=/dev/ kernel cmdline? Then I'll have a look at seeing how to exclude fsck on ubifs in -current.
 
Old 12-29-2013, 10:05 AM   #3
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 634

Original Poster
Blog Entries: 20

Rep: Reputation: 81
Quote:
Originally Posted by drmozes View Post
Did you change the cmdline though? The code in the initrd's 'init' will overwrite the defaults that the initrd was built with, if you specify root=/dev/anything - and since the ubifs (according to what you pasted in) is also under the /dev/ filesystem, the initrd should be looking for the ubi fs in the correct location.

There is no fsck for ubifs filesystems - it doesn't exist. What needs to happen is for Slackware to skip fsck for such filesystems.
Can you see if you can get it working properly by specifying the root=/dev/ kernel cmdline? Then I'll have a look at seeing how to exclude fsck on ubifs in -current.
Yes the comandline had the correct device in it it's just that it's not parced by the initrd init script.
Code:
root@printserver:~# cat /proc/cmdline 
console=ttyS0,115200 ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs mtdparts=orion_nand:1M(u-boot),-(rootfs)
root@printserver:~#
I had a look at that section and nothing matches ubi device in that format so it's using what's in rootdev.
Code:
# Parse command line
for ARG in $(cat /proc/cmdline); do
  case $ARG in
    0|1|2|3|4|5|6|S|s|single)
      RUNLEVEL=$ARG
    ;;
    init=*)
      INIT=$(echo $ARG | cut -f2 -d=)
    ;;
    luksdev=/dev/*)
      LUKSDEV=$(echo $ARG | cut -f2 -d=)
    ;;
    lukskey=*)
      LUKSKEY=$(echo $ARG | cut -f2- -d=)
    ;;
    rescue)
      RESCUE=1
    ;;
    resume=*)
      RESUMEDEV=$(echo $ARG | cut -f2 -d=)
    ;;
    root=/dev/*)
      ROOTDEV=$(echo $ARG | cut -f2 -d=)
    ;;
    root=LABEL=*)
      ROOTDEV=$(echo $ARG | cut -f2- -d=)
    ;;
    root=UUID=*)
      ROOTDEV=$(echo $ARG | cut -f2- -d=)
    ;;
    rootfs=*|rootfstype=*)
      ROOTFS=$(echo $ARG | cut -f2 -d=)
    ;;
    waitforroot=*|rootdelay=*)
      WAIT=$(echo $ARG | cut -f2 -d=)
    ;;
  esac
done
I suppose insetad of passing root=ubi0:rootfs I could pass root=/dev/ubi0_0 and that would probably get parsed, but Dozan's uboot environment passes the ubi root device specification the other format: adding what I suggest to the init script would allow for both formats to be correctly parsed.
Worked around that part by just recreating an initrd with a specific root device via -r flag.

Yeah .. I made changes to my rc.S to get the system to come up right. It appearts at that time that the remount with no devive specification fails, I hadto rewrite that part with something like this:
mount -o remount,rw /dev/ubi0_0 /
This is actually odd because once the system is up I can use "mount -o remount,ro /" and "mount -o remount,rw /" without issues.
maybe that got fixed after having the device specificatuon in fstab with the /dev/ubi0_0 format too.
I'll check this out better asap, but for sure now that it's working it's in the /dev/... format:
Code:
root@printserver:~# mount
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /run type tmpfs (rw,relatime,mode=755)
devtmpfs on /dev type devtmpfs (rw,relatime,size=60180k,nr_inodes=15045,mode=755)
/dev/ubi0_0 on / type ubifs (ro,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
cgroup on /sys/fs/cgroup type cgroup (rw,relatime,net_cls,freezer,devices,cpuacct)
root@printserver:~#

Last edited by louigi600; 12-29-2013 at 10:27 AM.
 
Old 12-30-2013, 09:52 AM   #4
louigi600
Member
 
Registered: Dec 2013
Location: Italy
Distribution: Slackware
Posts: 634

Original Poster
Blog Entries: 20

Rep: Reputation: 81
I did a bit more testing and things seem to work as expected if the cmdline and fstab specifies the ubi device in the /dev/ubi0_0 format.
Not sure anymore if it makes sense to have the initrd init script parse the other format if it introduces other issues.
Code:
  root@printserver:/etc# cat /proc/cmdline 
  console=ttyS0,115200 ubi.mtd=1 root=/dev/ubi0_0 rootfstype=ubifs mtdparts=orion_nand:1M(u-boot),-(rootfs)
  root@printserver:/etc# cat /etc/fstab 
  # <file system> <mount point>   <type>  <options>       <dump>  <pass>
  proc             /proc           proc    defaults          0       0
  /dev/ubi0_0      /               ubifs  ro                 0       1
  root@printserver:/etc# mount
  proc on /proc type proc (rw,relatime)
  sysfs on /sys type sysfs (rw,relatime)
  tmpfs on /run type tmpfs (rw,relatime,mode=755)
  devtmpfs on /dev type devtmpfs (rw,relatime,size=60180k,nr_inodes=15045,mode=755)
  /dev/ubi0_0 on / type ubifs (ro,relatime)
  devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
  cgroup on /sys/fs/cgroup type cgroup (rw,relatime,net_cls,freezer,devices,cpuacct)
  root@printserver:/etc#
Prior to getting these out of the live system I did a test where I let the root mount rw and it worked right withouit having to modify the remount command
Code:
    /sbin/mount -n -o remount,ro /
  #    /sbin/mount -n -o remount,ro /dev/ubi0_0 /

   echo "Remounting root device with read-write enabled."
   /sbin/mount -w -v -n -o remount /
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The Slackware ARM Question of the day: why xf86-video-s3-0.6.5-arm-4.tgz ?!? Darth Vader Slackware 2 09-15-2013 09:23 PM
UBIFS partition on SheevaPlug znatok Linux - General 0 10-28-2012 10:12 AM
Shifting from Jffs2 to UBIFS sunr2007 Linux - Kernel 3 03-17-2011 07:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM

All times are GMT -5. The time now is 03:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration