1
0
forked from brl/citadel

Compare commits

...

5 Commits

13 changed files with 566 additions and 20 deletions

View File

@ -0,0 +1,245 @@
From 14cd68b1fdd3a16a3aa2892f9216096bea02173d Mon Sep 17 00:00:00 2001
From: isa <isa@subgraph.com>
Date: Thu, 11 Jul 2024 18:58:40 +0000
Subject: [PATCH] Modify systemd to use localtime in /storage/citadel-state
Upstream-Status: Inappropriate [citadel specific]
---
src/basic/time-util.c | 4 ++--
src/core/manager.c | 18 +++++++++---------
src/core/manager.h | 2 +-
src/core/unit.h | 2 +-
src/firstboot/firstboot.c | 20 ++++++++++----------
src/timedate/timedated.c | 12 ++++++------
units/systemd-timedated.service.in | 2 +-
7 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index f9014dc560..bab1db4224 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -1612,7 +1612,7 @@ int get_timezone(char **ret) {
assert(ret);
- r = readlink_malloc("/etc/localtime", &t);
+ r = readlink_malloc("/storage/citadel-state/localtime", &t);
if (r == -ENOENT) {
/* If the symlink does not exist, assume "UTC", like glibc does */
z = strdup("UTC");
@@ -1625,7 +1625,7 @@ int get_timezone(char **ret) {
if (r < 0)
return r; /* returns EINVAL if not a symlink */
- e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../usr/share/zoneinfo/");
+ e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../../usr/share/zoneinfo/");
if (!e)
return -EINVAL;
diff --git a/src/core/manager.c b/src/core/manager.c
index 88eebfc626..59c4dbbae1 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -412,9 +412,9 @@ static int manager_read_timezone_stat(Manager *m) {
assert(m);
- /* Read the current stat() data of /etc/localtime so that we detect changes */
- if (lstat("/etc/localtime", &st) < 0) {
- log_debug_errno(errno, "Failed to stat /etc/localtime, ignoring: %m");
+ /* Read the current stat() data of /storage/citadel-state/localtime so that we detect changes */
+ if (lstat("/storage/citadel-state/localtime", &st) < 0) {
+ log_debug_errno(errno, "Failed to stat /storage/citadel-state/localtime, ignoring: %m");
changed = m->etc_localtime_accessible;
m->etc_localtime_accessible = false;
} else {
@@ -439,7 +439,7 @@ static int manager_setup_timezone_change(Manager *m) {
if (MANAGER_IS_TEST_RUN(m))
return 0;
- /* We watch /etc/localtime for three events: change of the link count (which might mean removal from /etc even
+ /* We watch /storage/citadel-state/localtime for three events: change of the link count (which might mean removal from /etc even
* though another link might be kept), renames, and file close operations after writing. Note we don't bother
* with IN_DELETE_SELF, as that would just report when the inode is removed entirely, i.e. after the link count
* went to zero and all fds to it are closed.
@@ -450,14 +450,14 @@ static int manager_setup_timezone_change(Manager *m) {
* Note that we create the new event source first here, before releasing the old one. This should optimize
* behaviour as this way sd-event can reuse the old watch in case the inode didn't change. */
- r = sd_event_add_inotify(m->event, &new_event, "/etc/localtime",
+ r = sd_event_add_inotify(m->event, &new_event, "/storage/citadel-state/localtime",
IN_ATTRIB|IN_MOVE_SELF|IN_CLOSE_WRITE|IN_DONT_FOLLOW, manager_dispatch_timezone_change, m);
if (r == -ENOENT) {
/* If the file doesn't exist yet, subscribe to /etc instead, and wait until it is created either by
* O_CREATE or by rename() */
- log_debug_errno(r, "/etc/localtime doesn't exist yet, watching /etc instead.");
- r = sd_event_add_inotify(m->event, &new_event, "/etc",
+ log_debug_errno(r, "/storage/citadel-state/localtime doesn't exist yet, watching /storage/citadel-state instead.");
+ r = sd_event_add_inotify(m->event, &new_event, "/storage/citadel-state",
IN_CREATE|IN_MOVED_TO|IN_ONLYDIR, manager_dispatch_timezone_change, m);
}
if (r < 0)
@@ -3173,13 +3173,13 @@ static int manager_dispatch_timezone_change(
int changed;
Unit *u;
- log_debug("inotify event for /etc/localtime");
+ log_debug("inotify event for /storage/citadel-state/localtime");
changed = manager_read_timezone_stat(m);
if (changed <= 0)
return changed;
- /* Something changed, restart the watch, to ensure we watch the new /etc/localtime if it changed */
+ /* Something changed, restart the watch, to ensure we watch the new /storage/citadel-state/localtime if it changed */
(void) manager_setup_timezone_change(m);
/* Read the new timezone */
diff --git a/src/core/manager.h b/src/core/manager.h
index d96eb7b995..68066cac50 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -370,7 +370,7 @@ struct Manager {
unsigned gc_marker;
- /* The stat() data the last time we saw /etc/localtime */
+ /* The stat() data the last time we saw /storage/citadel-state/localtime */
usec_t etc_localtime_mtime;
bool etc_localtime_accessible;
diff --git a/src/core/unit.h b/src/core/unit.h
index 60bc2e3d35..c19af861f9 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -713,7 +713,7 @@ typedef struct UnitVTable {
/* Called whenever CLOCK_REALTIME made a jump */
void (*time_change)(Unit *u);
- /* Called whenever /etc/localtime was modified */
+ /* Called whenever /storage/citadel-state/localtime was modified */
void (*timezone_change)(Unit *u);
/* Returns the next timeout of a unit */
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index d4029272de..5bc0976f63 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -606,15 +606,15 @@ static int process_timezone(int rfd) {
assert(rfd >= 0);
- pfd = chase_and_open_parent_at(rfd, "/etc/localtime",
+ pfd = chase_and_open_parent_at(rfd, "/storage/citadel-state/localtime",
CHASE_AT_RESOLVE_IN_ROOT|CHASE_MKDIR_0755|CHASE_WARN|CHASE_NOFOLLOW,
&f);
if (pfd < 0)
- return log_error_errno(pfd, "Failed to chase /etc/localtime: %m");
+ return log_error_errno(pfd, "Failed to chase /storage/citadel-state/localtime: %m");
r = should_configure(pfd, f);
if (r == 0)
- log_debug("Found /etc/localtime, assuming timezone has been configured.");
+ log_debug("Found /storage/citadel-state/localtime, assuming timezone has been configured.");
if (r <= 0)
return r;
@@ -625,16 +625,16 @@ static int process_timezone(int rfd) {
if (arg_copy_timezone && r == 0) {
_cleanup_free_ char *s = NULL;
- r = readlink_malloc("/etc/localtime", &s);
+ r = readlink_malloc("/storage/citadel-state/localtime", &s);
if (r != -ENOENT) {
if (r < 0)
- return log_error_errno(r, "Failed to read host's /etc/localtime: %m");
+ return log_error_errno(r, "Failed to read host's /storage/citadel-state/localtime: %m");
r = symlinkat_atomic_full(s, pfd, f, /* make_relative= */ false);
if (r < 0)
- return log_error_errno(r, "Failed to create /etc/localtime symlink: %m");
+ return log_error_errno(r, "Failed to create /storage/citadel-state/localtime symlink: %m");
- log_info("Copied host's /etc/localtime.");
+ log_info("Copied host's /storage/citadel-state/localtime.");
return 0;
}
}
@@ -650,9 +650,9 @@ static int process_timezone(int rfd) {
r = symlinkat_atomic_full(e, pfd, f, /* make_relative= */ false);
if (r < 0)
- return log_error_errno(r, "Failed to create /etc/localtime symlink: %m");
+ return log_error_errno(r, "Failed to create /storage/citadel-state/localtime symlink: %m");
- log_info("/etc/localtime written");
+ log_info("/storage/citadel-state/localtime written");
return 0;
}
@@ -1223,7 +1223,7 @@ static int process_reset(int rfd) {
"/etc/hostname",
"/etc/machine-id",
"/etc/kernel/cmdline",
- "/etc/localtime") {
+ "/storage/citadel-state/localtime") {
r = reset_one(rfd, p);
if (r < 0)
return r;
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index c7be30f563..334e5e251e 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -276,9 +276,9 @@ static int context_read_data(Context *c) {
r = get_timezone(&t);
if (r == -EINVAL)
- log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.");
+ log_warning_errno(r, "/storage/citadel-state/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.");
else if (r < 0)
- log_warning_errno(r, "Failed to get target of /etc/localtime: %m");
+ log_warning_errno(r, "Failed to get target of /storage/citadel-state/localtime: %m");
free_and_replace(c->zone, t);
@@ -302,22 +302,22 @@ static int context_write_data_timezone(Context *c) {
if (access("/usr/share/zoneinfo/UTC", F_OK) < 0) {
- if (unlink("/etc/localtime") < 0 && errno != ENOENT)
+ if (unlink("/storage/citadel-state/localtime") < 0 && errno != ENOENT)
return -errno;
return 0;
}
- source = "../usr/share/zoneinfo/UTC";
+ source = "../../usr/share/zoneinfo/UTC";
} else {
- p = path_join("../usr/share/zoneinfo", c->zone);
+ p = path_join("../../usr/share/zoneinfo", c->zone);
if (!p)
return -ENOMEM;
source = p;
}
- return symlink_atomic(source, "/etc/localtime");
+ return symlink_atomic(source, "/storage/citadel-state/localtime");
}
static int context_write_data_local_rtc(Context *c) {
diff --git a/units/systemd-timedated.service.in b/units/systemd-timedated.service.in
index 00f6643ba7..9be4010576 100644
--- a/units/systemd-timedated.service.in
+++ b/units/systemd-timedated.service.in
@@ -31,7 +31,7 @@ ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectSystem=strict
-ReadWritePaths=/etc
+ReadWritePaths=/storage/citadel-state
RestrictAddressFamilies=AF_UNIX
RestrictNamespaces=yes
RestrictRealtime=yes

View File

@ -16,3 +16,7 @@ do_install:append() {
rm -f ${D}${sysconfdir}/tmpfiles.d/00-create-volatile.conf rm -f ${D}${sysconfdir}/tmpfiles.d/00-create-volatile.conf
ln -s rescue.target ${D}${systemd_unitdir}/system/kbrequest.target ln -s rescue.target ${D}${systemd_unitdir}/system/kbrequest.target
} }
SRC_URI += " \
file://0001-Modify-systemd-to-use-localtime-in-storage-citadel-s.patch \
"

View File

@ -0,0 +1,5 @@
pkg_postinst:${PN}() {
etc_lt="$D${sysconfdir}/localtime"
ln -sf ../storage/citadel-state/localtime $etc_lt
}

View File

@ -41,6 +41,7 @@ SRC_URI = "\
file://share/dot.profile \ file://share/dot.profile \
file://share/dot.vimrc \ file://share/dot.vimrc \
file://polkit/citadel.rules \ file://polkit/citadel.rules \
file://polkit/gnome-control-center.rules \
file://citadel-installer.session \ file://citadel-installer.session \
file://citadel-installer.json \ file://citadel-installer.json \
file://citadel-installer.desktop \ file://citadel-installer.desktop \
@ -163,6 +164,7 @@ do_install() {
install -m 0644 ${WORKDIR}/polkit/citadel.rules ${D}${sysconfdir}/polkit-1/rules.d/ install -m 0644 ${WORKDIR}/polkit/citadel.rules ${D}${sysconfdir}/polkit-1/rules.d/
install -m 0644 ${WORKDIR}/polkit/gnome-control-center.rules ${D}${sysconfdir}/polkit-1/rules.d/
install -m 0644 ${WORKDIR}/modprobe.d/audio_powersave.conf ${D}${sysconfdir}/modprobe.d/ install -m 0644 ${WORKDIR}/modprobe.d/audio_powersave.conf ${D}${sysconfdir}/modprobe.d/
@ -172,6 +174,10 @@ do_install() {
install -m 0644 ${WORKDIR}/apt-cacher-ng/acng.conf ${D}${datadir}/apt-cacher-ng/conf/ install -m 0644 ${WORKDIR}/apt-cacher-ng/acng.conf ${D}${datadir}/apt-cacher-ng/conf/
install -m 0644 ${WORKDIR}/apt-cacher-ng/security.conf ${D}${datadir}/apt-cacher-ng/conf/ install -m 0644 ${WORKDIR}/apt-cacher-ng/security.conf ${D}${datadir}/apt-cacher-ng/conf/
# icons
mkdir ${D}${datadir}/icons/
install -m 0644 ${WORKDIR}/icons/citadel-installer.svg ${D}${datadir}/icons/
# This probably belongs in lvm2 recipe # This probably belongs in lvm2 recipe
install -d ${D}${systemd_system_unitdir}/sysinit.target.wants install -d ${D}${systemd_system_unitdir}/sysinit.target.wants
ln -s ../lvm2-lvmetad.socket ${D}${systemd_system_unitdir}/sysinit.target.wants/lvm2-lvmetad.socket ln -s ../lvm2-lvmetad.socket ${D}${systemd_system_unitdir}/sysinit.target.wants/lvm2-lvmetad.socket

View File

@ -3,6 +3,6 @@ Name=Citadel Installer
Comment=This session logs you into the Citadel Installer Comment=This session logs you into the Citadel Installer
Exec=/usr/libexec/citadel-installer-ui Exec=/usr/libexec/citadel-installer-ui
TryExec=/usr/libexec/citadel-installer-ui TryExec=/usr/libexec/citadel-installer-ui
Icon= Icon=/usr/share/icons/citadel-installer.svg
Type=Application Type=Application

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="64"
height="64"
version="1.1"
id="svg13"
sodipodi:docname="citadel-installer.svg"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs13" />
<sodipodi:namedview
id="namedview13"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="15.0625"
inkscape:cx="31.966805"
inkscape:cy="31.966805"
inkscape:window-width="3840"
inkscape:window-height="2090"
inkscape:window-x="0"
inkscape:window-y="34"
inkscape:window-maximized="1"
inkscape:current-layer="svg13" />
<rect
style="opacity:0.2;fill:#b6150c;fill-opacity:1"
width="56"
height="17"
x="4"
y="44"
rx="2.8"
ry="2.8"
id="rect1" />
<path
style="fill:#b60c12;fill-opacity:1;opacity:0.04"
d="m 18.25,4 h 27.5 C 50.3205,4 54,7.7045 54,12.275 V 46.65 c 0,4.5705 -3.6795,8.25 -8.25,8.25 H 18.25 C 13.6795,54.9 10,51.2205 10,46.65 V 12.275 C 10,7.7045 13.6795,4 18.25,4 Z"
id="path1" />
<path
style="opacity:0.1;fill:#b60c12;fill-opacity:1"
transform="matrix(2.2773394,0,0,1.2576563,-4.4374303,-4.805362)"
d="m 10.950248,26.084524 5.049752,0 5.049752,0 -2.524876,4.373214 L 16,34.830952 13.475124,30.457738 Z"
id="path2" />
<path
style="fill:#b6150c;fill-opacity:1"
transform="matrix(2.2773394,0,0,1.2576563,-4.4374303,-5.8053658)"
d="m 10.950248,26.084524 5.049752,0 5.049752,0 -2.524876,4.373214 L 16,34.830952 13.475124,30.457738 Z"
id="path3" />
<rect
style="opacity:0.8;fill:#b6150c;fill-opacity:1"
width="6"
height="6"
x="26"
y="9"
id="rect3" />
<rect
style="opacity:0.2;fill:#b6150c;fill-opacity:1"
width="6"
height="6"
x="32"
y="9"
id="rect4" />
<rect
style="opacity:0.4;fill:#b6150c;fill-opacity:1"
width="6"
height="6"
x="26"
y="15"
id="rect5" />
<rect
style="opacity:0.9;fill:#b6150c;fill-opacity:1"
width="6"
height="6"
x="32"
y="15"
id="rect6" />
<rect
style="fill:#b6150c;fill-opacity:1"
width="6"
height="6"
x="26"
y="21"
id="rect7" />
<rect
style="opacity:0.6;fill:#b6150c;fill-opacity:1"
width="6"
height="6"
x="32"
y="21"
id="rect8" />
<rect
style="fill:#b6150c;fill-opacity:1"
width="56"
height="17"
x="4"
y="43"
rx="2.8"
ry="2.8"
id="rect9" />
<rect
style="opacity:0.2"
width="22.4"
height="1"
x="12.4"
y="53"
id="rect10" />
<path
style="opacity:0.3"
d="M 51.5 47 A 4.5 4.5 0 0 0 47.267578 50 L 32.400391 50 L 32.400391 53 L 47.267578 53 A 4.5 4.5 0 0 0 51.5 56 A 4.5 4.5 0 0 0 56 51.5 A 4.5 4.5 0 0 0 51.5 47 z"
id="path10" />
<circle
style="opacity:0.2"
cx="12.5"
cy="52.5"
r="4.5"
id="circle10" />
<circle
style="fill:#ffffff"
cx="12.5"
cy="51.5"
r="4.5"
id="circle11" />
<rect
style="fill:#ffffff"
width="22.4"
height="3"
x="12.4"
y="50"
id="rect11" />
<circle
style="opacity:0.2"
cx="31.5"
cy="52.5"
r="4.5"
id="circle12" />
<circle
style="fill:#ffffff"
cx="31.5"
cy="51.5"
r="4.5"
id="circle13" />
<path
style="fill:#ffffff;opacity:0.2"
d="M 18.25 4 C 13.6795 4 10 7.7048906 10 12.275391 L 10 13.275391 C 10 8.7048906 13.6795 5 18.25 5 L 45.75 5 C 50.3205 5 54 8.7048906 54 13.275391 L 54 12.275391 C 54 7.7048906 50.3205 4 45.75 4 L 18.25 4 z"
id="path13" />
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -0,0 +1,13 @@
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.locale1.set-locale" ||
action.id == "org.freedesktop.locale1.set-keyboard" ||
action.id == "org.freedesktop.ModemManager1.Device.Control" ||
action.id == "org.freedesktop.hostname1.set-static-hostname" ||
action.id == "org.freedesktop.hostname1.set-hostname" ||
action.id == "org.gnome.controlcenter.datetime.configure") &&
subject.local &&
subject.active &&
subject.isInGroup ("citadel")) {
return polkit.Result.YES;
}
});

View File

@ -0,0 +1,51 @@
From a9ad6dd95f0aa2d413a5328edf3e3e4668e39415 Mon Sep 17 00:00:00 2001
From: isa <isa@subgraph.com>
Date: Thu, 22 Aug 2024 15:23:03 +0000
Subject: [PATCH] Modify glib to use localtime in /storage/citadel-state
Upstream-Status: Inappropriate [citadel specific]
---
glib/gtimezone.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/glib/gtimezone.c b/glib/gtimezone.c
index 4a4a2d0..ed1444a 100644
--- a/glib/gtimezone.c
+++ b/glib/gtimezone.c
@@ -538,14 +538,14 @@ zone_identifier_unix (void)
gboolean not_a_symlink_to_zoneinfo = FALSE;
struct stat file_status;
- /* Resolve the actual timezone pointed to by /etc/localtime. */
- resolved_identifier = g_file_read_link ("/etc/localtime", &read_link_err);
+ /* Resolve the actual timezone pointed to by /storage/citadel-state/localtime. */
+ resolved_identifier = g_file_read_link ("/storage/citadel-state/localtime", &read_link_err);
if (resolved_identifier != NULL)
{
if (!g_path_is_absolute (resolved_identifier))
{
- gchar *absolute_resolved_identifier = g_build_filename ("/etc", resolved_identifier, NULL);
+ gchar *absolute_resolved_identifier = g_build_filename ("/storage/citadel-state", resolved_identifier, NULL);
g_free (resolved_identifier);
resolved_identifier = g_steal_pointer (&absolute_resolved_identifier);
}
@@ -604,7 +604,7 @@ zone_identifier_unix (void)
else
{
/* Resolve relative path */
- canonical_path = g_canonicalize_filename (resolved_identifier, "/etc");
+ canonical_path = g_canonicalize_filename (resolved_identifier, "/storage/citadel-state");
g_free (resolved_identifier);
resolved_identifier = g_steal_pointer (&canonical_path);
}
file = g_mapped_file_new (filename, FALSE, NULL);
@@ -671,7 +671,7 @@ zone_info_unix (const gchar *identifier,
if (resolved_identifier == NULL)
goto out;
- filename = g_strdup ("/etc/localtime");
+ filename = g_strdup ("/storage/citadel-state/localtime");
}
file = g_mapped_file_new (filename, FALSE, NULL);

View File

@ -0,0 +1,4 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-Modify-glib-to-accommodate-citadel-timezone-symlink-.patch"

View File

@ -0,0 +1,23 @@
From f96b772948fa78cbb6b2e58f6fe41e53501cc629 Mon Sep 17 00:00:00 2001
From: isa <isa@subgraph.com>
Date: Fri, 23 Aug 2024 16:00:25 +0000
Subject: [PATCH] Modify gnome-desktop to use localtime in /storage/citadel-state
Upstream-Status: Inappropriate [citadel specific]
---
libgnome-desktop/gnome-wall-clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgnome-desktop/gnome-wall-clock.c b/libgnome-desktop/gnome-wall-clock.c
index 4646220..1bb8269 100644
--- a/libgnome-desktop/gnome-wall-clock.c
+++ b/libgnome-desktop/gnome-wall-clock.c
@@ -78,7 +78,7 @@ gnome_wall_clock_init (GnomeWallClock *self)
self->priv->clock_string = NULL;
- tz = g_file_new_for_path ("/etc/localtime");
+ tz = g_file_new_for_path ("/storage/citadel-state/localtime");
self->priv->tz_monitor = g_file_monitor_file (tz, 0, NULL, NULL);
g_object_unref (tz);

View File

@ -0,0 +1,4 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-Modify-gnome-desktop-to-use-localtime-in-storage-cit.patch"

View File

@ -912,7 +912,7 @@ CONFIG_BLK_DEV_BSG_COMMON=y
CONFIG_BLK_DEV_BSGLIB=y CONFIG_BLK_DEV_BSGLIB=y
CONFIG_BLK_DEV_INTEGRITY=y CONFIG_BLK_DEV_INTEGRITY=y
CONFIG_BLK_DEV_INTEGRITY_T10=y CONFIG_BLK_DEV_INTEGRITY_T10=y
# CONFIG_BLK_DEV_WRITE_MOUNTED is not set CONFIG_BLK_DEV_WRITE_MOUNTED=m
# CONFIG_BLK_DEV_ZONED is not set # CONFIG_BLK_DEV_ZONED is not set
# CONFIG_BLK_DEV_THROTTLING is not set # CONFIG_BLK_DEV_THROTTLING is not set
# CONFIG_BLK_WBT is not set # CONFIG_BLK_WBT is not set
@ -3177,7 +3177,7 @@ CONFIG_PINCTRL_INTEL=y
# CONFIG_PINCTRL_INTEL_PLATFORM is not set # CONFIG_PINCTRL_INTEL_PLATFORM is not set
# CONFIG_PINCTRL_ALDERLAKE is not set # CONFIG_PINCTRL_ALDERLAKE is not set
CONFIG_PINCTRL_BROXTON=m CONFIG_PINCTRL_BROXTON=m
# CONFIG_PINCTRL_CANNONLAKE is not set CONFIG_PINCTRL_CANNONLAKE=m
# CONFIG_PINCTRL_CEDARFORK is not set # CONFIG_PINCTRL_CEDARFORK is not set
# CONFIG_PINCTRL_DENVERTON is not set # CONFIG_PINCTRL_DENVERTON is not set
# CONFIG_PINCTRL_ELKHARTLAKE is not set # CONFIG_PINCTRL_ELKHARTLAKE is not set

View File

@ -1,16 +1,11 @@
#!/bin/bash #!/usr/bin/env bash
EXTRA_KERNEL_CMDLINE="" EXTRA_KERNEL_CMDLINE=""
SCRIPT=$(realpath ${BASH_SOURCE}) SCRIPT=$(realpath ${BASH_SOURCE})
BUILD_ROOT=$(realpath $(dirname ${SCRIPT})/../build) BUILD_ROOT=$(realpath $(dirname ${SCRIPT})/../build)
SYSROOT=${BUILD_ROOT}/tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native SYSROOT=${BUILD_ROOT}/tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0/recipe-sysroot-native
QEMU=${SYSROOT}/usr/bin/qemu-system-x86_64 QEMU=qemu-system-x86_64
if [[ ! -f ${QEMU} ]]; then
>&2 printf "Qemu binary not found at: ${QEMU}\n"
exit 1
fi
ENABLE_KVM="--enable-kvm -cpu host" ENABLE_KVM="--enable-kvm -cpu host"
@ -20,9 +15,13 @@ if [[ ! -c "/dev/kvm" ]]; then
fi fi
EFI_BIOS="-bios /usr/share/qemu/OVMF.fd" EFI_BIOS="-bios /usr/share/qemu/OVMF.fd"
if [[ ! -f "/usr/share/qemu/OVMF.fd" ]]; then if [[ -f "/usr/share/qemu/OVMF.fd" ]]; then
printf "Disabling EFI boot because OVMF.fd not found in /usr/share/qemu\n" printf "Using EFI boot because OVMF.fd found in /usr/share/qemu/\n"
EFI_BIOS="" elif [[ -f "/usr/share/edk2-ovmf/x64/OVMF.fd" ]]; then # fedora and arch
printf "Using EFI boot because OVMF.fd found in /usr/share/edk2-ovmf/x64/\n"
EFI_BIOS="-bios /usr/share/edk2-ovmf/x64/OVMF.fd"
else
printf "Disabling EFI boot because OVMF.fd not found\n"
fi fi
usage() { usage() {
@ -43,7 +42,7 @@ exit 0
} }
BOOT_TARGET="" BOOT_TARGET=""
MEMORY_ARG="-m 4G" MEMORY_ARG="-m 8G"
DEBUG_MODE=0 DEBUG_MODE=0
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@ -70,6 +69,14 @@ while [[ $# -gt 0 ]]; do
BOOT_TARGET="installer" BOOT_TARGET="installer"
shift shift
;; ;;
boot-to-install)
BOOT_TARGET="boot-to-install"
shift
;;
boot-installed)
BOOT_TARGET="boot-installed"
shift
;;
--help) --help)
usage usage
;; ;;
@ -84,23 +91,50 @@ COMMON_INSTALLER_ARGS="\
${ENABLE_KVM} \ ${ENABLE_KVM} \
${MEMORY_ARG} \ ${MEMORY_ARG} \
${EFI_BIOS} \ ${EFI_BIOS} \
-vga virtio \ -device virtio-vga-gl \
-display sdl,gl=on \
-vga none \
-usb -device usb-tablet,id=input0 \ -usb -device usb-tablet,id=input0 \
-drive format=raw,file=${BUILD_ROOT}/images/citadel-installer.img \ -nic user,model=virtio-net-pci \
-net none \
-smp 2" -smp 2"
boot_installer() { boot_installer() {
if [[ ${DEBUG_MODE} -eq 1 ]]; then if [[ ${DEBUG_MODE} -eq 1 ]]; then
${QEMU} ${COMMON_INSTALLER_ARGS} \ ${QEMU} ${COMMON_INSTALLER_ARGS} \
-serial stdio \ -serial stdio \
-kernel ${BUILD_ROOT}/images/bzImage \ -kernel ${BUILD_ROOT}/images/bzImage \
-drive format=raw,file=${BUILD_ROOT}/images/citadel-installer.img \
-append "console=ttyS0 earlyprintk=ttyS0 root=/dev/mapper/rootfs citadel.verbose citadel.install fstab=no luks=no systemd.journald.forward_to_console=1 ${EXTRA_KERNEL_CMDLINE}" -append "console=ttyS0 earlyprintk=ttyS0 root=/dev/mapper/rootfs citadel.verbose citadel.install fstab=no luks=no systemd.journald.forward_to_console=1 ${EXTRA_KERNEL_CMDLINE}"
else else
${QEMU} ${COMMON_INSTALLER_ARGS} ${QEMU} ${COMMON_INSTALLER_ARGS} -drive format=raw,file=${BUILD_ROOT}/images/citadel-installer.img
fi fi
} }
# qemu-img create -f qcow2 qemu_disk/citadel_disk.qcow2 -o size=50G,preallocation=metadata
# mount -t 9p -o trans=virtio,version=9p2000.L shared /mnt/my9p
boot_to_install() {
if [ ! -f qemu_disk/citadel_disk.qcow2 ]; then
mkdir qemu_disk
qemu-img create -f qcow2 qemu_disk/citadel_disk.qcow2 -o size=50G,preallocation=metadata
fi
CITADEL_QEMU_ARGS+=" ${COMMON_INSTALLER_ARGS} -drive format=raw,file=${BUILD_ROOT}/images/citadel-installer.img -drive format=qcow2,file=${BUILD_ROOT}/../qemu_disk/citadel_disk.qcow2"
echo "${QEMU} ${CITADEL_QEMU_ARGS}"
${QEMU} ${CITADEL_QEMU_ARGS}
}
boot_installed() {
if [ ! -f qemu_disk/citadel_disk.qcow2 ]; then
printf "The qemu disk is not found on the drive. Please run boot-to-install\n"
fi
CITADEL_QEMU_ARGS+=" ${COMMON_INSTALLER_ARGS} -drive format=qcow2,file=${BUILD_ROOT}/../qemu_disk/citadel_disk.qcow2"
echo "${QEMU} ${CITADEL_QEMU_ARGS}"
${QEMU} ${CITADEL_QEMU_ARGS}
}
boot_kernel() { boot_kernel() {
EXTRA_OPTIONS="" EXTRA_OPTIONS=""
KERNEL_IMAGE="bzImage" KERNEL_IMAGE="bzImage"
@ -124,6 +158,10 @@ if [[ ${BOOT_TARGET} = "kernel" ]]; then
boot_kernel boot_kernel
elif [[ ${BOOT_TARGET} = "installer" ]]; then elif [[ ${BOOT_TARGET} = "installer" ]]; then
boot_installer boot_installer
elif [[ ${BOOT_TARGET} = "boot-to-install" ]]; then
boot_to_install
elif [[ ${BOOT_TARGET} = "boot-installed" ]]; then
boot_installed
else else
usage usage
fi fi