From 8fa130526050c4d3bdfa5465e06180f813a71f3c Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 7 May 2021 18:38:58 -0700 Subject: rework bootloader installation so can use property-defining macros It is better to have the code which installs bootloaders to volumes in property definitions rather than in plain functions, as then we can specify that it's :POSIX or :LISP, specify the OS required for it to run, and similar. This commit enables that by replacing INSTALL-BOOTLOADER with a different generic which returns propspecs. Signed-off-by: Sean Whitton --- src/property/u-boot.lisp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src/property/u-boot.lisp') diff --git a/src/property/u-boot.lisp b/src/property/u-boot.lisp index 9d8f7f0..4e45527 100644 --- a/src/property/u-boot.lisp +++ b/src/property/u-boot.lisp @@ -18,14 +18,25 @@ (in-package :consfigurator.property.u-boot) (named-readtables:in-readtable :consfigurator) -(defmethod install-bootloader ((type (eql 'u-boot-install-rockchip)) - (volume opened-volume) - running-on-target &key) - (mrun "u-boot-install-rockchip" (device-file volume)) - (mrun "sync")) - -(defmethod install-bootloader-binaries - ((type (eql 'u-boot-install-rockchip)) volume &key) - `(os:etypecase +;; Currently we have a distinct property for each (Debian-specific) +;; installation script. Perhaps there is some sensible parameterisation of +;; these available instead. + +(defmethod install-bootloader-propspec + ((type (eql 'u-boot-install-rockchip)) volume running-on-target + &key &allow-other-keys) + `(u-boot-installed-rockchip ,volume ,running-on-target)) + +(defmethod install-bootloader-binaries-propspec + ((type (eql 'u-boot-install-rockchip)) volume &key &allow-other-keys) + '(os:etypecase (debianlike (apt:installed "u-boot-rockchip")))) + +(defprop u-boot-installed-rockchip :posix (volume running-on-target) + (:desc "Installed U-Boot using Debian scripts") + (:hostattrs + (os:required 'os:debianlike)) + (:apply + (declare (ignore running-on-target)) + (mrun "u-boot-install-rockchip" (device-file volume)))) -- cgit v1.2.3