UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer leroyworld1
Observer
8,480 Views
Registered: ‎09-11-2014

Modifying ramdisk.image [last release 2014.2] - Error in login: can't set groups

Jump to solution

Hello,

 

I've been stucked on this for a few days and I don't know how to solve it.

I want to modify the ramdisk.image appending a new line at the end of the script init.d/rcS file. The line would call a script (init.sh) placed in the root of the SD Card. When the board is turned on and the linux distribution starts, the script will be called and do some stuff (mounting SDCard, config IP, starting app). The Zynq Base TRD 14.2 example has this functionality working.

I'm using the last release where I have to use cpio to extract the image instead of mounting it. The process would be something like:

$ dd if=./uramdisk.image.gz of=./ramdisk.image.gz skip=16 bs=4    (to extract the header)
$ gunzip ramdisk.image.gz  
$ mkdir tmp
$ cp ramdisk.image tmp/ ; cd tmp;
$ cpio -idu < ramdisk.image   (extract the files)
[... modify files ...]
$ rm ramdisk.image
$ find . | cpio --create --format='newc' > ramdisk.image    (compress the files)
$ gzip ramdisk.image
$ mkimage -A arm -T ramdisk -C gzip -d ramdisk.image.gz uramdisk.image.gz   (create uimage)

I had to find how to use cpio given that the wiki info is outdated for this one. If I omit the instructions in red, the board is able to start from the SD card what means I'm doing something wrong in the inner red operations. After getting some permissions errors and using chmod to solve them (maybe im messing up here...), I made all the process work out eventually. But now when I try to login (even without modifying any files):

zynq login: root
Password: root
Error > login: can't set groups: Operation not permitted.

I would appreciate any help!

Regards,
Brais


0 Kudos
1 Solution

Accepted Solutions
Scholar norman_wong
Scholar
12,576 Views
Registered: ‎05-28-2012

Re: Modifying ramdisk.image [last release 2014.2] - Error in login: can't set groups

Jump to solution

I think you are losing the root ownership somewhere in those commands. Here's what I do on a Ubuntu host under a normal user. Must sudo at the right spots to maintain root ownership. I think I got this from the Xilinx Wiki.

 

sudo mkdir /tmp/rootfs
dd if=uramdisk.image.gz of=ramdisk.image.gz bs=64 skip=1
gunzip -c ramdisk.image.gz | sudo sh -c 'cd /tmp/rootfs/ && cpio -i'
#make changes in /tmp/rootfs/. Be sure to sudo all commands.
sh -c 'cd /tmp/rootfs/ && sudo find . | sudo cpio -H newc -o' | gzip -9 > ramdisk.image.gz
mkimage -A arm -T ramdisk -C gzip -d ramdisk.image.gz uramdisk.image.gz
rm ramdisk.image.gz
sudo rm -rf /tmp/rootfs

5 Replies
Observer madison_a
Observer
8,461 Views
Registered: ‎06-13-2014

Re: Modifying ramdisk.image [last release 2014.2] - Error in login: can't set groups

Jump to solution

My build system does the following:

 

