Skip to content

Cannot build a working image using image-partition action #535

@Ayush1325

Description

@Ayush1325

I have been trying to use debos to build images for beagle boards. However, I am not sure why but I could not get any images built with debos to even start the uboot present in the image.

All the information that I get from fdisk regarding the image seems to be pretty much the same, so maybe something else is the problem. Regardless, I have created a much simpler test example recipe that does not work, and one that creates image manually, that does.

The boot.tar.xz is just the /boot/firmware partition extracted from a working image. I am not populating rootfs in the example, since it's not particularly important.

Here is the test recipe:

architecture: "arm64"

actions:
  - action: run
    command: sh -c "tar -xvf /recipes/boot.tar.xz"

  - action: run
    command: sh -c "mkdir -p ${ROOTDIR}/boot"

  - action: run
    command: sh -c "mv boot ${ROOTDIR}/boot/firmware"

  - action: image-partition
    imagename: "test.img"
    imagesize: 1GB
    partitiontype: msdos
    mountpoints:
      - partition: rootfs
        mountpoint: /
      - partition: BOOT
        mountpoint: /boot/firmware
    partitions:
      - name: BOOT
        fs: fat32
        start: 1MiB
        end: 257MiB
        flags:
          - boot
      - name: rootfs
        fs: ext4
        start: 257MiB
        end: 100%

  - action: filesystem-deploy
    setup-fstab: false
    setup-kernel-cmdline: false

And here is a shell script that roughly does the same thing and beagley-ai is able to boot:

#!/bin/sh
media=manual.img
boot_tar=boot.tar.xz

dd if=/dev/zero of=${media} bs=1024 count=$((1024 * 1024))

sfdisk manual.img --force --wipe-partitions always <<-__EOF__
1M,256M,0xC,*
257M,,,-
__EOF__

media_loop=$(losetup -f || true)
sudo losetup ${media_loop} "${media}"
sudo kpartx -av ${media_loop}
sleep 1
sync

media_boot_partition=1
media_rootfs_partition=2

test_loop=$(echo ${media_loop} | awk -F'/' '{print $3}')
if [ -e /dev/mapper/${test_loop}p${media_boot_partition} ] && [ -e /dev/mapper/${test_loop}p${media_rootfs_partition} ] ; then
	media_prefix="/dev/mapper/${test_loop}p"
else
	ls -lh /dev/mapper/
	echo "Error: not sure what to do (new feature)."
	exit
fi

sudo mkfs.vfat -F 32 -n BOOT ${media_prefix}${media_boot_partition}

sudo kpartx -dv ${media}

mkdir temp
sudo mount -t vfat ${media} temp -o loop,offset=$((2048 * 512))

tar -xvf ${boot_tar}
cp -r boot/* temp/
sudo umount temp

rm -rf temp
rm -rf boot

Can anyone help me understand what I might be doing wrong in the recipe?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions