Adding partitions to an existing image file
I have 2 image files, image 1 which is 16MB, has multiple partitions, where the boot partition has a 2.4 kernel in it, and image 2, which is 32MB, has a single partition with a 2.6 kernel.
I wish to add those extra partitions from image 1, into image 2, either by adding them within the 32MB(which means cutting back on the size of the existing partition), or adding them to the end of the image(which means extending the image beyond 32MB).
The boot partition for both images is ext2, while the rest of the partitions in image 1 is just raw data.
I'm working with these images in Mandriva Linux 2009.
How can I achieve what I want to do? I think it should be with fdisk and/or mkfs but I'm not sure how? I've tried using gparted to regenerate the partitions from a new image file with the following steps:
dd if=/dev/zero of=image.img bs=32M count=1
Then I created a 30M boot partition. However, I'm not able to create the rest of the partitions as they are smaller than 1MB, which seems to be the min supported. I need precise control of the start/ending sectors of each partition.