| genrule( | 
 |     name = "image", | 
 |     srcs = [ | 
 |         "@//core/build/linux_kernel:bzImage", | 
 |         "@//core/build/linux_kernel:initramfs", | 
 |     ], | 
 |     outs = [ | 
 |         "smalltown.img", | 
 |     ], | 
 |     cmd = """ | 
 |     $(location @//core/cmd/mkimage) \ | 
 |         -efi $(location @//core/build/linux_kernel:bzImage) \ | 
 |         -initramfs $(location @//core/build/linux_kernel:initramfs) \ | 
 |         -out $@ | 
 |     """, | 
 |     tools = [ | 
 |         "@//core/cmd/mkimage", | 
 |     ], | 
 |     visibility = ["//visibility:public"], | 
 | ) | 
 |  | 
 | genrule( | 
 |     name = "swtpm_data", | 
 |     outs = [ | 
 |         "tpm/tpm2-00.permall", | 
 |         "tpm/signkey.pem", | 
 |         "tpm/issuercert.pem", | 
 |     ], | 
 |     cmd = """ | 
 |     mkdir -p tpm/ca | 
 |  | 
 |     cat <<EOF > tpm/swtpm.conf | 
 | create_certs_tool= /usr/share/swtpm/swtpm-localca | 
 | create_certs_tool_config = tpm/swtpm-localca.conf | 
 | create_certs_tool_options = /etc/swtpm-localca.options | 
 | EOF | 
 |  | 
 |     cat <<EOF > tpm/swtpm-localca.conf | 
 | statedir = tpm/ca | 
 | signingkey = tpm/ca/signkey.pem | 
 | issuercert = tpm/ca/issuercert.pem | 
 | certserial = tpm/ca/certserial | 
 | EOF | 
 |  | 
 |     swtpm_setup \ | 
 |         --tpmstate tpm \ | 
 |         --create-ek-cert \ | 
 |         --create-platform-cert \ | 
 |         --allow-signing \ | 
 |         --tpm2 \ | 
 |         --display \ | 
 |         --pcr-banks sha1,sha256,sha384,sha512 \ | 
 |         --config tpm/swtpm.conf | 
 |  | 
 |     cp tpm/tpm2-00.permall $(location tpm/tpm2-00.permall) | 
 |     cp tpm/ca/issuercert.pem $(location tpm/issuercert.pem) | 
 |     cp tpm/ca/signkey.pem $(location tpm/signkey.pem) | 
 |     """, | 
 |     visibility = ["//visibility:public"], | 
 | ) |