WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How can I mount piCore-8.0.img for usage in chroot?  (Read 2266 times)

Offline eggze

  • Newbie
  • *
  • Posts: 7
How can I mount piCore-8.0.img for usage in chroot?
« on: October 18, 2016, 01:16:50 PM »
Hi,

I'm trying to learn how to cross-compile things for RPi & piCore. I found that there exists several methods how to do it, either to run piCore in QEMU completely, or use some toolchains, or use chroot with qemu-user-static package. Problem is that I'm not, for some reason, to mount the image I've downloaded. It doesn't depend if it's piCore 7.0 or 8.0 or arm6 or arm7. MD5 sums of img files are ok.

This is what I get when I use kpartx:
Code: [Select]
$ sudo kpartx -a -v piCore-8.0.img
add map loop0p1 (254:0): 0 61440 linear 7:0 8192
device-mapper: resume ioctl on loop0p2 failed: Invalid argument
create/reload failed on loop0p2

With losetup:
Code: [Select]
$ sudo losetup --find --show "piCore-8.0.img"
/dev/loop0
$ ls -l /dev | grep loop0
brw-rw----  1 root disk        7,   0 18.10.2016 22:09 loop0

When I mount .img file from Nautils through Disk Image Mounter, then I see /dev/loop0p1 and /dev/loop0p2 but then:
Code: [Select]
sudo mount /dev/loop0p2 mnt
mount: /dev/loop0p2 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/loop0p2,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
or
Code: [Select]
sudo mount /dev/loop0p1 mnt
mount: /dev/loop0p1 is write-protected, mounting read-only
which also doesn't seem to be right…

Am I just doing something wrong. Am I missing some tool/package installed?

Thanks
Btw. I'm trying to use this method: http://raspberrypi.stackexchange.com/a/54288
« Last Edit: October 18, 2016, 01:26:08 PM by eggze »

Offline eggze

  • Newbie
  • *
  • Posts: 7
Re: How can I mount piCore-8.0.img for usage in chroot?
« Reply #1 on: October 19, 2016, 01:07:46 PM »
It looks like Ext4 partition in the img file has incorrect size:
Code: [Select]
EXT4-fs (loop2): bad geometry: block count 11736 exceeds size of device (11735 blocks)

Offline eggze

  • Newbie
  • *
  • Posts: 7
Re: How can I mount piCore-8.0.img for usage in chroot?
« Reply #2 on: October 20, 2016, 12:51:05 PM »
I'm still not able to figure out what I'm doing wrong…

I've just tried all methods listed here: http://stackoverflow.com/questions/1419489/loopback-mounting-individual-partitions-from-within-a-file-that-contains-a-parti#9153530 and I always get:
Code: [Select]
mount: wrong fs type, bad option, bad superblock on /dev/loop0p2and
Code: [Select]
EXT4-fs (loop0p2): bad geometry: block count 11736 exceeds size of device (11735 blocks)
Is it just stupid to try it this way? Is there any other way how to prepare environment for chroot with usage of qemu-user-static?

Thank you!
« Last Edit: October 20, 2016, 12:52:41 PM by eggze »

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: How can I mount piCore-8.0.img for usage in chroot?
« Reply #3 on: October 20, 2016, 11:50:48 PM »
Thanks for reporting the issue. piCore image file is missing the last sector, it will be corrected in the download. As a temporary fox just add few kb of any data to the image file to make it longer and retry. It works here on piCore-8.0

Don't forget to install utillinux.tcz

Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."