sculpt: replace noux-based e2fsprogs by fs_utils

With this patch, Sculpt executes the e2fs file-system utilities
directly instead of hosting them within the noux runtime.

Issue #3696
This commit is contained in:
Norman Feske 2020-03-25 10:00:26 +01:00 committed by Christian Helmuth
parent e63195a940
commit 9c95e4bb4f
4 changed files with 33 additions and 28 deletions

View File

@ -38,7 +38,7 @@ _/src/zlib
_/src/log_core
_/src/part_block
_/src/nic_router
_/src/e2fsprogs-minimal
_/src/fs_utils
_/src/nvme_drv
_/src/wm
_/src/themed_decorator

View File

@ -33,7 +33,7 @@ import_from_depot [depot_user]/src/[base_src] \
[depot_user]/src/bash-minimal \
[depot_user]/src/vim-minimal \
[depot_user]/src/coreutils-minimal \
[depot_user]/src/e2fsprogs-minimal \
[depot_user]/src/fs_utils \
[depot_user]/src/gpt_write \
[depot_user]/src/text_area \
[depot_user]/src/sandbox \

View File

@ -1486,7 +1486,7 @@ void Sculpt::Main::_handle_runtime_state()
Storage_target const target { device.label, partition.number };
if (partition.check_in_progress) {
String<64> name(target.label(), ".fsck.ext2");
String<64> name(target.label(), ".e2fsck");
Child_exit_state exit_state(state, name);
if (exit_state.exited) {
@ -1503,7 +1503,7 @@ void Sculpt::Main::_handle_runtime_state()
}
if (partition.format_in_progress) {
String<64> name(target.label(), ".mkfs.ext2");
String<64> name(target.label(), ".mke2fs");
Child_exit_state exit_state(state, name);
if (exit_state.exited) {

View File

@ -19,6 +19,11 @@ namespace Sculpt {
void gen_e2fs_start_content(Xml_generator &, Storage_target const &,
Rom_name const &, GEN_ARGS_FN const &);
template <typename ARG>
void gen_arg(Xml_generator &xml, ARG const &arg)
{
xml.node("arg", [&] () { xml.attribute("value", arg); });
}
}
@ -31,31 +36,33 @@ void Sculpt::gen_e2fs_start_content(Xml_generator &xml,
gen_common_start_content(xml, String<64>(target.label(), ".", tool),
Cap_quota{500}, Ram_quota{100*1024*1024});
gen_named_node(xml, "binary", "noux");
gen_named_node(xml, "binary", tool);
xml.node("config", [&] () {
xml.attribute("stdout", "/dev/log");
xml.attribute("stderr", "/dev/log");
xml.attribute("stdin", "/dev/null");
xml.node("fstab", [&] () {
gen_named_node(xml, "tar", "e2fsprogs-minimal.tar");
xml.node("libc", [&] () {
xml.attribute("stdout", "/dev/log");
xml.attribute("stderr", "/dev/log");
xml.attribute("stdin", "/dev/null");
xml.attribute("rtc", "/dev/rtc");
});
xml.node("vfs", [&] () {
gen_named_node(xml, "dir", "dev", [&] () {
gen_named_node(xml, "block", "block", [&] () {
xml.attribute("label", "default");
xml.attribute("block_buffer_count", 128);
});
gen_named_node(xml, "inline", "rtc", [&] () {
xml.append("2018-01-01 00:01");
});
xml.node("null", [&] () {});
xml.node("log", [&] () {});
});
});
gen_named_node(xml, "start", Rom_name("/bin/", tool), [&] () {
gen_args_fn(xml); });
gen_args_fn(xml);
});
xml.node("route", [&] () {
target.gen_block_session_route(xml);
gen_parent_rom_route(xml, "noux");
gen_parent_rom_route(xml, "ld.lib.so");
gen_parent_route<Cpu_session> (xml);
gen_parent_route<Pd_session> (xml);
gen_parent_route<Log_session> (xml);
@ -69,11 +76,12 @@ void Sculpt::gen_fsck_ext2_start_content(Xml_generator &xml,
Storage_target const &target)
{
auto gen_args = [&] (Xml_generator &xml) {
xml.node("arg", [&] () { xml.attribute("value", "-yv"); });
xml.node("arg", [&] () { xml.attribute("value", "/dev/block"); });
gen_arg(xml, "fsck.ext2");
gen_arg(xml, "-yv");
gen_arg(xml, "/dev/block");
};
gen_e2fs_start_content(xml, target, "fsck.ext2", gen_args);
gen_e2fs_start_content(xml, target, "e2fsck", gen_args);
}
@ -81,11 +89,12 @@ void Sculpt::gen_mkfs_ext2_start_content(Xml_generator &xml,
Storage_target const &target)
{
auto gen_args = [&] (Xml_generator &xml) {
xml.node("arg", [&] () { xml.attribute("value", "-F"); });
xml.node("arg", [&] () { xml.attribute("value", "/dev/block"); });
gen_arg(xml, "mkfs.ext2");
gen_arg(xml, "-F");
gen_arg(xml, "/dev/block");
};
gen_e2fs_start_content(xml, target, "mkfs.ext2", gen_args);
gen_e2fs_start_content(xml, target, "mke2fs", gen_args);
}
@ -93,14 +102,10 @@ void Sculpt::gen_resize2fs_start_content(Xml_generator &xml,
Storage_target const &target)
{
auto gen_args = [&] (Xml_generator &xml) {
auto gen_arg = [&] (char const *arg) {
xml.node("arg", [&] () {
xml.attribute("value", arg); }); };
gen_arg("-f");
gen_arg("-p");
gen_arg("/dev/block");
gen_arg(xml, "resize2fs");
gen_arg(xml, "-f");
gen_arg(xml, "-p");
gen_arg(xml, "/dev/block");
};
gen_e2fs_start_content(xml, target, "resize2fs", gen_args);