WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Remastering piCore images  (Read 7756 times)

Offline Zlika

  • Newbie
  • *
  • Posts: 29
Remastering piCore images
« on: January 24, 2017, 10:57:10 AM »
Hi all,

I try to remaster the piCore image and I have some problems. I already know how to remaster TinyCore, but doing the same with piCore is slightly different and not documented.

* On TinyCore, the simplest way to remaster is to use a separate image with our modifications and boot with two initrd (initrd=/boot/core.gz,/boot/myimg.gz). Is there a way to do something similar with piCore in the config.txt file?
* I then tried to extract the 8.1.5v7.gz file to make changes directly in the image file and repackage the file:
Code: [Select]
cp /mnt/mmcblk0p1/8.1.5v7.gz /mnt/mmcblk0p2/
cd /mnt/mmcblk0p2/
unzip 8.1.5v7.gz
mkdir src
cd src
cpio -idv < ../8.1.5v7
<!-- Change some files -->
find | cpio -o -H newc | gzip -2 > /mnt/mmcblk0p1/8.1.5v7.gz

I have two questions:
* Even when changing nothing inside the image, the size of the repackaged image is slightly bigger than the original one: how is the original image generated in the first place?
* If I change a file in the opt folder (bootsync.sh, bootlocal.sh, shutdown.sh, tcemirror) the change is not present when I boot (even with no extension loaded). I think these files must be overriden during the boot process but I don't know how: how are we supposed to change bootsync/bootlocal when we remaster?

Thank you for your answers.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Remastering piCore images
« Reply #1 on: January 24, 2017, 11:09:09 AM »
This is not the correct way to extract the initrd
Quote
unzip 8.1.5v7.gz
See  http://wiki.tinycorelinux.net/wiki:remastering .
It's valid for piCore as well except for the name of the initrd and I personally don't use  advcomp.tcz  (advdef).

The files in  /opt  are probably overwritten by the backup file.
Download a copy and keep it handy: Core book ;)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: Remastering piCore images
« Reply #2 on: January 24, 2017, 11:58:04 AM »
For limited bootloaders, you can use the "cat them together" method. Keep the original initrd untouched, and instead of telling the bootloader to use two initrds, tell it to use a combined one.

cat core.gz myimg.gz > combined.gz
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Remastering piCore images
« Reply #3 on: January 24, 2017, 01:02:24 PM »
Hi Zlika
Quote
* If I change a file in the opt folder (bootsync.sh, bootlocal.sh, shutdown.sh, tcemirror) the change is not present when I boot (even with no extension loaded). I think these files must be overriden during the boot process but I don't know how: how are we supposed to change bootsync/bootlocal when we remaster?
The directory structure in the  initrd  is used to set up initial default values of files when booting up. Some of these files may
be overridden depending on which extensions get loaded, what was backed up, and whether you have persistent  /home
and/or  /opt  directories.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 708
Re: Remastering piCore images
« Reply #4 on: January 24, 2017, 06:35:35 PM »
This is how i do it, and it works.

Extract:
Code: (bash) [Select]
sudo su
mount /mnt/mmcblk0p1/
mkdir /tmp/extract
cd /tmp/extract
zcat /mnt/mmcblk0p1/8.1.5.gz | cpio -i -H newc -d

Compact:
Code: (bash) [Select]
sudo su
mount /mnt/mmcblk0p1/
cd /tmp/extract
find | cpio -o -H newc | gzip -2 > /mnt/mmcblk0p1/8.1.5.gz

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Remastering piCore images
« Reply #5 on: January 24, 2017, 07:31:01 PM »
I just tried with
Code: [Select]
advdef -z4 8.1.3v7.gz
and it still works.
So advcomp is not the problem.
Download a copy and keep it handy: Core book ;)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Remastering piCore images
« Reply #6 on: January 24, 2017, 08:03:54 PM »
I have no idea if this extension will work for pi but when I was making small changes to the core.gz frequently, I made an extension called core-remaster.tcz.  It extracts the original gz file and repacks it after you've made personal modifications.  It's easy, no fuss, it's available in the Tc-7 repo  and I've been told it works well.

It's worth a try, see core-remaster.tcz.info for details

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Remastering piCore images
« Reply #7 on: January 25, 2017, 01:14:27 AM »
Initrd is created with as below, no tricks:

Code: [Select]
find | cpio -o -H newc | gzip -9 > initrd.gz
Keep in mind backup which content may modify initrd when restored by the system during startup.
Béla
Ham Radio callsign: HA5DI

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

Offline andriusr

  • Newbie
  • *
  • Posts: 34
Re: Remastering piCore images
« Reply #8 on: January 25, 2017, 10:53:02 AM »
coreplayer2,
I could not find core-remaster.tcz in repo... Checked /tinycorelinux/7.x/armv6/tcz and /tinycorelinux/7.x/armv7/tcz . Could you provide more details where it is located?

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Remastering piCore images
« Reply #9 on: January 25, 2017, 10:57:18 AM »
coreplayer2,
I could not find core-remaster.tcz in repo... Checked /tinycorelinux/7.x/armv6/tcz and /tinycorelinux/7.x/armv7/tcz . Could you provide more details where it is located?
In the TC-7 default repo
http://tinycorelinux.net/7.x/x86/tcz/core-remaster.tcz.info
don't forget the deps..

Offline Zlika

  • Newbie
  • *
  • Posts: 29
Re: Remastering piCore images
« Reply #10 on: January 26, 2017, 10:32:22 AM »
Thank you for your answers. My problems with files in opt/ directory was indeed caused by an old backup file  :-\