I'm unable to figure out how to include some directories and files that I've added to my custom CentOS 6.4 32 bit kickstart install. Is there a way to add these custom directories/files to my output iso (mycustom.iso) using mkisofs or kickstart?
command used to generate CentOS image:
#mkisofs -o mycustom.iso -b isolinux.bin -c boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table -R -J -v -T isolinux/
Put the additional directories under the rootfs you've created, where you want to see your directories. mkfsiso takes the last arg as rootfs, where additional directories can be added also.
Related
I'm creating an ISO of a Debian system with:
mkisofs -V "Debian ISO" -cache-inodes -J -l -o file.iso debian-system/
The problem is: when I mount the ISO (mount -o loop) ping and sudo don't work because their suid bits have not been set.
I know that special bis are cleared by the -r flag. This flag generates the "rationalized Rock Ridge directory information" which enables to retain the original file permissions, but also clears any set-id bits.
But if I don't use -r, file permissions will be the same for all files, as specified at runtime when the ISO is mounted.
Question: how to add set-id files like ping and sudo to a linux "live" ISO?
You need to use an alternate file system, that supports those permissions.
The way a LiveCD/DVD works is there is a squashfs file that is mounted with changes made in RAM.
You could "fake" the same by creating a file full of zeros using dd, make a file system on it wtih mkfs.ext4, mount it, and copy the files onto it. Then on your custom disk, mount it as loop (mount -o loop /path/to/file /mnt/point) and symlink/etc the binaries over.
I created a program which creates an ISO image using genisoimage
sudo genisoimage -rational-rock -cache-inodes -joliet -full-iso9660-filenames -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -output "../${ISONAME}" .
and isohybird afterwards
sudo isohybrid ${ISONAME}
It works fine when I install the outputted *.iso file using the program UNetbootin on an USB stick, but when I try to use it usign dd-command, it does not boot. Did I forget a flag / parameter or something?
You need to "bless" the generated ISO image with isohybrid.
I've installed Petalinux 2014.4 on my Zynq board, but the NAND flash is not mounted when I boot up the board. I'm wondering if it's possible to change rootfs.cpio by extracting the package and then do changes to fstab and so make a cpio arhcive back. If yes, is it enough to just run petalinux-build after that?
Thanks :)
If you have access to the ramdisk image file, then yes, you can modify its contents. I assume that your image file is compressed using gzip. Furthermore I assume that you use U-Boot and your compressed ramdisk image has a U-Boot preamble.
First you need to strip the U-Boot header:
dd bs=64 skip=1 if=uramdisk.cpio.gz of=ramdisk.cpio.gz
Next, we decompress:
gunzip ramdisk.cpio.gz
Finally we extract the CPIO archive:
mkdir ramdisk && cd ramdisk
cpio -i -F ../ramdisk.cpio
Either you execute the latter command as root or you change the file ownership back to root before archiving again. This is necessary for your init program to start. After your modifications you can create your image file again:
find . | cpio -o -H newc | gzip -9 > ../ramdisk_new.cpio.gz
mkimage -A arm -T ramdisk -C gzip -d ramdisk_new.cpio.gz uramdisk.image.gz
Notice that the mkimage tool is part of U-Boot and is located in the respective sources in the tools directory.
I am not familiar with PetaLinux so I don't know whether this general answer suits your needs and expectations.
Using cpio package tools is OK. But it needs to be done every time you updates rootfs.
You can also use PetaLinux built-in tool to accomplish this. It doesn't need extra steps once you set it up.
Create the app:
petalinux-create -t apps -n fstab_mount_sd --template install --enable
In the created components/apps/fstab_mount_sd directory, modify the Makefile to append contents to current fstab file or replace the original fstab with your version of fstab file.
Here's an example of the fstab_mount_sd Makefile:
install:
$(TARGETINST) -a "/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0" /etc/fstab
$(TARGETINST) -a means append the following text to the destination file.
Note: commands in makefile should start with Tab. Replace the spaces before $(TARGETINST) in previous code block with a Tab.
You can read the help of the $(TARGETINST) command by going to PetaLinux install directory and run components/rootfs/targetroot-inst.sh
More convenient while development is using any standard distribution.
Petalinux can be used to create the kernel, u-boot files.
Then install a Linux of your favor on the sd card and boot it up.
You can use the standard tools apt for example to install packages.
I'm using the CentOS_6.5_Final minimum install ISO. I would like to add kernel-devel to the Packages directory and rebuild the ISO for install.
First I loop mounted the source ISO and copied the data to a directory, added kernel-devel from the full DVD ISO using the same loop mount method.
Then I created the repodata from the /mnt/CentOS-6.5-x86_64-minimal directory.
createrepo -p /mnt/CentOS-6.5-x86_64-minimal/Packages/
The repodata is then place in /mnt/CentOS-6.5-x86_64-minimal/Packages/repodata, so I moved it to /mnt/CentOS-6.5-x86_64-minimal/repodata and replaced the original /mnt/CentOS-6.5-x86_64-minimal/repodata with the new.
I then rebuilt the ISO.
genisoimage -o /tmp/CentOS-6.5-x86_64-minimal.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -V OSSA_01 -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T /mnt/CentOS-6.5-x86_64-minimal/
Have I missed a step?
I'm not really looking to use the ks file right now. How do I make sure the image checksum is still valid? Is this what the GPG files in the ISO root are for?
Got it, I was missing two hidden files..
.discinfo and .treeinfo
How can i make a .ubi file from a .tar.gz or folder if this is possible at all?
I looked at this (did not help me):
Creating UBI Image
To create the image from a rootfs you've built first you need to create the ubi.ini file, that describes your ubi image. Create a regular text file, ubi.ini, example contents, for more info run ubinize -h:
[ubi_rfs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=87349248
vol_type=dynamic
vol_name=ubi_rfs
vol_alignment=1
vol_flags=autoresize
Next you'll run the commands that actually build it. Here ubi.ini is the file you just created, ubifs.img is a temp file you can delete once you are done, and your_erootfs.ubi is the name of the rootfs image that will be created.
sudo /usr/sbin/mkfs.ubifs -m 2048 -e 129024 \
-c 677 -r /path/to/rootfs ubifs.img
sudo /usr/sbin/ubinize -o your_erootfs.ubi \
-p 131072 -m 2048 -s 512 -O 512 ubi.ini
Note the part in the mkfs command that says
-r /path/to/rootfs
Un-tar your tar.gz file and use the resulting directory as the destination for -r.