Purge the old recipes and create images for soc/fvp which are actually the same at this point in time.
Signed-off-by: Pawel Zalewski pzalewski@thegoodpenguin.co.uk --- .../files/init.sh | 15 --- .../files/initramfs.list.template | 0 .../images/morello-initramfs-musl.bb | 53 ---------- ...nitramfs-glibc.bb => morello-initramfs.bb} | 4 +- .../images/morello-linux-image-fvp.inc | 1 + .../images/morello-linux-image-musl.bb | 96 ------------------- .../images/morello-linux-image-soc.inc | 1 + ...-image-glibc.bb => morello-linux-image.bb} | 26 +++-- .../files/init.sh | 30 ++++-- .../files/initramfs.list.template | 2 - 10 files changed, 44 insertions(+), 184 deletions(-) rename recipes-morello/images/{morello-linux-glibc => morello-fvp}/files/init.sh (65%) rename recipes-morello/images/{morello-linux-glibc => morello-fvp}/files/initramfs.list.template (100%) delete mode 100644 recipes-morello/images/morello-initramfs-musl.bb rename recipes-morello/images/{morello-initramfs-glibc.bb => morello-initramfs.bb} (93%) create mode 100644 recipes-morello/images/morello-linux-image-fvp.inc delete mode 100644 recipes-morello/images/morello-linux-image-musl.bb create mode 100644 recipes-morello/images/morello-linux-image-soc.inc rename recipes-morello/images/{morello-linux-image-glibc.bb => morello-linux-image.bb} (80%) rename recipes-morello/images/{morello-linux-musl => morello-soc}/files/init.sh (65%) rename recipes-morello/images/{morello-linux-musl => morello-soc}/files/initramfs.list.template (93%)
diff --git a/recipes-morello/images/morello-linux-glibc/files/init.sh b/recipes-morello/images/morello-fvp/files/init.sh similarity index 65% rename from recipes-morello/images/morello-linux-glibc/files/init.sh rename to recipes-morello/images/morello-fvp/files/init.sh index d98f607..1806644 100644 --- a/recipes-morello/images/morello-linux-glibc/files/init.sh +++ b/recipes-morello/images/morello-fvp/files/init.sh @@ -40,21 +40,6 @@ echo "Installing busybox..."
! grep -qE $'\t'"devtmpfs$" /proc/filesystems && mdev -s
-ROOT="/newroot" - -PARTUUID=$(cat proc/cmdline | sed 's/ /\n/g' | sed -n 's/^root=PARTUUID=*//p') - -DEVID=$(blkid | sed -n "s/UUID="$PARTUUID" TYPE="ext4"*//p" | sed 's/://') - -echo "Mounting ${DEVID} rootfs with PARTUUID: ${PARTUUID}" - -mount ${DEVID} ${ROOT} - -ulimit -c unlimited - -cd ${ROOT} -exec switch_root . /sbin/init </dev/ttyAMA0 >dev/ttyAMA0 2>&1 - echo "/bin/sh as PID 1!" echo "init.sh" exec setsid cttyhack sh diff --git a/recipes-morello/images/morello-linux-glibc/files/initramfs.list.template b/recipes-morello/images/morello-fvp/files/initramfs.list.template similarity index 100% rename from recipes-morello/images/morello-linux-glibc/files/initramfs.list.template rename to recipes-morello/images/morello-fvp/files/initramfs.list.template diff --git a/recipes-morello/images/morello-initramfs-musl.bb b/recipes-morello/images/morello-initramfs-musl.bb deleted file mode 100644 index 06cce37..0000000 --- a/recipes-morello/images/morello-initramfs-musl.bb +++ /dev/null @@ -1,53 +0,0 @@ -inherit deploy nopackages - -COMPATIBLE_MACHINE = "morello-linux-musl" -SUMMARY = "Initramfs for busybox" -DESCRIPTION = "Initramfs for busybox, bypassing the Yocto way" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -OUTPUTS_NAME = "morello-initramfs" - -DEPENDS += "virtual/morello-busybox gen-init-cpio-native pure-cap-app" -PROVIDES = "${OUTPUTS_NAME}" - -BB_DONT_CACHE = "1" -INHIBIT_DEFAULT_DEPS = "1" - -FILESEXTRAPATHS:prepend := "${THISDIR}:" - -SRC_URI = "file://files/init.sh \ - file://files/initramfs.list.template \ - " -do_configure[noexec] = "1" -do_compile[noexec] = "1" -do_deploy[depends] = "virtual/morello-busybox:do_populate_sysroot" - - -do_install() { - - local sysroot_prefix="recipe-sysroot" - - sed -e "s@%FILES%@/files@" \ - "${WORKDIR}/files/initramfs.list.template" > "${WORKDIR}/files/initramfs.list.tmp1" - - sed -e "s@%BUSYBOX%@/${sysroot_prefix}/busybox@" \ - "${WORKDIR}/files/initramfs.list.tmp1" > "${WORKDIR}/files/initramfs.list.tmp2" - - sed -e "s@%APP_DIR%@/${APP_DIR}@" \ - "${WORKDIR}/files/initramfs.list.tmp2" > "${WORKDIR}/files/initramfs.list" - - install -d ${D}/${OUTPUTS_NAME} - - rm -f ${D}/${OUTPUTS_NAME}/initramfs - - { - env -C ${WORKDIR} ${STAGING_BINDIR_NATIVE}/gen_init_cpio "${WORKDIR}/files/initramfs.list" - env -C "${STAGING_DIR_TARGET}/" find . -not -path "./sysroot-providers*" -print0 | env -C "${STAGING_DIR_TARGET}/" cpio --null --owner +0:+0 --create --format=newc - } > ${D}/${OUTPUTS_NAME}/initramfs -} - -do_deploy() { - install -d ${DEPLOYDIR}/${OUTPUTS_NAME} - install ${D}/${OUTPUTS_NAME}/initramfs ${DEPLOYDIR}/${OUTPUTS_NAME}/initramfs -} -addtask deploy after do_install \ No newline at end of file diff --git a/recipes-morello/images/morello-initramfs-glibc.bb b/recipes-morello/images/morello-initramfs.bb similarity index 93% rename from recipes-morello/images/morello-initramfs-glibc.bb rename to recipes-morello/images/morello-initramfs.bb index 707842e..c3abac8 100644 --- a/recipes-morello/images/morello-initramfs-glibc.bb +++ b/recipes-morello/images/morello-initramfs.bb @@ -1,12 +1,14 @@ inherit deploy nopackages
-COMPATIBLE_MACHINE = "morello-linux-glibc" +COMPATIBLE_MACHINE = "morello" SUMMARY = "Initramfs for busybox" DESCRIPTION = "Initramfs for busybox, bypassing the Yocto way" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" OUTPUTS_NAME = "morello-initramfs"
+PACKAGE_ARCH = "${MACHINE_ARCH}" + DEPENDS += "virtual/morello-busybox gen-init-cpio-native" PROVIDES = "${OUTPUTS_NAME}"
diff --git a/recipes-morello/images/morello-linux-image-fvp.inc b/recipes-morello/images/morello-linux-image-fvp.inc new file mode 100644 index 0000000..1e0424c --- /dev/null +++ b/recipes-morello/images/morello-linux-image-fvp.inc @@ -0,0 +1 @@ +TARGET_PLATFORM = "fvp" \ No newline at end of file diff --git a/recipes-morello/images/morello-linux-image-musl.bb b/recipes-morello/images/morello-linux-image-musl.bb deleted file mode 100644 index 45196d0..0000000 --- a/recipes-morello/images/morello-linux-image-musl.bb +++ /dev/null @@ -1,96 +0,0 @@ -inherit deploy nopackages - -COMPATIBLE_MACHINE = "morello-linux-musl" -SUMMARY = "Bootable Morello Linux Image" -DESCRIPTION = "Image that goes on a bootable device, can be DD'ed onto a USB stick" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -OUTPUTS_NAME = "morello-linux-image" - -INHIBIT_DEFAULT_DEPS = "1" - -DEPENDS += "virtual/kernel morello-initramfs mtools-native e2fsprogs-native coreutils-native bc-native util-linux-native" -PROVIDES = "${OUTPUTS_NAME}" - -IMAGE_SIZE = "100" - -IMAGE_SECTORS = "204800" - -LBA = "512" -PART_START_ALIGNMENT = "2048" - -ESP_IMAGE = "${OUTPUTS_NAME}-esp" - -do_configure[noexec] = "1" -do_compile[noexec] = "1" -do_install[mcdepends] = "mc:${BB_CURRENT_MC}:morello-firmware:board-firmware-image:do_deploy" - -def get_next_part_start (d): - next_image_start = int(d.getVar('IMAGE_SECTORS')) + int(d.getVar('PART_START_ALIGNMENT')) + int(d.getVar('PART_START_ALIGNMENT')) - 1 - next_image_start = next_image_start & ~(int(d.getVar('PART_START_ALIGNMENT')) -1) - return next_image_start - -add_to_image() { - mcopy -i ${1} -m -D overwrite ${2} ::${3} -} - -mult() { - local ret=$(echo "${1} * ${2}" | bc) - echo ${ret} -} - -create_gpt() { - - local esp_type="C12A7328-F81F-11D2-BA4B-00A0C93EC93B" - local linux_type="0FC63DAF-8483-4772-8E79-3D69D8477DE4" - - local part_start_esp=${PART_START_ALIGNMENT} - local part_start_linux="${@get_next_part_start(d)}" - - { - echo "label: gpt" - echo "start=${part_start_esp}, size=${IMAGE_SECTORS}, name=ESP, type=${esp_type}" - echo "start=${part_start_linux}, size=${IMAGE_SECTORS}, name=root, type=${linux_type}" - } | sfdisk -q "${1}" - - dd if="${2}" of="${1}" seek=$(mult ${part_start_esp} ${LBA}) bs=8M conv=notrunc,sparse oflag=seek_bytes status=progress - dd if="${3}" of="${1}" seek=$(mult ${part_start_linux} ${LBA}) bs=8M conv=notrunc,sparse oflag=seek_bytes status=progress -} - -do_install() { - - local part0="${BSP_GRUB_DIR}/grub-efi-bootaa64.efi" - local part1="${BSP_GRUB_DIR}/grub-config.cfg" - local part2="${BSP_DTB_DIR}/morello-soc.dtb" - local part3="${DEPLOY_DIR}/images/morello-linux-musl/Image" - local part4="${DEPLOY_DIR}/images/morello-linux-musl/morello-initramfs/initramfs" - - # create empty ext4 rootfs - : > ${D}/root.img - truncate --size="${IMAGE_SIZE}M" ${D}/root.img - mkfs.ext4 ${D}/root.img - - # create the ESP - dd if=/dev/zero of=${ESP_IMAGE}.img bs=1024K count=${IMAGE_SIZE} - mformat -i ${ESP_IMAGE}.img -v ESP :: - - mmd -i ${ESP_IMAGE}.img ::/EFI - mmd -i ${ESP_IMAGE}.img ::/EFI/BOOT - - add_to_image ${ESP_IMAGE}.img ${part0} /EFI/BOOT/BOOTAA64.EFI - add_to_image ${ESP_IMAGE}.img ${part1} /EFI/BOOT/grub.cfg - add_to_image ${ESP_IMAGE}.img ${part2} /morello.dtb - add_to_image ${ESP_IMAGE}.img ${part3} /Image - add_to_image ${ESP_IMAGE}.img ${part4} /initramfs - - : > ${OUTPUTS_NAME}.img - truncate --size="$(mult ${IMAGE_SIZE} 3)M" ${OUTPUTS_NAME}.img - - create_gpt ${OUTPUTS_NAME}.img ${ESP_IMAGE}.img ${D}/root.img - install ${OUTPUTS_NAME}.img ${D}/${OUTPUTS_NAME}.img -} - -do_deploy() { - install ${D}/${OUTPUTS_NAME}.img ${DEPLOYDIR}/${OUTPUTS_NAME}-${MORELLO_ARCH}-${TCLIBC}.img -} -addtask deploy after do_install diff --git a/recipes-morello/images/morello-linux-image-soc.inc b/recipes-morello/images/morello-linux-image-soc.inc new file mode 100644 index 0000000..94d624b --- /dev/null +++ b/recipes-morello/images/morello-linux-image-soc.inc @@ -0,0 +1 @@ +TARGET_PLATFORM = "soc" \ No newline at end of file diff --git a/recipes-morello/images/morello-linux-image-glibc.bb b/recipes-morello/images/morello-linux-image.bb similarity index 80% rename from recipes-morello/images/morello-linux-image-glibc.bb rename to recipes-morello/images/morello-linux-image.bb index 135ce9a..4c0f2bd 100644 --- a/recipes-morello/images/morello-linux-image-glibc.bb +++ b/recipes-morello/images/morello-linux-image.bb @@ -1,6 +1,6 @@ inherit deploy nopackages
-COMPATIBLE_MACHINE = "morello-linux-glibc" +COMPATIBLE_MACHINE = "morello" SUMMARY = "Bootable Morello Linux Image" DESCRIPTION = "Image that goes on a bootable device, can be DD'ed onto a USB stick" LICENSE = "MIT" @@ -9,7 +9,15 @@ OUTPUTS_NAME = "morello-linux-image"
INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS += "virtual/kernel morello-initramfs mtools-native e2fsprogs-native coreutils-native bc-native util-linux-native" +MACHINE_LINUX_REQUIRE ?= "" +MACHINE_LINUX_REQUIRE:morello-fvp = "morello-linux-image-fvp.inc" +MACHINE_LINUX_REQUIRE:morello-soc = "morello-linux-image-soc.inc" + +require ${MACHINE_LINUX_REQUIRE} + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +DEPENDS += "virtual/kernel virtual/grub-efi morello-initramfs mtools-native e2fsprogs-native coreutils-native bc-native util-linux-native" PROVIDES = "${OUTPUTS_NAME}"
ESP_SIZE = "100" @@ -20,11 +28,11 @@ PART_START_ALIGNMENT = "2048"
ESP_IMAGE = "${OUTPUTS_NAME}-esp"
-ROOTFS = "${DEPLOY_DIR}/images/morello-linux-glibc/rootfs-morello-linux-glibc.ext4" +ROOTFS = "${DEPLOY_DIR}/images/morello-${TARGET_PLATFORM}/rootfs-morello-${TARGET_PLATFORM}.ext4"
-do_compile[noexec] = "1" -do_configure[depends] += "${MORELLO_ROOTFS_IMAGE}:do_image_complete morello-initramfs:do_deploy" -do_configure[mcdepends] += "mc:${BB_CURRENT_MC}:morello-firmware:board-firmware-image:do_deploy" +do_compile[noexec] = "1" +do_configure[depends] += "${MORELLO_ROOTFS_IMAGE}:do_image_complete morello-initramfs:do_deploy" +do_configure[depends] += "board-firmware-image:do_deploy"
def get_next_part_start (d): next_image_start = int(d.getVar('BOOT_SECTORS')) + int(d.getVar('PART_START_ALIGNMENT')) + int(d.getVar('PART_START_ALIGNMENT')) - 1 @@ -103,9 +111,9 @@ do_install() {
local part0="${BSP_GRUB_DIR}/grub-efi-bootaa64.efi" local part1="${BSP_GRUB_DIR}/grub-config.cfg.processed" - local part2="${BSP_DTB_DIR}/morello-soc.dtb" - local part3="${DEPLOY_DIR}/images/morello-linux-glibc/Image" - local part4="${DEPLOY_DIR}/images/morello-linux-glibc/morello-initramfs/initramfs" + local part2="${BSP_DTB_DIR}/morello-${TARGET_PLATFORM}.dtb" + local part3="${DEPLOY_DIR}/images/morello-${TARGET_PLATFORM}/Image" + local part4="${DEPLOY_DIR}/images/morello-${TARGET_PLATFORM}/morello-initramfs/initramfs"
rm -f ${ESP_IMAGE}.img
diff --git a/recipes-morello/images/morello-linux-musl/files/init.sh b/recipes-morello/images/morello-soc/files/init.sh similarity index 65% rename from recipes-morello/images/morello-linux-musl/files/init.sh rename to recipes-morello/images/morello-soc/files/init.sh index 7c1aa8d..1806644 100644 --- a/recipes-morello/images/morello-linux-musl/files/init.sh +++ b/recipes-morello/images/morello-soc/files/init.sh @@ -1,33 +1,47 @@ #!/bin/busybox sh
-# Copyright (c) 2021 Arm Limited. All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause - mount() { /bin/busybox mount "$@" }
+umount() { + /bin/busybox umount "$@" +} + grep() { /bin/busybox grep "$@" }
+cp() { + /bin/busybox cp "$@" +} + +mkdir() { + /bin/busybox mkdir "$@" +} + +switch_root () { + /bin/busybox switch_root "$@" +} + +sed () { + /bin/busybox sed "$@" +} + echo "Running init script"
mount -t proc proc /proc grep -qE $'\t'"devtmpfs$" /proc/filesystems && mount -t devtmpfs dev /dev mount -t sysfs sysfs /sys
-echo "Installing busybox" +echo "Installing busybox..."
/bin/busybox --install -s
! grep -qE $'\t'"devtmpfs$" /proc/filesystems && mdev -s
-ulimit -c unlimited - echo "/bin/sh as PID 1!" echo "init.sh" exec setsid cttyhack sh echo setsid ctty hack failed so "exec /bin/sh" fallback will be used -exec /bin/sh +exec /bin/sh \ No newline at end of file diff --git a/recipes-morello/images/morello-linux-musl/files/initramfs.list.template b/recipes-morello/images/morello-soc/files/initramfs.list.template similarity index 93% rename from recipes-morello/images/morello-linux-musl/files/initramfs.list.template rename to recipes-morello/images/morello-soc/files/initramfs.list.template index 3da25be..da55738 100644 --- a/recipes-morello/images/morello-linux-musl/files/initramfs.list.template +++ b/recipes-morello/images/morello-soc/files/initramfs.list.template @@ -12,7 +12,5 @@ dir /usr/lib 755 0 0 dir /usr/bin 755 0 0 dir /etc 755 0 0
-dir /%APP_DIR% 755 0 0 - file /bin/busybox .%BUSYBOX%/busybox 755 0 0 file /init .%FILES%/init.sh 755 0 0 \ No newline at end of file