(hopefully its obvious that the variables below are "arbirtary" or need to match where your files are. My ramdisk is also extra large. Believe the standard size is 16K.

 

# create the space for a ramdisk

/usr/bin/dd if=/dev/zero of=$(IMAGEDIR)/$(RAMDISKIMAGE) bs=1024 count=32768

/usr/sbin/mke2fs -F $(IMAGEDIR)/$(RAMDISKIMAGE) -L "ramdisk" -b 1024 -m 0

/usr/sbin/tune2fs $(IMAGEDIR)/$(RAMDISKIMAGE) -i 0

/usr/bin/chmod 777 $(IMAGEDIR)/$(RAMDISKIMAGE)

# using the flexibility ot the media partition to host the ramdisk file system

sudo mkdir -p $(ROOTDIR)/media/ramdisk

#mount a virtual filesystem for the ramdisk

sudo /usr/bin/mount -o loop $(IMAGEDIR)/$(RAMDISKIMAGE) $(ROOTDIR)/media/ramdisk

# from the built up heirarchy with $(ROMFSDIR) representing the root of the zynqs ARM ramdisk

# duplicate all files into the virtual file system

-(cd $(ROMFSDIR); sudo find . | sudo cpio -pdum $(ROOTDIR)/media/ramdisk

sudo /usr/bin/umount $(ROOTDIR)/media/ramdisk

gzip -9 $(IMAGEDIR)/$(RAMDISKIMAGE)

mkimage -A arm -T ramdisk -C gzip -d $(IMAGEDIR)/$(RAMDISKIMAGE).gz $(MAGEDIR)/u$(RAMDISKIMAGE).gz

 

Hope this helps.

Observer madison_a
Observer
8,460 Views
Registered: ‎06-13-2014

Re: Modifying ramdisk.image [last release 2014.2] - Error in login: can't set groups

Jump to solution
typo, missing end parend:

-(cd $(ROMFSDIR); sudo find . | sudo cpio -pdum $(ROOTDIR)/media/ramdisk)
0 Kudos
Observer leroyworld1
Observer
8,440 Views
Registered: ‎09-11-2014

Re: Modifying ramdisk.image [last release 2014.2] - Error in login: can't set groups

Jump to solution

Hello there,

 

thank you for your quick answer madison_a.

As I wanted to modify an existing ramdisk.image I first followed the process I posted till I extracted the files with:

$sudo cpio -idvu < ramdisk.image

This returns 'blocks = 25015' in console. Then I did what you suggested and when copying to the mount unit it returns 'blocks = 24734' what looks a little suspicious. After using the mkimage command, storing the uramdisk.image into the SDCard and booting it up, it showed up the following error:

 

mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SU08G 7.40 GiB
 mmcblk0: p1
IP-Config: Complete:
     device=eth0, hwaddr=00:0a:35:00:01:22, ipaddr=192.168.1.10, mask=255.255.255.0, gw=255.255.255.255
     host=ZC702, domain=, nis-domain=(none)
     bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
ALSA device list:
  No soundcards found.
RAMDISK: gzip image found at block 0
RAMDISK: incomplete write (14119 != 32768)
write error
VFS: Mounted root (ext2 filesystem) on device 1:0.
EXT2-fs (ram0): error: ext2_get_inode: unable to read inode block - inode=6145, block=24708
devtmpfs: error mounting -5
Freeing unused kernel memory: 184K (c05f2000 - c0620000)
attempt to access beyond end of device
ram0: rw=0, want=35158, limit=32768
attempt to access beyond end of device
ram0: rw=0, want=35142, limit=32768
Starting init: /sbin/init exists but couldn't execute it (error -5)
EXT2-fs (ram0): error: ext2_get_inode: unable to read inode block - inode=6331,  block=24731
Starting init: /etc/init exists but couldn't execute it (error -5)
EXT2-fs (ram0): error: ext2_get_inode: unable to read inode block - inode=6187, block=24713
Starting init: /bin/init exists but couldn't execute it (error -5)
EXT2-fs (ram0): error: ext2_get_inode: unable to read inode block - inode=6187, block=24713
Starting init: /bin/sh exists but couldn't execute it (error -5)
Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
CPU1: stopping
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.14.0-xilinx #10
[<c00144d0>] (unwind_backtrace) from [<c0010c44>] (show_stack+0x10/0x14)
[<c0010c44>] (show_stack) from [<c0443f6c>] (dump_stack+0x7c/0xc0)
[<c0443f6c>] (dump_stack) from [<c0012f70>] (ipi_cpu_stop+0x3c/0x6c)
[<c0012f70>] (ipi_cpu_stop) from [<c0013594>] (handle_IPI+0x64/0x84)
[<c0013594>] (handle_IPI) from [<c0008520>] (gic_handle_irq+0x58/0x60)
[<c0008520>] (gic_handle_irq) from [<c0011600>] (__irq_svc+0x40/0x70)
Exception stack(0xe688df58 to 0xe688dfa0)
df40:                                                       e688dfa0 00000000
df60: 93bcf3b1 00000000 00000000 e6fa70e8 93397dfc 00000000 c0655140 c06847c0
df80: 00000000 00000000 00000008 e688dfa0 c005e270 c0357904 00000113 ffffffff
[<c0011600>] (__irq_svc) from [<c0357904>] (cpuidle_enter_state+0x4c/0xd4)
[<c0357904>] (cpuidle_enter_state) from [<c0357a70>] (cpuidle_idle_call+0xe4/0x13c)
[<c0357a70>] (cpuidle_idle_call) from [<c000e72c>] (arch_cpu_idle+0x8/0x38)
[<c000e72c>] (arch_cpu_idle) from [<c0054460>] (cpu_startup_entry+0xbc/0x108)
[<c0054460>] (cpu_startup_entry) from [<000085c4>] (0x85c4)

It looks like I'm missing some important files when copying into the mounted unit (?) even no copy errors appeared. I even tried giving permission to all the files and subdirectories before copying (maybe that's not a good idea...) with:

$ sudo chmod -R 777 */    (executed from the rootfilesystem)

And still the same. (Some files still have the lock symbol over them...)

Thank you again. Regards,
Brais.

0 Kudos
Scholar norman_wong
Scholar
12,577 Views
Registered: ‎05-28-2012

Re: Modifying ramdisk.image [last release 2014.2] - Error in login: can't set groups

Jump to solution

I think you are losing the root ownership somewhere in those commands. Here's what I do on a Ubuntu host under a normal user. Must sudo at the right spots to maintain root ownership. I think I got this from the Xilinx Wiki.

 

sudo mkdir /tmp/rootfs
dd if=uramdisk.image.gz of=ramdisk.image.gz bs=64 skip=1
gunzip -c ramdisk.image.gz | sudo sh -c 'cd /tmp/rootfs/ && cpio -i'
#make changes in /tmp/rootfs/. Be sure to sudo all commands.
sh -c 'cd /tmp/rootfs/ && sudo find . | sudo cpio -H newc -o' | gzip -9 > ramdisk.image.gz
mkimage -A arm -T ramdisk -C gzip -d ramdisk.image.gz uramdisk.image.gz
rm ramdisk.image.gz
sudo rm -rf /tmp/rootfs

Observer leroyworld1
Observer
8,389 Views
Registered: ‎09-11-2014

Re: Modifying ramdisk.image [last release 2014.2] - Error in login: can't set groups

Jump to solution

Last post worked!!

Thank you norman_wong. Also to madison ;)

I must have been doing something wrong when following the wiki. Maybe it had something to do with the bs and skip parameters in dd command.

I will be forever in your debt guys. Regards,

Brais.

0 Kudos