Skip to content

Commit

Permalink
WIP: run/pkcs11_tool: fix run script driver config
Browse files Browse the repository at this point in the history
Remove the dependency to repos/base/run/platform_drv.inc

This doesn't work yet.

Issue genodelabs#342
  • Loading branch information
trimpim committed Sep 28, 2023
1 parent f1d96ce commit 4be8db1
Showing 1 changed file with 87 additions and 59 deletions.
146 changes: 87 additions & 59 deletions run/pkcs11_tool.run
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,27 @@ set usb_dev_addr $::env(USB_DEV_ADDR)
#
set test_id 2

#
# Build
#
set build_components {
core
init
timer
drivers/usb_host
server/report_rom
lib/vfs_pipe
}

source ${genode_dir}/repos/base/run/platform_drv.inc

append_platform_drv_build_components

build $build_components

create_boot_directory

import_from_depot [depot_user]/src/pkcs11_tool/2022-06-21 \
[depot_user]/src/openssl \
[depot_user]/src/stdcxx \
[depot_user]/src/opensc_pkcs11 \
[depot_user]/src/posix \
[depot_user]/src/libc \
[depot_user]/src/vfs \
[depot_user]/src/pcsc-lite \
[depot_user]/src/libusb \
[depot_user]/src/vfs_libusb
lappend depot_archives [depot_user]/src/[base_src] \
[depot_user]/pkg/drivers_managed-[board] \
[depot_user]/src/black_hole \
[depot_user]/src/init \
[depot_user]/src/libc \
[depot_user]/src/libusb \
[depot_user]/src/opensc_pkcs11 \
[depot_user]/src/openssl \
[depot_user]/src/pcsc-lite \
[depot_user]/src/posix \
[depot_user]/src/report_rom \
[depot_user]/src/rom_filter \
[depot_user]/src/stdcxx \
[depot_user]/src/vfs \
[depot_user]/src/vfs_pipe \
[depot_user]/src/vfs_libusb \
mstein/src/pkcs11_tool/2022-06-21 \

import_from_depot $depot_archives

append config {

Expand All @@ -96,43 +87,90 @@ append config {
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>

<default-route>
<any-service> <parent/> <any-child/> </any-service>
<any-service> <parent/> </any-service>
</default-route>
<default caps="100"/>}

append_platform_drv_config

append config {
<default caps="100"/>

<start name="timer">
<resource name="RAM" quantum="2M"/>
<provides><service name="Timer"/></provides>
<provides> <service name="Timer"/> </provides>
</start>

<start name="report_rom">
<start name="drivers_report_rom">
<binary name="report_rom"/>
<resource name="RAM" quantum="2M"/>
<provides>
<service name="Report"/>
<service name="ROM"/>
</provides>
<config verbose="yes"/>
<config verbose="no">
<policy label="drivers -> capslock" report="null"/>
<policy label="drivers -> numlock" report="null"/>
<policy label="drivers -> system" report="null"/>
</config>
</start>

<start name="black_hole">
<resource name="RAM" quantum="2M"/>
<provides>
<service name="Capture"/>
<service name="Event"/>
</provides>
<config>
<capture/>
<event/>
</config>
</start>

<start name="usb_drv" caps="120">
<binary name="} [usb_host_drv_binary] {"/>
<resource name="RAM" quantum="32M"/>
<provides><service name="Usb"/></provides>
<start name="rom_filter">
<resource name="RAM" quantum="2M"/>
<provides>
<service name="ROM"/>
</provides>
<config>
<report devices="yes" />
<policy label="pkcs11-tool -> usb_device" vendor_id="0x4e6" product_id="0x5816"/> <!-- SmartCard-HSM 4K USB-Token -->
<output node="devices">
<inline>
<device label="usb-5-2" vendor_id="0xc4b" product_id="0x500" bus="0x5" dev="0x2" class="0xff">
<interface class="0xff" protocol="0x0"/>
</device>
</inline>
</output>
</config>
</start>

<start name="drivers" caps="5000" managing_system="yes">
<resource name="RAM" quantum="600M"/>
<binary name="init"/>
<provides>
<service name="Usb"/>
</provides>
<route>
<service name="Report"><child name="report_rom"/></service>
<any-service> <parent/> <any-child/> </any-service>
<service name="Capture"> <child name="black_hole"/> </service>
<service name="Event"> <child name="black_hole"/> </service>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
<service name="ROM" label_last="capslock"> <child name="drivers_report_rom"/> </service>
<service name="ROM" label_last="numlock"> <child name="drivers_report_rom"/> </service>
<service name="ROM" label_last="system"> <child name="drivers_report_rom"/> </service>
<service name="ROM" label_last="usb_policy"> <child name="rom_filter"/> </service>
<service name="Report"> <child name="drivers_report_rom"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="Uplink"> <child name="nic_router"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>

<start name="report_rom">
<resource name="RAM" quantum="2M"/>
<provides>
<service name="Report"/>
<service name="ROM"/>
</provides>
<config verbose="yes"/>
</start>

<start name="pkcs11-tool" caps="500">
<resource name="RAM" quantum="10M"/>

Expand Down Expand Up @@ -236,30 +274,20 @@ append config {

</config>
<route>
<any-service> <parent/> <any-child/> </any-service>
<service name="Timer"> <child name="timer"/> </service>
<service name="Usb"> <child name="drivers"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>

</config> }

install_config $config

append boot_modules {
core
ld.lib.so
init
timer
} [usb_host_drv_binary] {
report_rom
vfs_pipe.lib.so
}

append_platform_drv_boot_modules

build_boot_image $boot_modules
build_boot_image [build_artifacts]

append qemu_args " -nographic "
append qemu_args " -device nec-usb-xhci,id=xhci "
append qemu_args " -usb -device nec-usb-xhci,id=xhci "
append qemu_args " -device usb-host,hostbus=$usb_bus_addr,hostaddr=$usb_dev_addr,bus=xhci.0 "

run_genode_until forever

0 comments on commit 4be8db1

Please sign in to comment.