Tiny Core Base > TCB Tips & Tricks
Repack initramfs file script
(1/1)
teh-botol:
Hi Guys,
I just want to share a script to repack initramfs file with new files.
Background:
When we go custom (like creating kiosk), we need edit/add some file into the TC base.
Based on tinycorebook, many bootloader support more than one initramfs, but some is not.
I play with RPi to create appliances. Unfortunately, bootloader at piCore can't load 2 initramfs (CMIIW, I have tried many combination in config.txt).
Hence I create a script to ease the job.
Description:
--- Code: ---Create a new initramfs file from original file overwritten with custom files.
Usage:
repack_initrmfs.sh [args]
args:
Ori.gz New.gz CustDir Do the job.
e Input.gz DestDir Extract initramfs file.
p Output.gz InDir Pack initramfs file.
g InDir Filter gzip all filtered files inside directory.
h (or no-args) This help.
--- End code ---
We create a custom directory for files we need to edit/add into TC base.
Using the script, it will:
1. Extract original TC base.
2. Copy all file from custom directory into extracted one (overwrite existing).
3. Repack into a new initramfs file.
Comment/feedback is appreciated.
Especially to make bootloader support more than one initramfs.
BR,
adit
bmarkus:
Review usage of sudo, better to drop it everywhere in the script. Just one line as example:
--- Code: ---find . | sudo cpio -o -H newc | sudo gzip > $workdir/$OUT
--- End code ---
andyj:
In my experience you should use sudo for find to get non-tc readable directories, but you don't need it for gzip and you can't redirect to a non-tc writable directory anyway unless you sudo a new shell.
--- Code: ---sudo find . | sudo cpio -o -H newc | gzip >$workdir/$OUT
--- End code ---
Navigation
[0] Message Index
Go to full version