summaryrefslogtreecommitdiff
path: root/src/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2017-11-17 13:29:16 -0400
committerJoey Hess2017-11-17 13:29:16 -0400
commit40ad6baf2808fac851d9872df6217ca6393ec6c8 (patch)
tree7cb8dacfab33dde973a67970cec2e82f03245cda /src/Propellor/Property
parent7a43216913cd3a001a8fc00bb5dcf3e11d42ef17 (diff)
add sheevaplug
There are two variants. It only runs on armel, not armhf. Made the properties for machines check the architecture will work. This commit was sponsored by Trenton Cronholm on Patreon.
Diffstat (limited to 'src/Propellor/Property')
-rw-r--r--src/Propellor/Property/Machine.hs50
1 files changed, 41 insertions, 9 deletions
diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs
index b6785bdb..a351ca80 100644
--- a/src/Propellor/Property/Machine.hs
+++ b/src/Propellor/Property/Machine.hs
@@ -5,36 +5,57 @@
-- kernel, bootloader, etc needed by a given machine, if there's a property
-- in here for your machine, you can simply use it.
--
--- Sometime non-free firmware is needed to use a board. If the board won't
+-- You will need to configure the `Host` with the right `Architecture`
+-- for the machines. These properties do test at runtime that a supported
+-- Architecture was selected.
+--
+-- Sometimes non-free firmware is needed to use a board. If the board won't
-- be functional at all without it, its property will include the non-free
-- firmware, but if the non-free firmware is only needed for non-critical
-- functionality, it won't be included.
module Propellor.Property.Machine (
-- * ARM boards
+ Marvell_SheevaPlug_BootDevice(..),
+ marvell_SheevaPlug,
cubietech_Cubietruck,
olimex_A10_OLinuXino_LIME
) where
import Propellor.Base
+import Propellor.Types.Core
import qualified Propellor.Property.Apt as Apt
import qualified Propellor.Property.FlashKernel as FlashKernel
import qualified Propellor.Property.Uboot as Uboot
--- | Cubietech Cubietruck
+data Marvell_SheevaPlug_BootDevice = SDCard | ESATA
+
+-- | Marvel SheevaPlug
+--
+-- Note that u-boot may need to be upgraded manually, and will need to be
+-- configured to boot from the SD card or eSATA. See
+-- https://www.cyrius.com/debian/kirkwood/sheevaplug/install/
+marvell_SheevaPlug :: Marvell_SheevaPlug_BootDevice -> Property (HasInfo + DebianLike)
+marvell_SheevaPlug bd = case bd of
+ SDCard -> FlashKernel.installed "Marvell SheevaPlug Reference Board"
+ `requires` kirkwood
+ ESATA -> FlashKernel.installed "Marvell eSATA SheevaPlug Reference Board"
+ `requires` kirkwood
+
+-- | Cubietech Cubietruck (untested)
--
-- Wifi needs non-free firmware-brcm80211, whicn is not installed by
-- this property. Also, see https://bugs.debian.org/844056
cubietech_Cubietruck :: Property (HasInfo + DebianLike)
cubietech_Cubietruck = FlashKernel.installed "Cubietech Cubietruck"
- `requires` sunixi "Cubietruck"
- `requires` lpae
+ `requires` sunixi "Cubietruck"
+ `requires` lpae
--- | Olimex A10-OLinuXino-LIME
+-- | Olimex A10-OLinuXino-LIME (untested)
olimex_A10_OLinuXino_LIME :: Property (HasInfo + DebianLike)
olimex_A10_OLinuXino_LIME = FlashKernel.installed "Olimex A10-OLinuXino-LIME"
- `requires` sunixi "A10-OLinuXino-Lime"
- `requires` armmp
+ `requires` sunixi "A10-OLinuXino-Lime"
+ `requires` armmp
sunixi :: Uboot.BoardName -> Property (HasInfo + DebianLike)
sunixi boardname = Uboot.sunxi boardname
@@ -44,7 +65,18 @@ sunixi boardname = Uboot.sunxi boardname
]
armmp :: Property DebianLike
-armmp = Apt.installed ["linux-image-armmp"]
+armmp = checkArchitecture [ARMHF, ARMEL] $
+ Apt.installed ["linux-image-armmp"]
lpae :: Property DebianLike
-lpae = Apt.installed ["linux-image-armmp-lpae"]
+lpae = checkArchitecture [ARMHF, ARMEL] $
+ Apt.installed ["linux-image-armmp-lpae"]
+
+kirkwood :: Property DebianLike
+kirkwood = checkArchitecture [ARMEL] $
+ Apt.installed ["linux-image-kirkwwood"]
+
+checkArchitecture :: [Architecture] -> Property DebianLike -> Property DebianLike
+checkArchitecture as p = withOS (getDesc p) $ \w o -> case o of
+ (Just (System _ arch)) | arch `elem` as -> ensureProperty w p
+ _ -> unsupportedOS' -- error $ "Machine needs architecture to be one of: " ++ show as