WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: PiCore image creating  (Read 4508 times)

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
PiCore image creating
« on: January 22, 2017, 10:00:18 PM »
Hello Bela.

Couldn't sleep well this morning because maybe i figured out what problem you have with the picore image.
In my head.. there something saying OPTION BASE like the Basic command.
Where to start count from, start from 0 or start from 1.

Thinking like,when Bela making the picore image.. he just type in that the starting block of 1.
He just need to type in 0 as start. Have seen in the image that the first partition start with a gap of 4M.
Maybe this is also some explanation of why the image lost the counting at the end..missing one block.


//Patrik

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: PiCore image creating
« Reply #1 on: January 23, 2017, 12:36:47 AM »
Have now tried to accomplish what i mean. Why not try this.
To make 100 meg image.
Don't know if this working or not... haven't tested my self with pi.
Just making the image on my laptop.
Added -a to parted to tell none alignment.
Don't know if the none alignment will slow down the performance.   

dd if=/dev/zero of=image.img bs=1M count=100M
(export LANG=C;parted -a none -s image.img mktable msdos mkpart primary fat32 0 30M mkpart primary ext4 30M 100%)
« Last Edit: January 23, 2017, 12:50:57 AM by patrikg »

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: PiCore image creating
« Reply #2 on: January 23, 2017, 01:20:02 AM »
Missed the count should be 100 not 100M

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: PiCore image creating
« Reply #3 on: January 23, 2017, 01:25:32 AM »

He just need to type in 0 as start. Have seen in the image that the first partition start with a gap of 4M.
Maybe this is also some explanation of why the image lost the counting at the end..missing one block.


Are you saying that mmcblk0p1 must start on 0 instead of 8192?

Code: [Select]
tc@box:~$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 7.3 GiB, 7780433920 bytes, 15196160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0009bf4f

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192    69631    61440   30M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      69648 11788415 11718768  5.6G 83 Linux
tc@box:~$
Béla
Ham Radio callsign: HA5DI

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

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: PiCore image creating
« Reply #4 on: January 23, 2017, 01:44:22 AM »
Not must, but you loose 4M at start of partition.

You could also start with 1s, to specify the first sector. when sector size=512

I am continue on my path to test out my theory.
Using following after the image dd maked and parted with parted.

sudo losetup -o $((512*1)) /dev/loop0 image.img
mkdir sdimg
sudo mkfs.vfat /dev/loop0
sudo dosfslabel /dev/loop0 RASPBOOT
sudo mount /dev/loop0 sdimg

Picture says more :)

« Last Edit: January 23, 2017, 02:04:29 AM by patrikg »

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: PiCore image creating
« Reply #5 on: January 23, 2017, 02:08:46 AM »
Raspbian starts at 8192 also to leave room for the BOOT at the beginning of card. Just for curiosity you can try to repartition it starting at the very beginning and see wheter it boots or not.  Let me know the result. I have never tried :)
« Last Edit: January 23, 2017, 02:11:12 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

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

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: PiCore image creating
« Reply #6 on: January 23, 2017, 02:19:35 AM »
Okey lets see.

Code: (bash) [Select]
parted 2017-01-11-raspbian-jessie.img print
Model:  (file)
Disk 2017-01-11-raspbian-jessie.img: 4372MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      4194kB  70.3MB  66.1MB  primary  fat32        lba
 2      70.3MB  4372MB  4301MB  primary  ext4

Code: (bash) [Select]
parted piCore-8.1.5.img print
Model:  (file)
Disk piCore-8.1.5/piCore-8.1.5.img: 46.1MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      4194kB  35.7MB  31.5MB  primary  fat16        lba
 2      35.7MB  46.1MB  10.5MB  primary  ext4

You are absolutely right.
Haven't thought about this with raspbian.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: PiCore image creating
« Reply #7 on: January 23, 2017, 09:16:11 AM »
If you format a SD Card with SD Card for matter from the SD Card association, it will start at 8192.  (At least for cards over 2 or 4GB) 

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: PiCore image creating
« Reply #8 on: September 06, 2022, 09:58:31 PM »
Sorry to start this thread again, but I've been thinking about this a lot.
I think I know why the partition starts two sectors away.

It is so that the boot code will have space for MBR.
Now when you run with a fat partition on a raspberry pi that does not require any boot code.
I think you can start the partition much earlier.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: PiCore image creating
« Reply #9 on: September 07, 2022, 01:55:44 AM »
You can try it, verify your idea and share result with us :)
Béla
Ham Radio callsign: HA5DI

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