New set of images: rootfs, modules, extra
This commit is contained in:
parent
93117378b1
commit
cbaad85617
32
meta-citadel/classes/citadel-image.bbclass
Normal file
32
meta-citadel/classes/citadel-image.bbclass
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
DEPENDS_append = " citadel-image-native mtools-native"
|
||||
|
||||
# Block size must be 4096 or dm-verity won't work
|
||||
EXTRA_IMAGECMD_ext2 = "-i 4096 -b 4096"
|
||||
IMAGE_FSTYPES = "ext2"
|
||||
|
||||
inherit image
|
||||
|
||||
CITADEL_IMAGE_CHANNEL ??= "dev"
|
||||
|
||||
do_citadel_mkimage() {
|
||||
cat > ${B}/mkimage.conf << EOF
|
||||
image-type = "${CITADEL_IMAGE_TYPE}"
|
||||
channel = "${CITADEL_IMAGE_CHANNEL}"
|
||||
version = ${CITADEL_IMAGE_VERSION}
|
||||
source = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext2"
|
||||
EOF
|
||||
|
||||
ver=$(printf "%03d" ${CITADEL_IMAGE_VERSION})
|
||||
|
||||
if [ "${CITADEL_IMAGE_TYPE}" = "modules" ]; then
|
||||
echo "kernel-version = \"${CITADEL_KERNEL_VERSION}\"" >> ${B}/mkimage.conf
|
||||
fname="citadel-modules-${CITADEL_KERNEL_VERSION}-${CITADEL_IMAGE_CHANNEL}-${ver}.img"
|
||||
else
|
||||
fname="citadel-${CITADEL_IMAGE_TYPE}-${CITADEL_IMAGE_CHANNEL}-${ver}.img"
|
||||
fi
|
||||
citadel-image build ${B}
|
||||
mv ${B}/${fname} ${IMGDEPLOYDIR}
|
||||
}
|
||||
|
||||
addtask do_citadel_mkimage after do_image_ext2 before do_image_complete
|
29
meta-citadel/recipes-citadel/images/citadel-extra-image.bb
Normal file
29
meta-citadel/recipes-citadel/images/citadel-extra-image.bb
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
DESCRIPTION = "Citadel resources"
|
||||
LICENSE = "MIT"
|
||||
|
||||
PACKAGE_INSTALL = "\
|
||||
packagegroup-firmware \
|
||||
adapta-gtk-theme \
|
||||
paper-icon-theme \
|
||||
gnome-backgrounds \
|
||||
adwaita-icon-theme \
|
||||
adwaita-icon-theme-cursors \
|
||||
adwaita-icon-theme-hires \
|
||||
adwaita-icon-theme-symbolic \
|
||||
adwaita-icon-theme-symbolic-hires \
|
||||
"
|
||||
CITADEL_IMAGE_VERSION = "${CITADEL_IMAGE_VERSION_extra}"
|
||||
CITADEL_IMAGE_TYPE = "extra"
|
||||
|
||||
require citadel-image.inc
|
||||
inherit citadel-image
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND += "write_manifest_file; "
|
||||
|
||||
write_manifest_file() {
|
||||
cat > ${IMAGE_ROOTFS}/manifest << EOF
|
||||
/usr/lib/firmware
|
||||
/usr/share:/opt/share
|
||||
EOF
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
SUMMARY = "Subgraph OS Citadel Base CLI image builder"
|
||||
LICENSE = "MIT"
|
||||
|
||||
|
||||
IMAGE_FEATURES_append = " empty-root-password"
|
||||
|
||||
#
|
||||
# Set by the machine configuration with packages essential for device bootup
|
||||
#
|
||||
MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
|
||||
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
|
||||
|
||||
IMAGE_INSTALL = "\
|
||||
packagegroup-citadel-base \
|
||||
"
|
||||
|
||||
RDEPENDS_${PN} = "\
|
||||
${MACHINE_ESSENTIAL_EXTRA_RDEPENDS} \
|
||||
"
|
||||
|
||||
RRECOMMENDS_${PN} = "\
|
||||
${MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS}"
|
||||
|
||||
ROOT_PASSWORD ?= "citadel"
|
||||
|
||||
inherit core-image
|
||||
|
@ -1,17 +0,0 @@
|
||||
DESCRIPTION = "Subgraph OS Citadel minimal image builder"
|
||||
LICENSE = "MIT"
|
||||
|
||||
IMAGE_FEATURES_append = " empty-root-password"
|
||||
|
||||
IMAGE_INSTALL = "\
|
||||
packagegroup-core-boot \
|
||||
packagegroup-core-full-cmdline-utils \
|
||||
"
|
||||
|
||||
ROOT_PASSWORD ?= "citadel"
|
||||
|
||||
inherit core-image
|
||||
|
||||
WKS_FILE="citadel-image-minimal.wks"
|
||||
DEPENDS += "linux-citadel"
|
||||
|
8
meta-citadel/recipes-citadel/images/citadel-image.inc
Normal file
8
meta-citadel/recipes-citadel/images/citadel-image.inc
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
CITADEL_IMAGE_CHANNEL = "dev"
|
||||
|
||||
CITADEL_IMAGE_VERSION_rootfs = "1"
|
||||
CITADEL_IMAGE_VERSION_extra = "1"
|
||||
CITADEL_IMAGE_VERSION_modules = "1"
|
||||
|
||||
CITADEL_KERNEL_VERSION = "4.9.65"
|
187
meta-citadel/recipes-citadel/images/citadel-installer-image.bb
Normal file
187
meta-citadel/recipes-citadel/images/citadel-installer-image.bb
Normal file
@ -0,0 +1,187 @@
|
||||
DESCRIPTION = ""
|
||||
HOMEPAGE = ""
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
||||
SECTION = ""
|
||||
DEPENDS = "mtools-native syslinux-native dosfstools-native coreutils-native parted-native"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
inherit deploy
|
||||
require citadel-image.inc
|
||||
|
||||
KERNEL_CMDLINE = "root=/dev/mapper/rootfs citadel.nosignatures citadel.verbose fstab=no luks=no splash systemd.debug-shell=1"
|
||||
|
||||
do_rootfs() {
|
||||
install_efi_files
|
||||
install_syslinux_files
|
||||
install_image_files
|
||||
}
|
||||
|
||||
do_rootfs[dirs] = "${TOPDIR}"
|
||||
do_rootfs[cleandirs] = "${S} ${IMAGE_ROOTFS}"
|
||||
do_rootfs[umask] = "022"
|
||||
do_rootfs[depends] += "\
|
||||
citadel-rootfs-image:do_image_complete \
|
||||
citadel-extra-image:do_image_complete \
|
||||
citadel-modules-image:do_image_complete \
|
||||
citadel-kernel:do_deploy \
|
||||
systemd-boot:do_deploy \
|
||||
"
|
||||
addtask rootfs after do_configure before do_build
|
||||
|
||||
install_efi_files() {
|
||||
install -d ${IMAGE_ROOTFS}/EFI/BOOT
|
||||
install ${DEPLOY_DIR_IMAGE}/systemd-bootx64.efi -T ${IMAGE_ROOTFS}/EFI/BOOT/bootx64.efi
|
||||
install ${DEPLOY_DIR_IMAGE}/bzImage ${IMAGE_ROOTFS}
|
||||
|
||||
install -d ${IMAGE_ROOTFS}/loader/entries
|
||||
make_loader_conf > ${IMAGE_ROOTFS}/loader/loader.conf
|
||||
#make_install_conf > ${IMAGE_ROOTFS}/loader/entries/install.conf
|
||||
make_live_conf > ${IMAGE_ROOTFS}/loader/entries/live.conf
|
||||
}
|
||||
|
||||
SYSLINUX_MODULES = "ldlinux.c32 menu.c32 libutil.c32 gptmbr.bin"
|
||||
|
||||
install_syslinux_files() {
|
||||
install -d ${IMAGE_ROOTFS}/syslinux
|
||||
make_syslinux_conf > ${IMAGE_ROOTFS}/syslinux/syslinux.cfg
|
||||
for m in ${SYSLINUX_MODULES}; do
|
||||
install ${RECIPE_SYSROOT_NATIVE}/usr/share/syslinux/$m ${IMAGE_ROOTFS}/syslinux
|
||||
done
|
||||
}
|
||||
|
||||
install_image_files() {
|
||||
install -d ${IMAGE_ROOTFS}/images
|
||||
install_resource_image "rootfs" ${CITADEL_IMAGE_VERSION_rootfs}
|
||||
install_resource_image "extra" ${CITADEL_IMAGE_VERSION_extra}
|
||||
install_resource_image "modules" ${CITADEL_IMAGE_VERSION_modules}
|
||||
install ${TOPDIR}/appimg/appimg-rootfs.tar.xz ${IMAGE_ROOTFS}/images/
|
||||
}
|
||||
|
||||
make_loader_conf() {
|
||||
echo "default live"
|
||||
echo "timeout 5"
|
||||
}
|
||||
|
||||
make_install_conf() {
|
||||
echo "title Install Subgraph OS (Citadel)"
|
||||
echo "linux /bzImage"
|
||||
echo "options ${KERNEL_CMDLINE} citadel.install"
|
||||
}
|
||||
|
||||
make_live_conf() {
|
||||
echo "title Run Live Subgraph OS (Citadel)"
|
||||
echo "linux /bzImage"
|
||||
echo "options ${KERNEL_CMDLINE} citadel.live"
|
||||
}
|
||||
|
||||
make_syslinux_conf() {
|
||||
cat << EOF
|
||||
UI menu.c32
|
||||
PROMPT 0
|
||||
|
||||
MENU TITLE Boot Live Subgraph OS (Citadel)
|
||||
TIMEOUT 50
|
||||
DEFAULT subgraph
|
||||
|
||||
LABEL subgraph
|
||||
MENU LABEL Subgraph OS
|
||||
LINUX ../bzImage
|
||||
APPEND ${KERNEL_CMDLINE} citadel.live
|
||||
EOF
|
||||
}
|
||||
|
||||
install_resource_image() {
|
||||
version=$(printf "%03d" ${2})
|
||||
|
||||
if [ "${1}" = "modules" ]; then
|
||||
kversion=$(cat ${DEPLOY_DIR_IMAGE}/kernel.version)
|
||||
src_fname="citadel-modules-${kversion}-${CITADEL_IMAGE_CHANNEL}-${version}.img"
|
||||
dst_fname="citadel-modules-${kversion}.img"
|
||||
else
|
||||
src_fname="citadel-${1}-${CITADEL_IMAGE_CHANNEL}-${version}.img"
|
||||
dst_fname="citadel-${1}.img"
|
||||
fi
|
||||
|
||||
install ${DEPLOY_DIR_IMAGE}/${src_fname} -T ${IMAGE_ROOTFS}/images/${dst_fname}
|
||||
}
|
||||
|
||||
|
||||
CITADEL_BOOT_IMAGE = "${B}/boot.img"
|
||||
CITADEL_INSTALLER_IMAGE = "${B}/citadel-installer.img"
|
||||
do_image() {
|
||||
write_boot_image ${CITADEL_BOOT_IMAGE}
|
||||
write_installer_image ${CITADEL_INSTALLER_IMAGE} ${CITADEL_BOOT_IMAGE}
|
||||
}
|
||||
do_image[umask] = "022"
|
||||
do_image[dirs] = "${TOPDIR}"
|
||||
addtask do_image after do_rootfs before do_build
|
||||
|
||||
do_deploy() {
|
||||
install -m 644 ${CITADEL_INSTALLER_IMAGE} ${DEPLOYDIR}
|
||||
}
|
||||
|
||||
addtask do_deploy after do_image before do_build
|
||||
|
||||
#
|
||||
# write_boot_image [image path]
|
||||
#
|
||||
write_boot_image() {
|
||||
IMAGE_PATH=${1}
|
||||
BLOCKS_ROOTFS=$(du -bks ${IMAGE_ROOTFS} | cut -f1)
|
||||
BLOCKS_EXTRA=2048
|
||||
IMAGE_SIZE=$(expr ${BLOCKS_ROOTFS} + ${BLOCKS_EXTRA})
|
||||
|
||||
if [ -e ${IMAGE_PATH} ]; then
|
||||
|
||||
rm ${IMAGE_PATH}
|
||||
fi
|
||||
|
||||
bbdebug 1 Creating ${IMAGE_SIZE} block msdos image at ${IMAGE_PATH}
|
||||
mkdosfs -n boot -C ${IMAGE_PATH} ${IMAGE_SIZE}
|
||||
mcopy -i ${IMAGE_PATH} -s ${IMAGE_ROOTFS}/* ::/
|
||||
|
||||
syslinux --directory syslinux --install ${IMAGE_PATH}
|
||||
}
|
||||
|
||||
write_installer_image() {
|
||||
INSTALLER_IMAGE=${1}
|
||||
BOOT_IMAGE=${2}
|
||||
BOOT_IMAGE_SIZE=$(stat -c "%s" ${BOOT_IMAGE})
|
||||
BOOT_IMAGE_SECTORS=$(expr ${BOOT_IMAGE_SIZE} / 512)
|
||||
TOTAL_SECTORS=$(expr ${BOOT_IMAGE_SECTORS} + 32)
|
||||
TOTAL_IMAGE_BLOCKS=$(expr ${TOTAL_SECTORS} / 2)
|
||||
|
||||
if [ -e ${INSTALLER_IMAGE} ]; then
|
||||
rm ${INSTALLER_IMAGE}
|
||||
fi
|
||||
|
||||
bbdebug 1 Creating ${TOTAL_IMAGE_BLOCKS} block empty image file at ${INSTALLER_IMAGE}
|
||||
truncate -s ${TOTAL_IMAGE_BLOCKS}K ${INSTALLER_IMAGE}
|
||||
parted -s ${INSTALLER_IMAGE} mklabel msdos
|
||||
|
||||
offset=32
|
||||
end=$(expr ${offset} + ${BOOT_IMAGE_SECTORS} - 1)
|
||||
bbdebug 1 parted -s ${INSTALLER_IMAGE} unit s mkpart fat32 ${offset} ${end}
|
||||
parted -s ${INSTALLER_IMAGE} unit s mkpart primary fat32 ${offset} ${end}
|
||||
parted -s ${INSTALLER_IMAGE} set 1 boot on
|
||||
bbdebug 1 dd if=${BOOT_IMAGE} of=${INSTALLER_IMAGE} seek=${offset} count=${BOOT_IMAGE_SECTORS} conv=sparse,nocreat,notrunc
|
||||
dd if=${BOOT_IMAGE} of=${INSTALLER_IMAGE} seek=${offset} count=${BOOT_IMAGE_SECTORS} conv=sparse,nocreat,notrunc
|
||||
|
||||
dd bs=440 count=1 conv=notrunc if=${RECIPE_SYSROOT_NATIVE}/usr/share/syslinux/mbr.bin of=${INSTALLER_IMAGE}
|
||||
|
||||
parted -s ${INSTALLER_IMAGE} unit s print
|
||||
}
|
||||
|
||||
do_fetch[noexec] = "1"
|
||||
do_unpack[noexec] = "1"
|
||||
do_patch[noexec] = "1"
|
||||
do_configure[noexec] = "1"
|
||||
do_compile[noexec] = "1"
|
||||
do_install[noexec] = "1"
|
||||
deltask do_populate_sysroot
|
||||
do_package[noexec] = "1"
|
||||
deltask do_package_qa
|
||||
do_packagedata[noexec] = "1"
|
||||
do_package_write_deb[noexec] = "1"
|
18
meta-citadel/recipes-citadel/images/citadel-modules-image.bb
Normal file
18
meta-citadel/recipes-citadel/images/citadel-modules-image.bb
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
DESCRIPTION = "Kernel modules"
|
||||
LICENSE = "MIT"
|
||||
|
||||
PACKAGE_INSTALL = "kernel-modules"
|
||||
|
||||
CITADEL_IMAGE_VERSION = "${CITADEL_IMAGE_VERSION_modules}"
|
||||
CITADEL_IMAGE_TYPE = "modules"
|
||||
|
||||
require citadel-image.inc
|
||||
inherit citadel-image
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND += "write_manifest_file; "
|
||||
|
||||
write_manifest_file() {
|
||||
echo "/usr/lib/modules" > ${IMAGE_ROOTFS}/manifest
|
||||
}
|
||||
|
@ -4,17 +4,19 @@ LICENSE = "MIT"
|
||||
|
||||
SYSTEMD_DEFAULT_TARGET = "graphical.target"
|
||||
|
||||
require citadel-image-base.bb
|
||||
|
||||
ROOTFS_POSTPROCESS_COMMAND += "set_citadel_user_password; symlink_lib64; setup_var; "
|
||||
|
||||
#IMAGE_FSTYPES += "ext2"
|
||||
IMAGE_FSTYPES = "ext2"
|
||||
ROOTFS_POSTPROCESS_COMMAND += "set_citadel_user_password; write_etc_citadel_channel; symlink_lib64; setup_var; "
|
||||
|
||||
IMAGE_INSTALL += "\
|
||||
packagegroup-citadel-base \
|
||||
packagegroup-citadel \
|
||||
"
|
||||
|
||||
CITADEL_IMAGE_VERSION = "${CITADEL_IMAGE_VERSION_rootfs}"
|
||||
CITADEL_IMAGE_TYPE = "rootfs"
|
||||
|
||||
require citadel-image.inc
|
||||
inherit citadel-image
|
||||
|
||||
set_blank_user_password() {
|
||||
sed -i 's%^citadel:!:%citadel::%' ${IMAGE_ROOTFS}/etc/shadow
|
||||
}
|
||||
@ -24,6 +26,10 @@ set_citadel_user_password() {
|
||||
sed -i 's%^citadel:!:%citadel:aadg8rGtZzOY6:%' ${IMAGE_ROOTFS}/etc/shadow
|
||||
}
|
||||
|
||||
write_etc_citadel_channel() {
|
||||
echo "${CITADEL_IMAGE_CHANNEL} ${CITADEL_IMAGE_VERSION_rootfs}" > ${IMAGE_ROOTFS}/etc/citadel-channel
|
||||
}
|
||||
|
||||
setup_var() {
|
||||
install -m 0755 -d ${IMAGE_ROOTFS}/usr/share/factory/var
|
||||
install -m 0755 -d ${IMAGE_ROOTFS}/usr/share/factory/home
|
||||
@ -47,7 +53,7 @@ setup_var() {
|
||||
mv ${IMAGE_ROOTFS}/home/root ${IMAGE_ROOTFS}/usr/share/factory/home
|
||||
|
||||
rm ${IMAGE_ROOTFS}/usr/share/gnome-shell/gnome-shell-theme.gresource
|
||||
ln -sf ../themes/Adapta-Nokto/gnome-shell/gnome-shell-theme.gresource ${IMAGE_ROOTFS}/usr/share/gnome-shell/gnome-shell-theme.gresource
|
||||
ln -sf /opt/share/themes/Adapta/gnome-shell/gnome-shell-theme.gresource ${IMAGE_ROOTFS}/usr/share/gnome-shell/gnome-shell-theme.gresource
|
||||
|
||||
# do_rootfs() will fail otherwise
|
||||
ln -sf ../usr/share/factory/var/lib ${IMAGE_ROOTFS}/var/lib
|
@ -18,6 +18,8 @@ RDEPENDS_${PN} = "\
|
||||
base-files \
|
||||
base-passwd \
|
||||
systemd \
|
||||
syslinux \
|
||||
syslinux-extlinux \
|
||||
keymaps \
|
||||
kbd \
|
||||
console-tools \
|
||||
@ -29,6 +31,7 @@ RDEPENDS_${PN} = "\
|
||||
iputils \
|
||||
which \
|
||||
parted \
|
||||
hdparm \
|
||||
bash \
|
||||
${BASH_COMPLETION} \
|
||||
grep \
|
||||
@ -38,8 +41,6 @@ RDEPENDS_${PN} = "\
|
||||
pciutils \
|
||||
sysfsutils \
|
||||
wpa-supplicant \
|
||||
kernel-modules \
|
||||
packagegroup-firmware \
|
||||
vim \
|
||||
vifm \
|
||||
nano \
|
||||
@ -55,6 +56,8 @@ RDEPENDS_${PN} = "\
|
||||
strace \
|
||||
iproute2 \
|
||||
util-linux-hwclock \
|
||||
util-linux-blkid \
|
||||
util-linux-fstrim \
|
||||
btrfs-tools \
|
||||
systemd-analyze \
|
||||
wget \
|
||||
|
@ -7,6 +7,8 @@ RDEPENDS_${PN} = "\
|
||||
packagegroup-gnome \
|
||||
packagegroup-sway \
|
||||
packagegroup-theme \
|
||||
citadel-update \
|
||||
citadel-mount \
|
||||
citadel-install \
|
||||
citadel-realms \
|
||||
citadel-image \
|
||||
"
|
||||
|
@ -10,7 +10,6 @@ RDEPENDS_${PN} = "\
|
||||
gnome-bluetooth \
|
||||
gnome-control-center \
|
||||
gnome-settings-daemon \
|
||||
gnome-backgrounds \
|
||||
gnome-tweaks \
|
||||
gnome-terminal \
|
||||
gnome-usage \
|
||||
@ -22,11 +21,6 @@ RDEPENDS_${PN} = "\
|
||||
gnome-keyring \
|
||||
gnome-session \
|
||||
gnome-shell \
|
||||
adwaita-icon-theme \
|
||||
adwaita-icon-theme-hires \
|
||||
adwaita-icon-theme-symbolic \
|
||||
adwaita-icon-theme-symbolic-hires \
|
||||
adwaita-icon-theme-cursors \
|
||||
hicolor-icon-theme \
|
||||
dash-to-panel \
|
||||
citadel-config-gnome \
|
||||
|
@ -1,8 +1,4 @@
|
||||
|
||||
inherit packagegroup
|
||||
|
||||
RDEPENDS_${PN} = "\
|
||||
adapta-gtk-theme \
|
||||
paper-icon-theme \
|
||||
ttf-roboto \
|
||||
"
|
||||
RDEPENDS_${PN} = "ttf-roboto"
|
||||
|
Loading…
Reference in New Issue
Block a user