From b02c4a932d96d0beef364aa5db47106bd0414005 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 16 Nov 2017 16:16:32 -0400 Subject: Machine: New module Machine-specific properties for ARM boards are being collected here See http://linux-sunxi.org/Mainline_Debian_HowTo and https://wiki.debian.org/InstallingDebianOn/Allwinner and https://wiki.debian.org/DebianKernel/ARMMP Currently has 2 arm boards that I use. This commit was sponsored by Anthony DeRobertis on Patreon. --- src/Propellor/Property/Machine.hs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/Propellor/Property/Machine.hs (limited to 'src/Propellor/Property/Machine.hs') diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs new file mode 100644 index 00000000..61a77492 --- /dev/null +++ b/src/Propellor/Property/Machine.hs @@ -0,0 +1,37 @@ +-- | Machine-specific properties. +-- +-- Many embedded computers have their own special configuration needed +-- to use them. Rather than needing to hunt down documentation about the +-- kernel, bootloader, etc needed by a given board, if there's a property +-- in here for your board, you can simply use it. + +module Propellor.Property.Machine ( + -- * ARM boards + Olimex_A10_OLinuXino_LIME, + Cubietech Cubietruck +) + +-- | Olimex A10-OLinuXino-LIME +Olimex_A10_OLinuXino_LIME :: Property (HasInfo + DebianLike) +Olimex_A10_OLinuXino_LIME = FlashKernel.installed "Olimex A10-OLinuXino-LIME" + `requires` sunixi + `requires` armmp + +-- | Cubietech Cubietruck +Cubietech_Cubietruck :: Property (HasInfo + DebianLike) +Cubietech_Cubietruck = FlashKernel.installed "Cubietech Cubietruck" + `requires` sunixi + `requires` lpae + +sunixi :: Property DebianLike +sunixi = Apt.installed + [ "firmware-linux-free" + , "u-boot" + , "sunxi-tools" + ] + +armmp :: Property DebianLike +armmp = Apt.installed ["linux-image-armmp"] + +lpae :: Property DebianLike +lpae = Apt.installed ["linux-image-armmp-lpae"] -- cgit v1.2.3 From 4f2bd92e568baf1b061f7f2fc82288d320de3346 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 16 Nov 2017 16:20:52 -0400 Subject: minor --- joeyconfig.hs | 5 ++--- src/Propellor/Property/Machine.hs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/joeyconfig.hs b/joeyconfig.hs index 31570f45..ba2e9c59 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -24,7 +24,7 @@ import qualified Propellor.Property.Postfix as Postfix import qualified Propellor.Property.Apache as Apache import qualified Propellor.Property.LetsEncrypt as LetsEncrypt import qualified Propellor.Property.Grub as Grub -import qualified Propellor.Property.FlashKernel as FlashKernel +import qualified Propellor.Property.Machine as Machine import qualified Propellor.Property.Borg as Borg import qualified Propellor.Property.Gpg as Gpg import qualified Propellor.Property.Systemd as Systemd @@ -103,8 +103,7 @@ darkstar = host "darkstar.kitenet.net" $ props where mychroot d = debootstrapped mempty d $ props & osDebian Unstable ARMHF - & Apt.installed ["linux-image-armmp", "u-boot"] - & FlashKernel.installed "Olimex A10-OLinuXino-LIME" + & Machine.Olimex_A10_OLinuXino_LIME gnu :: Host gnu = host "gnu.kitenet.net" $ props diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index 61a77492..e193c4a2 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -2,27 +2,27 @@ -- -- Many embedded computers have their own special configuration needed -- to use them. Rather than needing to hunt down documentation about the --- kernel, bootloader, etc needed by a given board, if there's a property --- in here for your board, you can simply use it. +-- kernel, bootloader, etc needed by a given machine, if there's a property +-- in here for your machine, you can simply use it. module Propellor.Property.Machine ( -- * ARM boards - Olimex_A10_OLinuXino_LIME, - Cubietech Cubietruck + Cubietech Cubietruck, + Olimex_A10_OLinuXino_LIME ) --- | Olimex A10-OLinuXino-LIME -Olimex_A10_OLinuXino_LIME :: Property (HasInfo + DebianLike) -Olimex_A10_OLinuXino_LIME = FlashKernel.installed "Olimex A10-OLinuXino-LIME" - `requires` sunixi - `requires` armmp - -- | Cubietech Cubietruck Cubietech_Cubietruck :: Property (HasInfo + DebianLike) Cubietech_Cubietruck = FlashKernel.installed "Cubietech Cubietruck" `requires` sunixi `requires` lpae +-- | Olimex A10-OLinuXino-LIME +Olimex_A10_OLinuXino_LIME :: Property (HasInfo + DebianLike) +Olimex_A10_OLinuXino_LIME = FlashKernel.installed "Olimex A10-OLinuXino-LIME" + `requires` sunixi + `requires` armmp + sunixi :: Property DebianLike sunixi = Apt.installed [ "firmware-linux-free" -- cgit v1.2.3 From 19feb8451b75ae669b45add9e9d9851a542fd981 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 16 Nov 2017 16:41:07 -0400 Subject: propellor spin --- joeyconfig.hs | 12 ++++-------- src/Propellor/Property/Machine.hs | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/joeyconfig.hs b/joeyconfig.hs index ba2e9c59..e044f70c 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -96,14 +96,13 @@ darkstar = host "darkstar.kitenet.net" $ props [ (SshRsa, "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1YoyHxZwG5Eg0yiMTJLSWJ/+dMM6zZkZiR4JJ0iUfP+tT2bm/lxYompbSqBeiCq+PYcSC67mALxp1vfmdOV//LWlbXfotpxtyxbdTcQbHhdz4num9rJQz1tjsOsxTEheX5jKirFNC5OiKhqwIuNydKWDS9qHGqsKcZQ8p+n1g9Lr3nJVGY7eRRXzw/HopTpwmGmAmb9IXY6DC2k91KReRZAlOrk0287LaK3eCe1z0bu7LYzqqS+w99iXZ/Qs0m9OqAPnHZjWQQ0fN4xn5JQpZSJ7sqO38TBAimM+IHPmy2FTNVVn9zGM+vN1O2xr3l796QmaUG1+XLL0shfR/OZbb joey@darkstar") ] & imageBuilt (RawDiskImage "/srv/test.img") mychroot MSDOS - [ partition EXT2 `mountedAt` "/boot" - , partition EXT4 `mountedAt` "/" - , swapPartition (MegaBytes 256) + [ partition EXT4 `mountedAt` "/" + `setSize` MegaBytes 4096 ] where mychroot d = debootstrapped mempty d $ props & osDebian Unstable ARMHF - & Machine.Olimex_A10_OLinuXino_LIME + & Machine.olimex_A10_OLinuXino_LIME gnu :: Host gnu = host "gnu.kitenet.net" $ props @@ -189,10 +188,7 @@ honeybee = host "honeybee.kitenet.net" $ props -- and try to be robust. & "/etc/default/rcS" `File.containsLine` "FSCKFIX=yes" - -- Cubietruck - & Apt.installed ["flash-kernel"] - & "/etc/flash-kernel/machine" `File.hasContent` ["Cubietech Cubietruck"] - & Apt.installed ["linux-image-armmp"] + & Machine.cubietech_Cubietruck & Apt.installed ["firmware-brcm80211"] -- Workaround for https://bugs.debian.org/844056 `requires` File.hasPrivContent "/lib/firmware/brcm/brcmfmac43362-sdio.txt" anyContext diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index e193c4a2..2f356bdd 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -7,19 +7,26 @@ module Propellor.Property.Machine ( -- * ARM boards - Cubietech Cubietruck, - Olimex_A10_OLinuXino_LIME -) + cubietech_Cubietruck, + olimex_A10_OLinuXino_LIME +) where + +import Propellor.Base +import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.FlashKernel as FlashKernel -- | Cubietech Cubietruck -Cubietech_Cubietruck :: Property (HasInfo + DebianLike) -Cubietech_Cubietruck = FlashKernel.installed "Cubietech Cubietruck" +-- +-- 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 `requires` lpae -- | Olimex A10-OLinuXino-LIME -Olimex_A10_OLinuXino_LIME :: Property (HasInfo + DebianLike) -Olimex_A10_OLinuXino_LIME = FlashKernel.installed "Olimex A10-OLinuXino-LIME" +olimex_A10_OLinuXino_LIME :: Property (HasInfo + DebianLike) +olimex_A10_OLinuXino_LIME = FlashKernel.installed "Olimex A10-OLinuXino-LIME" `requires` sunixi `requires` armmp -- cgit v1.2.3 From cff178de9c0d229574ab884fcca08a41f434e119 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 16 Nov 2017 17:54:47 -0400 Subject: Uboot: New module. Installing u-boot to the boot sector is not needed by some boards (my CubieTruck boots without it), but may be by others. Tricky part was making u-boot be written to a disk image when building one. This commit was sponsored by Jake Vosloo on Patreon. --- debian/changelog | 1 + propellor.cabal | 1 + src/Propellor/Property/DiskImage.hs | 33 ++++++++++++++++++--------------- src/Propellor/Property/Machine.hs | 17 +++++++++-------- src/Propellor/Property/Mount.hs | 20 ++++++++++++-------- src/Propellor/Property/Uboot.hs | 36 ++++++++++++++++++++++++++++++++++++ src/Propellor/Types/Bootloader.hs | 9 ++++++++- 7 files changed, 85 insertions(+), 32 deletions(-) create mode 100644 src/Propellor/Property/Uboot.hs (limited to 'src/Propellor/Property/Machine.hs') diff --git a/debian/changelog b/debian/changelog index d6be2ca7..894c906f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ propellor (4.9.1) UNRELEASED; urgency=medium * Qemu: New module. * FlashKernel: New module, can be used to create disk images for ARM boards using flash-kernel. + * Uboot: New module. * Machine: New module, machine-specific properties for ARM boards are being collected here. diff --git a/propellor.cabal b/propellor.cabal index 51640658..239a00e6 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -157,6 +157,7 @@ Library Propellor.Property.Systemd.Core Propellor.Property.Timezone Propellor.Property.Tor + Propellor.Property.Uboot Propellor.Property.Unbound Propellor.Property.User Propellor.Property.Uwsgi diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs index 7493dd21..fe2e60ac 100644 --- a/src/Propellor/Property/DiskImage.hs +++ b/src/Propellor/Property/DiskImage.hs @@ -191,10 +191,14 @@ imageBuilt' rebuild img mkchroot tabletype partspec = -- Pick boot loader finalization based on which bootloader is -- installed. final = case fromInfo (containerInfo chroot) of - [GrubInstalled] -> grubBooted - [FlashKernelInstalled] -> \_ _ -> doNothing [] -> unbootable "no bootloader is installed" - _ -> unbootable "multiple bootloaders are installed; don't know which to use" + l -> case filter ignorablefinal l of + [] -> \_ _ _ -> doNothing + [GrubInstalled] -> grubFinalized + [UbootInstalled p] -> ubootFinalized p + _ -> unbootable "multiple bootloaders are installed; don't know which to use" + ignorablefinal FlashKernelInstalled = True + ignorablefinal _ = False -- | This property is automatically added to the chroot when building a -- disk image. It cleans any caches of information that can be omitted; @@ -229,7 +233,7 @@ imageBuiltFrom img chrootdir tabletype final partspec = mkimg rmimg mkimg' mnts mntopts parttable devs = partitionsPopulated chrootdir mnts mntopts devs `before` - imageFinalized final mnts mntopts devs parttable + imageFinalized final dest mnts mntopts devs parttable rmimg = undoRevertableProperty (buildDiskImage img) `before` undoRevertableProperty (imageExists' dest dummyparttable) dummyparttable = PartTable tabletype [] @@ -352,10 +356,10 @@ imageExists' dest@(RawDiskImage img) parttable = (setup cleanup) `describe` -- -- It's ok if the property leaves additional things mounted -- in the partition tree. -type Finalization = (FilePath -> [LoopDev] -> Property Linux) +type Finalization = (RawDiskImage -> FilePath -> [LoopDev] -> Property Linux) -imageFinalized :: Finalization -> [Maybe MountPoint] -> [MountOpts] -> [LoopDev] -> PartTable -> Property Linux -imageFinalized final mnts mntopts devs (PartTable _ parts) = +imageFinalized :: Finalization -> RawDiskImage -> [Maybe MountPoint] -> [MountOpts] -> [LoopDev] -> PartTable -> Property Linux +imageFinalized final img mnts mntopts devs (PartTable _ parts) = property' "disk image finalized" $ \w -> withTmpDir "mnt" $ \top -> go w top `finally` liftIO (unmountall top) @@ -364,7 +368,7 @@ imageFinalized final mnts mntopts devs (PartTable _ parts) = liftIO $ mountall top liftIO $ writefstab top liftIO $ allowservices top - ensureProperty w $ final top devs + ensureProperty w $ final img top devs -- Ordered lexographically by mount point, so / comes before /usr -- comes before /usr/local @@ -400,18 +404,14 @@ imageFinalized final mnts mntopts devs (PartTable _ parts) = allowservices top = nukeFile (top ++ "/usr/sbin/policy-rc.d") unbootable :: String -> Finalization -unbootable msg = \_ _ -> property desc $ do +unbootable msg = \_ _ _ -> property desc $ do warningMessage (desc ++ ": " ++ msg) return FailedChange where desc = "image is not bootable" --- | Makes grub be the boot loader of the disk image. --- --- This does not install the grub package. You will need to add --- the `Grub.installed` property to the chroot. -grubBooted :: Finalization -grubBooted mnt loopdevs = Grub.bootsMounted mnt wholediskloopdev +grubFinalized :: Finalization +grubFinalized _img mnt loopdevs = Grub.bootsMounted mnt wholediskloopdev `describe` "disk image boots using grub" where -- It doesn't matter which loopdev we use; all @@ -421,6 +421,9 @@ grubBooted mnt loopdevs = Grub.bootsMounted mnt wholediskloopdev (l:_) -> wholeDiskLoopDev l [] -> error "No loop devs provided!" +ubootFinalized :: (FilePath -> FilePath -> Property Linux) -> Finalization +ubootFinalized p (RawDiskImage img) mnt _loopdevs = p img mnt + isChild :: FilePath -> Maybe MountPoint -> Bool isChild mntpt (Just d) | d `equalFilePath` mntpt = False diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index 2f356bdd..5f5024df 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -14,6 +14,7 @@ module Propellor.Property.Machine ( import Propellor.Base import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.FlashKernel as FlashKernel +import qualified Propellor.Property.Uboot as Uboot -- | Cubietech Cubietruck -- @@ -21,21 +22,21 @@ import qualified Propellor.Property.FlashKernel as FlashKernel -- this property. Also, see https://bugs.debian.org/844056 cubietech_Cubietruck :: Property (HasInfo + DebianLike) cubietech_Cubietruck = FlashKernel.installed "Cubietech Cubietruck" - `requires` sunixi + `requires` sunixi "Cubietruck" `requires` lpae -- | Olimex A10-OLinuXino-LIME olimex_A10_OLinuXino_LIME :: Property (HasInfo + DebianLike) olimex_A10_OLinuXino_LIME = FlashKernel.installed "Olimex A10-OLinuXino-LIME" - `requires` sunixi + `requires` sunixi "A10-OLinuXino-Lime" `requires` armmp -sunixi :: Property DebianLike -sunixi = Apt.installed - [ "firmware-linux-free" - , "u-boot" - , "sunxi-tools" - ] +sunixi :: Uboot.BoardName -> Property (HasInfo + DebianLike) +sunixi boardname = Uboot.sunxi boardname + `requires` Apt.installed + [ "firmware-linux-free" + , "sunxi-tools" + ] armmp :: Property DebianLike armmp = Apt.installed ["linux-image-armmp"] diff --git a/src/Propellor/Property/Mount.hs b/src/Propellor/Property/Mount.hs index 2c4d9620..c047161d 100644 --- a/src/Propellor/Property/Mount.hs +++ b/src/Propellor/Property/Mount.hs @@ -90,18 +90,18 @@ mountPointsBelow target = filter (\p -> simplifyPath p /= simplifyPath target) -- | Filesystem type mounted at a given location. getFsType :: MountPoint -> IO (Maybe FsType) -getFsType = findmntField "fstype" +getFsType p = findmntField "fstype" [p] -- | Mount options for the filesystem mounted at a given location. getFsMountOpts :: MountPoint -> IO MountOpts getFsMountOpts p = maybe mempty toMountOpts - <$> findmntField "fs-options" p + <$> findmntField "fs-options" [p] type UUID = String -- | UUID of filesystem mounted at a given location. getMountUUID :: MountPoint -> IO (Maybe UUID) -getMountUUID = findmntField "uuid" +getMountUUID p = findmntField "uuid" [p] -- | UUID of a device getSourceUUID :: Source -> IO (Maybe UUID) @@ -111,7 +111,7 @@ type Label = String -- | Label of filesystem mounted at a given location. getMountLabel :: MountPoint -> IO (Maybe Label) -getMountLabel = findmntField "label" +getMountLabel p = findmntField "label" [p] -- | Label of a device getSourceLabel :: Source -> IO (Maybe UUID) @@ -119,12 +119,16 @@ getSourceLabel = blkidTag "LABEL" -- | Device mounted at a given location. getMountSource :: MountPoint -> IO (Maybe Source) -getMountSource = findmntField "source" +getMountSource p = findmntField "source" [p] -findmntField :: String -> FilePath -> IO (Maybe String) -findmntField field mnt = catchDefaultIO Nothing $ +-- | Device that a given path is located within. +getMountContaining :: FilePath -> IO (Maybe Source) +getMountContaining p = findmntField "source" ["-T", p] + +findmntField :: String -> [String] -> IO (Maybe String) +findmntField field ps = catchDefaultIO Nothing $ headMaybe . filter (not . null) . lines - <$> readProcess "findmnt" ["-n", mnt, "--output", field] + <$> readProcess "findmnt" ("-n" : ps ++ ["--output", field]) blkidTag :: String -> Source -> IO (Maybe String) blkidTag tag dev = catchDefaultIO Nothing $ diff --git a/src/Propellor/Property/Uboot.hs b/src/Propellor/Property/Uboot.hs new file mode 100644 index 00000000..70b4dd68 --- /dev/null +++ b/src/Propellor/Property/Uboot.hs @@ -0,0 +1,36 @@ +module Propellor.Property.Uboot where + +import Propellor.Base +import Propellor.Types.Info +import Propellor.Types.Bootloader +import Propellor.Property.Chroot +import Propellor.Property.Mount +import qualified Propellor.Property.Apt as Apt + +-- | Name of a board. +type BoardName = String + +-- | Installs u-boot for Allwinner/sunxi platforms. +-- +-- This includes writing it to the boot sector. +sunxi :: BoardName -> Property (HasInfo + DebianLike) +sunxi boardname = setInfoProperty (check (not <$> inChroot) go) info + `requires` Apt.installed ["u-boot", "u-boot-sunxi"] + where + go :: Property Linux + go = property' "u-boot installed" $ \w -> do + v <- liftIO $ getMountContaining "/boot" + case v of + Nothing -> error "unable to determine boot device" + Just dev -> ensureProperty w (dd dev "/") + dd :: FilePath -> FilePath -> Property Linux + dd dev prefix = tightenTargets $ cmdProperty "dd" + [ "conv=fsync,notrunc" + , "if=" ++ prefix "/usr/lib/u-boot" + boardname "u-boot-sunxi-with-spl.bin" + , "of=" ++ dev + , "bs=1024" + , "seek=8" + ] + `assume` NoChange + info = toInfo [UbootInstalled dd] diff --git a/src/Propellor/Types/Bootloader.hs b/src/Propellor/Types/Bootloader.hs index 9822d520..fd929d7e 100644 --- a/src/Propellor/Types/Bootloader.hs +++ b/src/Propellor/Types/Bootloader.hs @@ -2,13 +2,20 @@ module Propellor.Types.Bootloader where +import Propellor.Types import Propellor.Types.Info -- | Boot loader installed on a host. data BootloaderInstalled = GrubInstalled | FlashKernelInstalled - deriving (Typeable, Show) + | UbootInstalled (FilePath -> FilePath -> Property Linux) + deriving (Typeable) + +instance Show BootloaderInstalled where + show GrubInstalled = "GrubInstalled" + show FlashKernelInstalled = "FlashKernelInstalled" + show (UbootInstalled _) = "UbootInstalled" instance IsInfo [BootloaderInstalled] where propagateInfo _ = PropagateInfo False -- cgit v1.2.3 From 0266b2f8dac005de2f1c32b41e318e1465967db7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 16 Nov 2017 17:57:17 -0400 Subject: policy on non-free firmware --- src/Propellor/Property/Machine.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index 5f5024df..b6785bdb 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -4,6 +4,11 @@ -- to use them. Rather than needing to hunt down documentation about the -- 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 +-- 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 -- cgit v1.2.3 From 40ad6baf2808fac851d9872df6217ca6393ec6c8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 13:29:16 -0400 Subject: 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. --- src/Propellor/Property/Machine.hs | 50 ++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'src/Propellor/Property/Machine.hs') 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 -- cgit v1.2.3 From 04eaf8e8e5cdcababb3b783abe416821a91c8e8e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 13:36:12 -0400 Subject: propellor spin --- joeyconfig.hs | 11 ++++++++--- src/Propellor/Property/Machine.hs | 11 +++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/joeyconfig.hs b/joeyconfig.hs index bffb0802..4b544064 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -95,14 +95,19 @@ darkstar = host "darkstar.kitenet.net" $ props & Ssh.userKeys (User "joey") hostContext [ (SshRsa, "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1YoyHxZwG5Eg0yiMTJLSWJ/+dMM6zZkZiR4JJ0iUfP+tT2bm/lxYompbSqBeiCq+PYcSC67mALxp1vfmdOV//LWlbXfotpxtyxbdTcQbHhdz4num9rJQz1tjsOsxTEheX5jKirFNC5OiKhqwIuNydKWDS9qHGqsKcZQ8p+n1g9Lr3nJVGY7eRRXzw/HopTpwmGmAmb9IXY6DC2k91KReRZAlOrk0287LaK3eCe1z0bu7LYzqqS+w99iXZ/Qs0m9OqAPnHZjWQQ0fN4xn5JQpZSJ7sqO38TBAimM+IHPmy2FTNVVn9zGM+vN1O2xr3l796QmaUG1+XLL0shfR/OZbb joey@darkstar") ] - & imageBuilt (RawDiskImage "/srv/test.img") - (hostChroot lime (Debootstrapped mempty)) + & imageBuilt (RawDiskImage "/srv/sheevaplug.img") + (hostChroot sheevaplug (Debootstrapped mempty)) MSDOS [ partition EXT4 `mountedAt` "/" - `setSize` MegaBytes 4096 + `setSize` MegaBytes 1024 ] +sheevaplug :: Host +sheevaplug = host "sheevaplug.kitenet.net" $ props + & osDebian Unstable ARMEL + & Machine.marvell_SheevaPlug Machine.Marvell_SheevaPlug_SDCard + lime :: Host lime = host "lime.kitenet.net" $ props & osDebian Unstable ARMHF diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index a351ca80..afffe143 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -28,7 +28,9 @@ import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.FlashKernel as FlashKernel import qualified Propellor.Property.Uboot as Uboot -data Marvell_SheevaPlug_BootDevice = SDCard | ESATA +data Marvell_SheevaPlug_BootDevice + = Marvell_SheevaPlug_SDCard + | Marvell_SheevaPlug_ESATA -- | Marvel SheevaPlug -- @@ -36,10 +38,11 @@ data Marvell_SheevaPlug_BootDevice = SDCard | ESATA -- 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" +marvell_SheevaPlug Marvell_SheevaPlug_SDCard = + FlashKernel.installed "Marvell SheevaPlug Reference Board" `requires` kirkwood - ESATA -> FlashKernel.installed "Marvell eSATA SheevaPlug Reference Board" +marvell_SheevaPlug Marvell_SheevaPlug_ESATA = + FlashKernel.installed "Marvell eSATA SheevaPlug Reference Board" `requires` kirkwood -- | Cubietech Cubietruck (untested) -- cgit v1.2.3 From cd968c5f9439834bad4d9acdc168c16e2dadb190 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 14:07:12 -0400 Subject: propellor spin --- src/Propellor/Property/Machine.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index afffe143..bea1c040 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -40,10 +40,10 @@ data Marvell_SheevaPlug_BootDevice marvell_SheevaPlug :: Marvell_SheevaPlug_BootDevice -> Property (HasInfo + DebianLike) marvell_SheevaPlug Marvell_SheevaPlug_SDCard = FlashKernel.installed "Marvell SheevaPlug Reference Board" - `requires` kirkwood + `requires` marvell marvell_SheevaPlug Marvell_SheevaPlug_ESATA = FlashKernel.installed "Marvell eSATA SheevaPlug Reference Board" - `requires` kirkwood + `requires` marvell -- | Cubietech Cubietruck (untested) -- @@ -75,9 +75,9 @@ lpae :: Property DebianLike lpae = checkArchitecture [ARMHF, ARMEL] $ Apt.installed ["linux-image-armmp-lpae"] -kirkwood :: Property DebianLike -kirkwood = checkArchitecture [ARMEL] $ - Apt.installed ["linux-image-kirkwwood"] +marvell :: Property DebianLike +marvell = checkArchitecture [ARMEL] $ + Apt.installed ["linux-image-marvell"] checkArchitecture :: [Architecture] -> Property DebianLike -> Property DebianLike checkArchitecture as p = withOS (getDesc p) $ \w o -> case o of -- cgit v1.2.3 From b2662cd33467d151b5bb84251750ac80d2dea5cd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 14:38:44 -0400 Subject: fix error msg --- src/Propellor/Property/Machine.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index bea1c040..22bc9a58 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -82,4 +82,4 @@ marvell = checkArchitecture [ARMEL] $ 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 + _ -> error $ "Machine needs architecture to be one of: " ++ show as -- cgit v1.2.3 From f9565ef960a321819fe0760a1277f17c087b5a18 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 14:42:02 -0400 Subject: propellor spin --- joeyconfig.hs | 7 +++++-- src/Propellor/Property/Machine.hs | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/joeyconfig.hs b/joeyconfig.hs index e1329c80..0a018826 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -98,9 +98,12 @@ darkstar = host "darkstar.kitenet.net" $ props & imageBuilt (RawDiskImage "/srv/sheevaplug.img") (hostChroot sheevaplug (Debootstrapped mempty)) MSDOS - [ partition EXT4 + [ partition EXT2 + `mountedAt` "/boot" + `setSize` MegaBytes 150 + , partition EXT4 `mountedAt` "/" - `setSize` MegaBytes 900 + `setSize` MegaBytes 750 ] sheevaplug :: Host diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index 22bc9a58..83c1c42a 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -34,6 +34,8 @@ data Marvell_SheevaPlug_BootDevice -- | Marvel SheevaPlug -- +-- Needs a small /boot partition formatted EXT2 +-- -- 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/ -- cgit v1.2.3 From 4857995cec0d5e42cab328be82425a40f4cf0afa Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 17:41:34 -0400 Subject: tested 2 more arm boards and added a bunch more All the ones that https://wiki.debian.org/InstallingDebianOn/Allwinner says have been tested will probably work. This commit was sponsored by Francois Marier on Patreon. --- src/Propellor/Property/Machine.hs | 97 +++++++++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 10 deletions(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index 83c1c42a..3d49b7c5 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -2,11 +2,14 @@ -- -- Many embedded computers have their own special configuration needed -- to use them. Rather than needing to hunt down documentation about the --- kernel, bootloader, etc needed by a given machine, if there's a property +-- kernel, bootloader, etc for a given machine, if there's a property -- in here for your machine, you can simply use it. -- +-- Not all machine properties have been tested yet. If one flagged as +-- untested and you find it works, please let us know. +-- -- You will need to configure the `Host` with the right `Architecture` --- for the machines. These properties do test at runtime that a supported +-- for the machine. 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 @@ -19,7 +22,18 @@ module Propellor.Property.Machine ( Marvell_SheevaPlug_BootDevice(..), marvell_SheevaPlug, cubietech_Cubietruck, - olimex_A10_OLinuXino_LIME + olimex_A10_OLinuXino_LIME, + -- * ARM boards (untested) + cubietech_Cubieboard, + cubietech_Cubieboard2, + lemaker_Banana_Pi, + lemaker_Banana_Pro, + olimex_A10s_OLinuXino_Micro, + olimex_A20_OLinuXino_LIME, + olimex_A20_OLinuXino_LIME2, + olimex_A20_OLinuXino_Micro, + olimex_A20_SOM_EVB, + linkSprite_pcDuino3_Nano, ) where import Propellor.Base @@ -47,20 +61,83 @@ marvell_SheevaPlug Marvell_SheevaPlug_ESATA = FlashKernel.installed "Marvell eSATA SheevaPlug Reference Board" `requires` marvell --- | Cubietech Cubietruck (untested) +-- | Cubietech Cubietruck -- --- Wifi needs non-free firmware-brcm80211, whicn is not installed by +-- Wifi needs non-free firmware-brcm80211, which 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 + +-- | Cubietech Cubieboard (untested) +cubietech_Cubieboard :: Property (HasInfo + DebianLike) +cubietech_Cubieboard = FlashKernel.installed "Cubietech Cubieboard" + `requires` sunixi "Cubieboard" + `requires` armmp + +-- | Cubietech Cubieboard2 (untested) +cubietech_Cubieboard2 :: Property (HasInfo + DebianLike) +cubietech_Cubieboard2 = FlashKernel.installed "Cubietech Cubieboard2" + `requires` sunixi "Cubieboard2" + `requires` lpae --- | Olimex A10-OLinuXino-LIME (untested) +-- | LeMaker Banana Pi (untested) +lemaker_Banana_Pi :: Property (HasInfo + DebianLike) +lemaker_Banana_Pi = FlashKernel.installed "LeMaker Banana Pi" + `requires` sunixi "Bananapi" + `requires` lpae + +-- | LeMaker Banana Pro (untested) +lemaker_Banana_Pro :: Property (HasInfo + DebianLike) +lemaker_Banana_Pro = FlashKernel.installed "LeMaker Banana Pro" + `requires` sunixi "Bananapro" + `requires` lpae + +-- | Olimex A10-OLinuXino-LIME 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 + +-- | Olimex A10s-Olinuxino Micro (untested) +olimex_A10s_OLinuXino_Micro :: Property (HasInfo + DebianLike) +olimex_A10s_OLinuXino_Micro = FlashKernel.installed "Olimex A10s-Olinuxino Micro" + `requires` sunixi "A10s-OLinuXino-M" + `requires` armmp + +-- | Olimex A20-OlinuXino-LIME (untested) +olimex_A20_OLinuXino_LIME :: Property (HasInfo + DebianLike) +olimex_A20_OLinuXino_LIME = FlashKernel.installed "Olimex A20-OLinuXino-LIME" + `requires` sunixi "A20-OLinuXino-Lime" + `requires` lpae + +-- | Olimex A20-OlinuXino-LIME2 (untested) +olimex_A20_OLinuXino_LIME2 :: Property (HasInfo + DebianLike) +olimex_A20_OLinuXino_LIME2 = FlashKernel.installed "Olimex A20-OLinuXino-LIME2" + `requires` sunixi "A20-OLinuXino-Lime2" + `requires` lpae + +-- | Olimex A20-Olinuxino Micro (untested) +olimex_A20_OLinuXino_Micro :: Property (HasInfo + DebianLike) +olimex_A20_OLinuXino_Micro = FlashKernel.installed "Olimex A20-Olinuxino Micro" + `requires` sunixi "A20-OLinuXino-MICRO" + `requires` lpae + +-- | Olimex A20-SOM-EVB (untested) +olimex_A20_SOM_EVB :: Property (HasInfo + DebianLike) +olimex_A20_SOM_EVB = FlashKernel.installed "Olimex A20-Olimex-SOM-EVB" + `requires` sunixi "A20-Olimex-SOM-EVB" + `requires` lpae + +-- | LinkSprite pcDuino Nano (untested) +-- +-- Needs non-free firmware, see +-- https://wiki.debian.org/InstallingDebianOn/Allwinner +linkSprite_pcDuino3_Nano :: Property (HasInfo + DebianLike) +linkSprite_pcDuino3_Nano = FlashKernel.installed "LinkSprite pcDuino3 Nano" + `requires` sunixi "Linksprite_pcDuino3" + `requires` lpae sunixi :: Uboot.BoardName -> Property (HasInfo + DebianLike) sunixi boardname = Uboot.sunxi boardname -- cgit v1.2.3 From 3cba236a08758c269087fce8f37ea365221d8e5b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Nov 2017 17:56:34 -0400 Subject: tested banana pi This commit was sponsored by André Pereira on Patreon. --- src/Propellor/Property/Machine.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Propellor/Property/Machine.hs') diff --git a/src/Propellor/Property/Machine.hs b/src/Propellor/Property/Machine.hs index 3d49b7c5..b4ffc008 100644 --- a/src/Propellor/Property/Machine.hs +++ b/src/Propellor/Property/Machine.hs @@ -82,7 +82,7 @@ cubietech_Cubieboard2 = FlashKernel.installed "Cubietech Cubieboard2" `requires` sunixi "Cubieboard2" `requires` lpae --- | LeMaker Banana Pi (untested) +-- | LeMaker Banana Pi lemaker_Banana_Pi :: Property (HasInfo + DebianLike) lemaker_Banana_Pi = FlashKernel.installed "LeMaker Banana Pi" `requires` sunixi "Bananapi" -- cgit v1.2.3