├── .gitignore ├── README.md ├── apps ├── kegerator │ ├── .gitignore │ ├── README.md │ ├── config │ │ ├── boot │ │ │ └── config.txt │ │ ├── config.exs │ │ ├── fwup.conf │ │ └── rootfs │ │ │ └── etc │ │ │ └── erlinit.config │ ├── lib │ │ ├── kegerator.ex │ │ └── kegerator │ │ │ ├── application.ex │ │ │ ├── network_manager.ex │ │ │ └── temperature.ex │ ├── mix.exs │ ├── rel │ │ ├── config.exs │ │ └── vm.args │ └── test │ │ ├── kegerator_test.exs │ │ └── test_helper.exs └── kegerator_system_rpi3 │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── Config.in │ ├── LICENSE │ ├── README.md │ ├── VERSION │ ├── assets │ └── images │ │ └── raspberry-pi-3-model-b.png │ ├── cmdline.txt │ ├── config.txt │ ├── fwup.conf │ ├── linux-4.4.defconfig │ ├── mix.exs │ ├── mix.lock │ ├── nerves.exs │ ├── nerves_defconfig │ ├── post-createfs.sh │ └── rootfs-additions │ ├── etc │ └── erlinit.config │ └── lib │ └── firmware │ └── brcm │ ├── bcm43xx-0.fw-610.812 │ ├── bcm43xx_hdr-0.fw-610.812 │ ├── brcmfmac43143-sdio.bin │ ├── brcmfmac43143.bin │ ├── brcmfmac43241b0-sdio.bin │ ├── brcmfmac43241b4-sdio.bin │ ├── brcmfmac4329-sdio.bin │ ├── brcmfmac4330-sdio.bin │ ├── brcmfmac4334-sdio.bin │ ├── brcmfmac4335-sdio.bin │ ├── brcmfmac43362-sdio.bin │ ├── brcmfmac43430-sdio.bin │ ├── brcmfmac43430-sdio.txt │ └── brcmfmac4354-sdio.bin ├── config └── config.exs ├── mix.exs └── mix.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # The directory Mix will write compiled artifacts to. 2 | /_build 3 | 4 | # If you run "mix test --cover", coverage assets end up here. 5 | /cover 6 | 7 | # The directory Mix downloads your dependencies sources to. 8 | /deps 9 | 10 | # Where 3rd-party dependencies like ExDoc output generated docs. 11 | /doc 12 | 13 | # Ignore .fetch files in case you like to edit your project deps locally. 14 | /.fetch 15 | 16 | # If the VM crashes, it generates a dump, let's ignore it too. 17 | erl_crash.dump 18 | 19 | # Also ignore archive artifacts (built via "mix archive.build"). 20 | *.ez 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KegeratorUmbrella 2 | 3 | Kegerator is a Nerves based project which uses a Raspberry Pi 3, 4 | a DHT22 Sensor connected on pin 4 and a beefy relay connected on 5 | pin 5. The custom system enabled the DHT11/22 kernel module and 6 | applies the one wire overlay for pin 4. 7 | 8 | See `Kegerator.Temperature` for more about how to poll this sensor. 9 | -------------------------------------------------------------------------------- /apps/kegerator/.gitignore: -------------------------------------------------------------------------------- 1 | # App artifacts 2 | /_build 3 | /db 4 | /deps 5 | /*.ez 6 | 7 | # Nerves artifacts 8 | /_images 9 | /.nerves 10 | 11 | # Generate on crash by the VM 12 | erl_crash.dump 13 | -------------------------------------------------------------------------------- /apps/kegerator/README.md: -------------------------------------------------------------------------------- 1 | # Kegerator 2 | 3 | To start your Nerves app: 4 | 5 | * Install dependencies with `mix deps.get` 6 | * Create firmware with `mix firmware` 7 | * Burn to an SD card with `mix firmware.burn` 8 | 9 | ## Learn more 10 | 11 | * Official docs: https://hexdocs.pm/nerves/getting-started.html 12 | * Official website: http://www.nerves-project.org/ 13 | * Discussion Slack elixir-lang #nerves ([Invite](https://elixir-slackin.herokuapp.com/)) 14 | * Source: https://github.com/nerves-project/nerves 15 | -------------------------------------------------------------------------------- /apps/kegerator/config/boot/config.txt: -------------------------------------------------------------------------------- 1 | # Please note that this is only a sample, we recommend you to change it to fit 2 | # your needs. 3 | # You should override this file using a post-build script. 4 | # See http://buildroot.org/downloads/manual/manual.html#rootfs-custom 5 | # and http://elinux.org/RPiconfig for a description of config.txt syntax 6 | # Device tree options are documented at 7 | # https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md 8 | 9 | kernel=zImage 10 | 11 | # This, along with the Raspberry Pi "x" firmware is need for the camera 12 | # to work. See Target packages->Hardware handling->Firmware for "x" firmware. 13 | gpu_mem=128 14 | 15 | # Enable I2C and SPI 16 | dtparam=i2c_arm=on,spi=on 17 | 18 | # Comment this in or modify to enable OneWire 19 | # NOTE: check that the overlay that you specify is in the boot partition or 20 | # this won't work. 21 | dtoverlay=dht11,gpiopin=4 22 | 23 | # Enable the UART (/dev/ttyS0) on the RPi3. 24 | enable_uart=1 25 | -------------------------------------------------------------------------------- /apps/kegerator/config/config.exs: -------------------------------------------------------------------------------- 1 | # This file is responsible for configuring your application 2 | # and its dependencies with the aid of the Mix.Config module. 3 | # 4 | # This configuration file is loaded before any dependency and 5 | # is restricted to this project. 6 | use Mix.Config 7 | 8 | # Import target specific config. This must remain at the bottom 9 | # of this file so it overrides the configuration defined above. 10 | # Uncomment to use target specific configurations 11 | 12 | # import_config "#{Mix.Project.config[:target]}.exs" 13 | 14 | config :nerves, :firmware, 15 | rootfs_additions: "config/rootfs", 16 | fwup_conf: "config/fwup.conf" 17 | 18 | key_mgmt = System.get_env("NERVES_NETWORK_KEY_MGMT") || "WPA-PSK" 19 | 20 | config :kegerator, :wlan0, 21 | ssid: System.get_env("NERVES_NETWORK_SSID"), 22 | psk: System.get_env("NERVES_NETWORK_PSK"), 23 | key_mgmt: String.to_atom(key_mgmt) 24 | 25 | config :kegerator, :temperature, 26 | temperature: 46, 27 | drift: 1, 28 | relay_pin: 5 29 | -------------------------------------------------------------------------------- /apps/kegerator/config/fwup.conf: -------------------------------------------------------------------------------- 1 | # Firmware configuration file for the Raspberry Pi 3 2 | 3 | # Default paths if not specified via the commandline 4 | define(ROOTFS, "${NERVES_SYSTEM}/images/rootfs.squashfs") 5 | 6 | # This configuration file will create an image that 7 | # has an MBR and the following 3 partitions: 8 | # 9 | # +----------------------------+ 10 | # | MBR | 11 | # +----------------------------+ 12 | # | p0: Boot partition (FAT32) | 13 | # | zImage, bootcode.bin, | 14 | # | config.txt, etc. | 15 | # +----------------------------+ 16 | # | p1*: Rootfs A (squashfs) | 17 | # +----------------------------+ 18 | # | p1*: Rootfs B (squashfs) | 19 | # +----------------------------+ 20 | # | p2: Application (FAT32) | 21 | # +----------------------------+ 22 | # 23 | # The p1 partition points to whichever of Rootfs A or B that 24 | # is active. 25 | # 26 | # The image is sized to be less than 1 GB so that it fits on 27 | # nearly any SDCard around. If you have a larger SDCard and 28 | # need more space, feel free to bump the partition sizes 29 | # below. 30 | 31 | # The Raspberry Pi is incredibly picky on the partition sizes 32 | # and in ways that I don't understand. Test changes one at a 33 | # time to make sure that they boot. (Sizes are in 512 byte 34 | # blocks) 35 | define(BOOT_PART_OFFSET, 63) 36 | define(BOOT_PART_COUNT, 77261) 37 | 38 | # Let the rootfs have room to grow up to 128 MiB and align 39 | # it to the nearest 1 MB boundary 40 | define(ROOTFS_A_PART_OFFSET, 77324) 41 | define(ROOTFS_A_PART_COUNT, 289044) 42 | define(ROOTFS_B_PART_OFFSET, 366368) 43 | define(ROOTFS_B_PART_COUNT, 289044) 44 | 45 | # Application partition. This partition can occupy all of the 46 | # remaining space. Size it to fit the destination. 47 | define(APP_PART_OFFSET, 655412) 48 | define(APP_PART_COUNT, 1048576) 49 | 50 | # Firmware metadata 51 | meta-product = "Nerves Firmware" 52 | meta-description = "" 53 | meta-version = ${NERVES_SDK_VERSION} 54 | meta-platform = "rpi3" 55 | meta-architecture = "arm" 56 | meta-author = "Frank Hunleth" 57 | 58 | # File resources are listed in the order that they are included in the .fw file 59 | # This is important, since this is the order that they're written on a firmware 60 | # update due to the event driven nature of the update system. 61 | file-resource bootcode.bin { 62 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/bootcode.bin" 63 | } 64 | file-resource fixup.dat { 65 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/fixup.dat" 66 | } 67 | file-resource start.elf { 68 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/start.elf" 69 | } 70 | file-resource config.txt { 71 | host-path = "${NERVES_APP}/config/boot/config.txt" 72 | } 73 | file-resource cmdline.txt { 74 | host-path = "${NERVES_SYSTEM}/images/cmdline.txt" 75 | } 76 | file-resource zImage { 77 | host-path = "${NERVES_SYSTEM}/images/zImage" 78 | } 79 | file-resource bcm2710-rpi-3-b.dtb { 80 | host-path = "${NERVES_SYSTEM}/images/bcm2710-rpi-3-b.dtb" 81 | } 82 | file-resource dht11.dtbo { 83 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/dht11.dtbo" 84 | } 85 | 86 | file-resource rootfs.img { 87 | host-path = ${ROOTFS} 88 | } 89 | 90 | mbr mbr-a { 91 | partition 0 { 92 | block-offset = ${BOOT_PART_OFFSET} 93 | block-count = ${BOOT_PART_COUNT} 94 | type = 0xc # FAT32 95 | boot = true 96 | } 97 | partition 1 { 98 | block-offset = ${ROOTFS_A_PART_OFFSET} 99 | block-count = ${ROOTFS_A_PART_COUNT} 100 | type = 0x83 # Linux 101 | } 102 | partition 2 { 103 | block-offset = ${APP_PART_OFFSET} 104 | block-count = ${APP_PART_COUNT} 105 | type = 0xc # FAT32 106 | } 107 | # partition 3 is unused 108 | } 109 | 110 | mbr mbr-b { 111 | partition 0 { 112 | block-offset = ${BOOT_PART_OFFSET} 113 | block-count = ${BOOT_PART_COUNT} 114 | type = 0xc # FAT32 115 | boot = true 116 | } 117 | partition 1 { 118 | block-offset = ${ROOTFS_B_PART_OFFSET} 119 | block-count = ${ROOTFS_B_PART_COUNT} 120 | type = 0x83 # Linux 121 | } 122 | partition 2 { 123 | block-offset = ${APP_PART_OFFSET} 124 | block-count = ${APP_PART_COUNT} 125 | type = 0xc # FAT32 126 | } 127 | # partition 3 is unused 128 | } 129 | 130 | # This firmware task writes everything to the destination media 131 | task complete { 132 | # Only match if not mounted 133 | require-unmounted-destination = true 134 | 135 | # Everything that gets written can be verified on the fly. 136 | # This speeds things up, since we don't care about detecting 137 | # errors before data gets written. 138 | verify-on-the-fly = true 139 | 140 | on-init { 141 | mbr_write(mbr-a) 142 | 143 | fat_mkfs(${BOOT_PART_OFFSET}, ${BOOT_PART_COUNT}) 144 | fat_setlabel(${BOOT_PART_OFFSET}, "BOOT") 145 | fat_mkdir(${BOOT_PART_OFFSET}, "overlays") 146 | } 147 | 148 | on-resource config.txt { fat_write(${BOOT_PART_OFFSET}, "config.txt") } 149 | on-resource cmdline.txt { fat_write(${BOOT_PART_OFFSET}, "cmdline.txt") } 150 | on-resource bootcode.bin { fat_write(${BOOT_PART_OFFSET}, "bootcode.bin") } 151 | on-resource start.elf { fat_write(${BOOT_PART_OFFSET}, "start.elf") } 152 | on-resource fixup.dat { fat_write(${BOOT_PART_OFFSET}, "fixup.dat") } 153 | on-resource zImage { fat_write(${BOOT_PART_OFFSET}, "zImage") } 154 | on-resource bcm2710-rpi-3-b.dtb { fat_write(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb") } 155 | on-resource dht11.dtbo { fat_write(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo") } 156 | 157 | on-resource rootfs.img { 158 | # write to the first rootfs partition 159 | raw_write(${ROOTFS_A_PART_OFFSET}) 160 | } 161 | 162 | on-finish { 163 | # Initialize a big partition for application data 164 | # This is done last so that the boot partition can be written to completely 165 | # before the first write to this partition. Not skipping back and forth between 166 | # FAT filesystems saves a little time when programming the Flash. 167 | fat_mkfs(${APP_PART_OFFSET}, ${APP_PART_COUNT}) 168 | fat_setlabel(${APP_PART_OFFSET}, "APPDATA") 169 | } 170 | } 171 | 172 | task upgrade.a { 173 | # This task upgrades the A partition 174 | require-partition1-offset = ${ROOTFS_B_PART_OFFSET} 175 | 176 | # Since the upgrade won't run until it has been finalized, it's ok 177 | # to write data as it is read. 178 | verify-on-the-fly = true 179 | 180 | on-init { 181 | # Erase any old saved files from previous upgrades 182 | fat_rm(${BOOT_PART_OFFSET}, "zImage.pre") 183 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.pre") 184 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.pre") 185 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.pre") 186 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.pre") 187 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.pre") 188 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.pre") 189 | 190 | # Make the overlays directory in case it isn't already there. 191 | fat_mkdir(${BOOT_PART_OFFSET}, "overlays") 192 | fat_rm(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.pre") 193 | } 194 | 195 | # Write the new firmware and Linux images, but don't 196 | # commit them. That way if the user aborts midway, we 197 | # still are using the original firmware. 198 | on-resource config.txt { fat_write(${BOOT_PART_OFFSET}, "config.txt.new") } 199 | on-resource cmdline.txt { fat_write(${BOOT_PART_OFFSET}, "cmdline.txt.new") } 200 | on-resource bootcode.bin { fat_write(${BOOT_PART_OFFSET}, "bootcode.bin.new") } 201 | on-resource start.elf { fat_write(${BOOT_PART_OFFSET}, "start.elf.new") } 202 | on-resource fixup.dat { fat_write(${BOOT_PART_OFFSET}, "fixup.dat.new") } 203 | on-resource zImage { fat_write(${BOOT_PART_OFFSET}, "zImage.new") } 204 | on-resource bcm2710-rpi-3-b.dtb { fat_write(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") } 205 | on-resource dht11.dtbo { fat_write(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.new") } 206 | 207 | on-resource rootfs.img { 208 | # write to the first rootfs partition 209 | raw_write(${ROOTFS_A_PART_OFFSET}) 210 | } 211 | 212 | on-finish { 213 | # Switch over to boot the new firmware 214 | mbr_write(mbr-a) 215 | 216 | fat_mv(${BOOT_PART_OFFSET}, "zImage", "zImage.pre") 217 | fat_mv(${BOOT_PART_OFFSET}, "config.txt", "config.txt.pre") 218 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt", "cmdline.txt.pre") 219 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin", "bootcode.bin.pre") 220 | fat_mv(${BOOT_PART_OFFSET}, "start.elf", "start.elf.pre") 221 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat", "fixup.dat.pre") 222 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb", "bcm2710-rpi-3-b.dtb.pre") 223 | fat_mv(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo", "overlays/dht11.dtbo.pre") 224 | 225 | fat_mv(${BOOT_PART_OFFSET}, "zImage.new", "zImage") 226 | fat_mv(${BOOT_PART_OFFSET}, "config.txt.new", "config.txt") 227 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt.new", "cmdline.txt") 228 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin.new", "bootcode.bin") 229 | fat_mv(${BOOT_PART_OFFSET}, "start.elf.new", "start.elf") 230 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat.new", "fixup.dat") 231 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new", "bcm2710-rpi-3-b.dtb") 232 | fat_mv(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.new", "overlays/dht11.dtbo") 233 | } 234 | 235 | on-error { 236 | # Clean up in case something goes wrong 237 | fat_rm(${BOOT_PART_OFFSET}, "zImage.new") 238 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.new") 239 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.new") 240 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.new") 241 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.new") 242 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.new") 243 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") 244 | fat_rm(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.new") 245 | } 246 | } 247 | 248 | task upgrade.b { 249 | # This task upgrades the B partition 250 | require-partition1-offset = ${ROOTFS_A_PART_OFFSET} 251 | 252 | # Since the upgrade won't run until it has been finalized, it's ok 253 | # to write data as it is read. 254 | verify-on-the-fly = true 255 | 256 | on-init { 257 | fat_rm(${BOOT_PART_OFFSET}, "zImage.pre") 258 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.pre") 259 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.pre") 260 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.pre") 261 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.pre") 262 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.pre") 263 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.pre") 264 | 265 | fat_mkdir(${BOOT_PART_OFFSET}, "overlays") 266 | fat_rm(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.pre") 267 | } 268 | 269 | on-resource config.txt { fat_write(${BOOT_PART_OFFSET}, "config.txt.new") } 270 | on-resource cmdline.txt { fat_write(${BOOT_PART_OFFSET}, "cmdline.txt.new") } 271 | on-resource bootcode.bin { fat_write(${BOOT_PART_OFFSET}, "bootcode.bin.new") } 272 | on-resource start.elf { fat_write(${BOOT_PART_OFFSET}, "start.elf.new") } 273 | on-resource fixup.dat { fat_write(${BOOT_PART_OFFSET}, "fixup.dat.new") } 274 | on-resource zImage { fat_write(${BOOT_PART_OFFSET}, "zImage.new") } 275 | on-resource bcm2710-rpi-3-b.dtb { fat_write(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") } 276 | on-resource dht11.dtbo { fat_write(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.new") } 277 | 278 | on-resource rootfs.img { 279 | # write to the first rootfs partition 280 | raw_write(${ROOTFS_B_PART_OFFSET}) 281 | } 282 | 283 | on-finish { 284 | # Switch over to boot the new firmware 285 | mbr_write(mbr-b) 286 | 287 | fat_mv(${BOOT_PART_OFFSET}, "zImage", "zImage.pre") 288 | fat_mv(${BOOT_PART_OFFSET}, "config.txt", "config.txt.pre") 289 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt", "cmdline.txt.pre") 290 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin", "bootcode.bin.pre") 291 | fat_mv(${BOOT_PART_OFFSET}, "start.elf", "start.elf.pre") 292 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat", "fixup.dat.pre") 293 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb", "bcm2710-rpi-3-b.dtb.pre") 294 | fat_mv(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo", "overlays/dht11.dtbo.pre") 295 | 296 | fat_mv(${BOOT_PART_OFFSET}, "zImage.new", "zImage") 297 | fat_mv(${BOOT_PART_OFFSET}, "config.txt.new", "config.txt") 298 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt.new", "cmdline.txt") 299 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin.new", "bootcode.bin") 300 | fat_mv(${BOOT_PART_OFFSET}, "start.elf.new", "start.elf") 301 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat.new", "fixup.dat") 302 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new", "bcm2710-rpi-3-b.dtb") 303 | fat_mv(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.new", "overlays/dht11.dtbo") 304 | } 305 | 306 | on-error { 307 | # Clean up in case something goes wrong 308 | fat_rm(${BOOT_PART_OFFSET}, "zImage.new") 309 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.new") 310 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.new") 311 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.new") 312 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.new") 313 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.new") 314 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") 315 | fat_rm(${BOOT_PART_OFFSET}, "overlays/dht11.dtbo.new") 316 | } 317 | } 318 | -------------------------------------------------------------------------------- /apps/kegerator/config/rootfs/etc/erlinit.config: -------------------------------------------------------------------------------- 1 | # Additional configuration for erlinit 2 | 3 | # Turn on the debug prints 4 | #-v 5 | 6 | # Specify the UART port that the shell should use. 7 | -c ttyS0 8 | 9 | # If more than one tty are available, always warn if the user is looking at 10 | # the wrong one. 11 | --warn-unused-tty 12 | 13 | # Use dtach to capture the iex session so that it can be redirected 14 | # to the app's GUI 15 | #-s "/usr/bin/dtach -N /tmp/iex_prompt" 16 | 17 | # Specify the user and group IDs for the Erlang VM 18 | #--uid 100 19 | #--gid 200 20 | 21 | # Uncomment to hang the board rather than rebooting when Erlang exits 22 | #--hang-on-exit 23 | 24 | # Optionally run a program if the Erlang VM exits 25 | #--run-on-exit /bin/sh 26 | 27 | # Enable UTF-8 filename handling in Erlang and custom inet configuration 28 | -e LANG=en_US.UTF-8;LANGUAGE=en;ERL_INETRC=/etc/erl_inetrc 29 | 30 | # Mount the application partition 31 | # See http://www.linuxfromscratch.org/lfs/view/6.3/chapter08/fstab.html about 32 | # ignoring warning the Linux kernel warning about using UTF8 with vfat. 33 | -m /dev/mmcblk0p3:/root:vfat:: 34 | 35 | # Erlang release search path 36 | -r /srv/erlang 37 | 38 | # Assign a unique hostname based on the board id 39 | -d "/usr/bin/boardid -b rpi -n 4" 40 | -n nerves-%.4s 41 | -------------------------------------------------------------------------------- /apps/kegerator/lib/kegerator.ex: -------------------------------------------------------------------------------- 1 | defmodule Kegerator do 2 | 3 | end 4 | -------------------------------------------------------------------------------- /apps/kegerator/lib/kegerator/application.ex: -------------------------------------------------------------------------------- 1 | defmodule Kegerator.Application do 2 | use Application 3 | @interface :wlan0 4 | @kernel_modules Mix.Project.config[:kernel_modules] || [] 5 | # See http://elixir-lang.org/docs/stable/elixir/Application.html 6 | # for more information on OTP Applications 7 | def start(_type, _args) do 8 | import Supervisor.Spec, warn: false 9 | temp_opts = Application.get_env(:kegerator, :temperature) 10 | # Define workers and child supervisors to be supervised 11 | children = [ 12 | worker(Task, [fn -> init_kernel_modules() end], restart: :transient, id: Nerves.Init.KernelModules), 13 | worker(Kegerator.NetworkManager, [@interface]), 14 | worker(Task, [fn -> init_network() end], restart: :transient, id: Nerves.Init.Network), 15 | worker(Kegerator.Temperature, [temp_opts]) 16 | ] 17 | 18 | # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html 19 | # for other strategies and supported options 20 | opts = [strategy: :one_for_one, name: Kegerator.Supervisor] 21 | Supervisor.start_link(children, opts) 22 | end 23 | 24 | def init_kernel_modules() do 25 | Enum.each(@kernel_modules, & System.cmd("modprobe", [&1])) 26 | end 27 | 28 | def init_network() do 29 | opts = Application.get_env(:kegerator, @interface) 30 | Nerves.InterimWiFi.setup(@interface, opts) 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /apps/kegerator/lib/kegerator/network_manager.ex: -------------------------------------------------------------------------------- 1 | defmodule Kegerator.NetworkManager do 2 | use GenServer 3 | require Logger 4 | 5 | @app Mix.Project.config[:app] 6 | 7 | def start_link(iface) do 8 | GenServer.start_link(__MODULE__, iface) 9 | end 10 | 11 | def init(iface) do 12 | iface = to_string(iface) 13 | :os.cmd 'epmd -daemon' 14 | {:ok, pid} = Registry.register(Nerves.Udhcpc, iface, []) 15 | {:ok, %{registry: pid, iface: iface}} 16 | end 17 | 18 | def handle_info({Nerves.Udhcpc, event, %{ipv4_address: ip}}, s) 19 | when event in [:bound, :renew] do 20 | Logger.info "IP Address Changed" 21 | :net_kernel.stop() 22 | :net_kernel.start([:"#{@app}@#{ip}"]) 23 | {:noreply, s} 24 | end 25 | 26 | def handle_info(_event, s) do 27 | {:noreply, s} 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /apps/kegerator/lib/kegerator/temperature.ex: -------------------------------------------------------------------------------- 1 | defmodule Kegerator.Temperature do 2 | use GenServer 3 | require Logger 4 | 5 | @interval 2000 6 | @on 1 7 | @off 0 8 | 9 | def start_link(opts) do 10 | GenServer.start_link(__MODULE__, opts, name: __MODULE__) 11 | end 12 | 13 | def set_temperature(temp) do 14 | GenServer.call(__MODULE__, {:set_temperature, temp}) 15 | end 16 | 17 | def get_current_temperature() do 18 | GenServer.call(__MODULE__, :get_current_temperature) 19 | end 20 | 21 | def set_drift(temp) do 22 | GenServer.call(__MODULE__, {:set_drift, temp}) 23 | end 24 | 25 | def init(opts) do 26 | Logger.debug "Starting Temperature Server" 27 | temperature = opts[:temperature] || raise "No temperature configured" 28 | drift = opts[:drift] || 2 29 | relay_pin = opts[:relay_pin] 30 | {:ok, pid} = Gpio.start_link(relay_pin, :output) 31 | send(self(), :read_temp) 32 | {:ok, %{ 33 | relay: pid, 34 | device: "/sys/bus/iio/devices/iio:device0/in_temp_input", 35 | current_temp: nil, 36 | temperature: temperature, 37 | drift: drift, 38 | status: :off 39 | }} 40 | end 41 | 42 | def handle_call({:set_temperature, temp}, _from, s) do 43 | {:reply, {:ok, temp}, %{s | temperature: temp}} 44 | end 45 | 46 | def handle_call(:get_current_temperature, _from, s) do 47 | {:reply, {:ok, s.current_temp}, s} 48 | end 49 | 50 | def handle_call({:set_drift, temp}, _from, s) do 51 | {:reply, {:ok, temp}, %{s | drift: temp}} 52 | end 53 | 54 | def handle_info(:read_temp, s) do 55 | s = 56 | case File.read(s.device) do 57 | {:ok, temp} -> 58 | 59 | {temp, _} = 60 | String.strip(temp) 61 | |> String.split_at(-3) 62 | |> Tuple.to_list 63 | |> Enum.join(".") 64 | |> Float.parse 65 | f = ((temp * 9) / 5) + 32 66 | f = Float.round(f, 2) 67 | Logger.debug "Read Temp: #{inspect f}" 68 | s = %{s | current_temp: f} 69 | Process.send_after(self(), :read_temp, @interval) 70 | check_set(s) 71 | {:error, _} -> 72 | Process.send_after(self(), :read_temp, 250) 73 | s 74 | end 75 | {:noreply, s} 76 | end 77 | 78 | def check_set(%{status: :off} = s) do 79 | if s.current_temp > (s.temperature + s.drift) do 80 | Logger.debug "Temp: #{inspect s.current_temp} Relay On" 81 | Gpio.write(s.relay, @on) 82 | %{s | status: :on} 83 | else 84 | s 85 | end 86 | end 87 | 88 | def check_set(%{status: :on} = s) do 89 | if s.current_temp < (s.temperature - s.drift) do 90 | Logger.debug "Temp: #{inspect s.current_temp} Relay Off" 91 | Gpio.write(s.relay, @off) 92 | %{s | status: :off} 93 | else 94 | s 95 | end 96 | end 97 | end 98 | -------------------------------------------------------------------------------- /apps/kegerator/mix.exs: -------------------------------------------------------------------------------- 1 | defmodule Kegerator.Mixfile do 2 | use Mix.Project 3 | 4 | @target System.get_env("MIX_TARGET") || "host" 5 | 6 | def project do 7 | [app: :kegerator, 8 | version: "0.1.0", 9 | target: @target, 10 | archives: [nerves_bootstrap: "~> 0.2"], 11 | deps_path: "../../deps/#{@target}", 12 | build_path: "../../_build/#{@target}", 13 | config_path: "../../config/config.exs", 14 | lockfile: "../../mix.lock", 15 | kernel_modules: kernel_modules(@target), 16 | build_embedded: Mix.env == :prod, 17 | start_permanent: Mix.env == :prod, 18 | aliases: aliases(@target), 19 | deps: deps()] 20 | end 21 | 22 | # Configuration for the OTP application. 23 | # 24 | # Type `mix help compile.app` for more information. 25 | def application, do: application(@target) 26 | def application("rpi3") do 27 | [mod: {Kegerator.Application, []}, 28 | extra_applications: [:logger, :runtime_tools]] 29 | end 30 | 31 | def application(_) do 32 | [extra_applications: [:logger]] 33 | end 34 | 35 | def deps do 36 | [{:nerves, github: "nerves-project/nerves", override: true}, 37 | {:nerves_firmware_http, github: "nerves-project/nerves_firmware_http"}] 38 | ++ deps(@target) 39 | end 40 | 41 | def deps("host") do 42 | [] 43 | end 44 | 45 | def deps("rpi3") do 46 | [{:kegerator_system_rpi3, in_umbrella: true}, 47 | {:nerves_interim_wifi, "~> 0.2"}, 48 | {:elixir_ale, "~> 0.1"}] 49 | end 50 | 51 | def kernel_modules("rpi3") do 52 | ["brcmfmac"] 53 | end 54 | def kernel_modules(_), do: [] 55 | 56 | def aliases("rpi3") do 57 | ["deps.precompile": ["nerves.precompile", "deps.precompile"], 58 | "deps.loadpaths": ["deps.loadpaths", "nerves.loadpaths"]] 59 | end 60 | def aliases(_), do: [] 61 | 62 | end 63 | -------------------------------------------------------------------------------- /apps/kegerator/rel/config.exs: -------------------------------------------------------------------------------- 1 | use Mix.Releases.Config, 2 | # This sets the default release built by `mix release` 3 | default_release: :default, 4 | # This sets the default environment used by `mix release` 5 | default_environment: :dev 6 | 7 | # For a full list of config options for both releases 8 | # and environments, visit https://hexdocs.pm/distillery/configuration.html 9 | 10 | 11 | # You may define one or more environments in this file, 12 | # an environment's settings will override those of a release 13 | # when building in that environment, this combination of release 14 | # and environment configuration is called a profile 15 | 16 | environment :dev do 17 | set cookie: :"DIIT%DQA7}J&m<5^rm31Ec*R3mB*$3[Image credit](#fritzing) 8 | 9 | | Feature | Description | 10 | | -------------------- | ------------------------------- | 11 | | CPU | 1.2 GHz quad-core ARMv8 | 12 | | Memory | 1 GB DRAM | 13 | | Storage | MicroSD | 14 | | Linux kernel | 4.4.43 w/ Raspberry Pi patches | 15 | | IEx terminal | HDMI and USB keyboard (can be changed to UART) | 16 | | GPIO, I2C, SPI | Yes - Elixir ALE | 17 | | ADC | No | 18 | | PWM | Yes, but no Elixir support | 19 | | UART | 1 available - ttyS0 | 20 | | Camera | Yes - via rpi-userland | 21 | | Ethernet | Yes | 22 | | WiFi | Yes - Nerves.InterimWiFi | 23 | | Bluetooth | Not yet | 24 | 25 | ## Installation 26 | 27 | If [available in Hex](https://hex.pm/docs/publish), the package can be installed as: 28 | 29 | 1. Add nerves_system_rpi3 to your list of dependencies in `mix.exs`: 30 | 31 | def deps do 32 | [{:nerves_system_rpi3, "~> 0.10.0"}] 33 | end 34 | 35 | 2. Ensure nerves_system_rpi3 is started before your application: 36 | 37 | def application do 38 | [applications: [:nerves_system_rpi3]] 39 | end 40 | 41 | ## Built-in WiFi Firmware 42 | 43 | WiFi modules almost always require proprietary firmware to be loaded for them to work. The 44 | Linux kernel handles this and firmware blobs are maintained in the 45 | `linux-firmware` project. The firmware for the built-in WiFi module on the RPi3 46 | hasn't made it to the `linux-firmware` project nor Buildroot, so it is included 47 | here in a `rootfs-additions` overlay directory. The original firmware files came from 48 | https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm80211/brcm. 49 | 50 | [Image credit](#fritzing): This image is from the [Fritzing](http://fritzing.org/home/) parts library. 51 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/VERSION: -------------------------------------------------------------------------------- 1 | 0.10.1-dev 2 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/assets/images/raspberry-pi-3-model-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/assets/images/raspberry-pi-3-model-b.png -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/cmdline.txt: -------------------------------------------------------------------------------- 1 | console=tty1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait 2 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/config.txt: -------------------------------------------------------------------------------- 1 | # Please note that this is only a sample, we recommend you to change it to fit 2 | # your needs. 3 | # You should override this file using a post-build script. 4 | # See http://buildroot.org/downloads/manual/manual.html#rootfs-custom 5 | # and http://elinux.org/RPiconfig for a description of config.txt syntax 6 | # Device tree options are documented at 7 | # https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md 8 | 9 | kernel=zImage 10 | 11 | # This, along with the Raspberry Pi "x" firmware is need for the camera 12 | # to work. See Target packages->Hardware handling->Firmware for "x" firmware. 13 | gpu_mem=128 14 | 15 | # Enable I2C and SPI 16 | dtparam=i2c_arm=on,spi=on 17 | 18 | # Comment this in or modify to enable OneWire 19 | # NOTE: check that the overlay that you specify is in the boot partition or 20 | # this won't work. 21 | #dtoverlay=w1-gpio-pullup,gpiopin=4 22 | 23 | # Enable the UART (/dev/ttyS0) on the RPi3. 24 | enable_uart=1 25 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/fwup.conf: -------------------------------------------------------------------------------- 1 | # Firmware configuration file for the Raspberry Pi 3 2 | 3 | # Default paths if not specified via the commandline 4 | define(ROOTFS, "${NERVES_SYSTEM}/images/rootfs.squashfs") 5 | 6 | # This configuration file will create an image that 7 | # has an MBR and the following 3 partitions: 8 | # 9 | # +----------------------------+ 10 | # | MBR | 11 | # +----------------------------+ 12 | # | p0: Boot partition (FAT32) | 13 | # | zImage, bootcode.bin, | 14 | # | config.txt, etc. | 15 | # +----------------------------+ 16 | # | p1*: Rootfs A (squashfs) | 17 | # +----------------------------+ 18 | # | p1*: Rootfs B (squashfs) | 19 | # +----------------------------+ 20 | # | p2: Application (FAT32) | 21 | # +----------------------------+ 22 | # 23 | # The p1 partition points to whichever of Rootfs A or B that 24 | # is active. 25 | # 26 | # The image is sized to be less than 1 GB so that it fits on 27 | # nearly any SDCard around. If you have a larger SDCard and 28 | # need more space, feel free to bump the partition sizes 29 | # below. 30 | 31 | # The Raspberry Pi is incredibly picky on the partition sizes 32 | # and in ways that I don't understand. Test changes one at a 33 | # time to make sure that they boot. (Sizes are in 512 byte 34 | # blocks) 35 | define(BOOT_PART_OFFSET, 63) 36 | define(BOOT_PART_COUNT, 77261) 37 | 38 | # Let the rootfs have room to grow up to 128 MiB and align 39 | # it to the nearest 1 MB boundary 40 | define(ROOTFS_A_PART_OFFSET, 77324) 41 | define(ROOTFS_A_PART_COUNT, 289044) 42 | define(ROOTFS_B_PART_OFFSET, 366368) 43 | define(ROOTFS_B_PART_COUNT, 289044) 44 | 45 | # Application partition. This partition can occupy all of the 46 | # remaining space. Size it to fit the destination. 47 | define(APP_PART_OFFSET, 655412) 48 | define(APP_PART_COUNT, 1048576) 49 | 50 | # Firmware metadata 51 | meta-product = "Nerves Firmware" 52 | meta-description = "" 53 | meta-version = ${NERVES_SDK_VERSION} 54 | meta-platform = "rpi3" 55 | meta-architecture = "arm" 56 | meta-author = "Frank Hunleth" 57 | 58 | # File resources are listed in the order that they are included in the .fw file 59 | # This is important, since this is the order that they're written on a firmware 60 | # update due to the event driven nature of the update system. 61 | file-resource bootcode.bin { 62 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/bootcode.bin" 63 | } 64 | file-resource fixup.dat { 65 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/fixup.dat" 66 | } 67 | file-resource start.elf { 68 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/start.elf" 69 | } 70 | file-resource config.txt { 71 | host-path = "${NERVES_SYSTEM}/images/config.txt" 72 | } 73 | file-resource cmdline.txt { 74 | host-path = "${NERVES_SYSTEM}/images/cmdline.txt" 75 | } 76 | file-resource zImage { 77 | host-path = "${NERVES_SYSTEM}/images/zImage" 78 | } 79 | file-resource bcm2710-rpi-3-b.dtb { 80 | host-path = "${NERVES_SYSTEM}/images/bcm2710-rpi-3-b.dtb" 81 | } 82 | file-resource w1-gpio-pullup.dtbo { 83 | host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/w1-gpio-pullup.dtbo" 84 | } 85 | 86 | file-resource rootfs.img { 87 | host-path = ${ROOTFS} 88 | } 89 | 90 | mbr mbr-a { 91 | partition 0 { 92 | block-offset = ${BOOT_PART_OFFSET} 93 | block-count = ${BOOT_PART_COUNT} 94 | type = 0xc # FAT32 95 | boot = true 96 | } 97 | partition 1 { 98 | block-offset = ${ROOTFS_A_PART_OFFSET} 99 | block-count = ${ROOTFS_A_PART_COUNT} 100 | type = 0x83 # Linux 101 | } 102 | partition 2 { 103 | block-offset = ${APP_PART_OFFSET} 104 | block-count = ${APP_PART_COUNT} 105 | type = 0xc # FAT32 106 | } 107 | # partition 3 is unused 108 | } 109 | 110 | mbr mbr-b { 111 | partition 0 { 112 | block-offset = ${BOOT_PART_OFFSET} 113 | block-count = ${BOOT_PART_COUNT} 114 | type = 0xc # FAT32 115 | boot = true 116 | } 117 | partition 1 { 118 | block-offset = ${ROOTFS_B_PART_OFFSET} 119 | block-count = ${ROOTFS_B_PART_COUNT} 120 | type = 0x83 # Linux 121 | } 122 | partition 2 { 123 | block-offset = ${APP_PART_OFFSET} 124 | block-count = ${APP_PART_COUNT} 125 | type = 0xc # FAT32 126 | } 127 | # partition 3 is unused 128 | } 129 | 130 | # This firmware task writes everything to the destination media 131 | task complete { 132 | # Only match if not mounted 133 | require-unmounted-destination = true 134 | 135 | # Everything that gets written can be verified on the fly. 136 | # This speeds things up, since we don't care about detecting 137 | # errors before data gets written. 138 | verify-on-the-fly = true 139 | 140 | on-init { 141 | mbr_write(mbr-a) 142 | 143 | fat_mkfs(${BOOT_PART_OFFSET}, ${BOOT_PART_COUNT}) 144 | fat_setlabel(${BOOT_PART_OFFSET}, "BOOT") 145 | fat_mkdir(${BOOT_PART_OFFSET}, "overlays") 146 | } 147 | 148 | on-resource config.txt { fat_write(${BOOT_PART_OFFSET}, "config.txt") } 149 | on-resource cmdline.txt { fat_write(${BOOT_PART_OFFSET}, "cmdline.txt") } 150 | on-resource bootcode.bin { fat_write(${BOOT_PART_OFFSET}, "bootcode.bin") } 151 | on-resource start.elf { fat_write(${BOOT_PART_OFFSET}, "start.elf") } 152 | on-resource fixup.dat { fat_write(${BOOT_PART_OFFSET}, "fixup.dat") } 153 | on-resource zImage { fat_write(${BOOT_PART_OFFSET}, "zImage") } 154 | on-resource bcm2710-rpi-3-b.dtb { fat_write(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb") } 155 | on-resource w1-gpio-pullup.dtbo { fat_write(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo") } 156 | 157 | on-resource rootfs.img { 158 | # write to the first rootfs partition 159 | raw_write(${ROOTFS_A_PART_OFFSET}) 160 | } 161 | 162 | on-finish { 163 | # Initialize a big partition for application data 164 | # This is done last so that the boot partition can be written to completely 165 | # before the first write to this partition. Not skipping back and forth between 166 | # FAT filesystems saves a little time when programming the Flash. 167 | fat_mkfs(${APP_PART_OFFSET}, ${APP_PART_COUNT}) 168 | fat_setlabel(${APP_PART_OFFSET}, "APPDATA") 169 | } 170 | } 171 | 172 | task upgrade.a { 173 | # This task upgrades the A partition 174 | require-partition1-offset = ${ROOTFS_B_PART_OFFSET} 175 | 176 | # Since the upgrade won't run until it has been finalized, it's ok 177 | # to write data as it is read. 178 | verify-on-the-fly = true 179 | 180 | on-init { 181 | # Erase any old saved files from previous upgrades 182 | fat_rm(${BOOT_PART_OFFSET}, "zImage.pre") 183 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.pre") 184 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.pre") 185 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.pre") 186 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.pre") 187 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.pre") 188 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.pre") 189 | 190 | # Make the overlays directory in case it isn't already there. 191 | fat_mkdir(${BOOT_PART_OFFSET}, "overlays") 192 | fat_rm(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.pre") 193 | } 194 | 195 | # Write the new firmware and Linux images, but don't 196 | # commit them. That way if the user aborts midway, we 197 | # still are using the original firmware. 198 | on-resource config.txt { fat_write(${BOOT_PART_OFFSET}, "config.txt.new") } 199 | on-resource cmdline.txt { fat_write(${BOOT_PART_OFFSET}, "cmdline.txt.new") } 200 | on-resource bootcode.bin { fat_write(${BOOT_PART_OFFSET}, "bootcode.bin.new") } 201 | on-resource start.elf { fat_write(${BOOT_PART_OFFSET}, "start.elf.new") } 202 | on-resource fixup.dat { fat_write(${BOOT_PART_OFFSET}, "fixup.dat.new") } 203 | on-resource zImage { fat_write(${BOOT_PART_OFFSET}, "zImage.new") } 204 | on-resource bcm2710-rpi-3-b.dtb { fat_write(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") } 205 | on-resource w1-gpio-pullup.dtbo { fat_write(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.new") } 206 | 207 | on-resource rootfs.img { 208 | # write to the first rootfs partition 209 | raw_write(${ROOTFS_A_PART_OFFSET}) 210 | } 211 | 212 | on-finish { 213 | # Switch over to boot the new firmware 214 | mbr_write(mbr-a) 215 | 216 | fat_mv(${BOOT_PART_OFFSET}, "zImage", "zImage.pre") 217 | fat_mv(${BOOT_PART_OFFSET}, "config.txt", "config.txt.pre") 218 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt", "cmdline.txt.pre") 219 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin", "bootcode.bin.pre") 220 | fat_mv(${BOOT_PART_OFFSET}, "start.elf", "start.elf.pre") 221 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat", "fixup.dat.pre") 222 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb", "bcm2710-rpi-3-b.dtb.pre") 223 | fat_mv(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo", "overlays/w1-gpio-pullup.dtbo.pre") 224 | 225 | fat_mv(${BOOT_PART_OFFSET}, "zImage.new", "zImage") 226 | fat_mv(${BOOT_PART_OFFSET}, "config.txt.new", "config.txt") 227 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt.new", "cmdline.txt") 228 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin.new", "bootcode.bin") 229 | fat_mv(${BOOT_PART_OFFSET}, "start.elf.new", "start.elf") 230 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat.new", "fixup.dat") 231 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new", "bcm2710-rpi-3-b.dtb") 232 | fat_mv(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.new", "overlays/w1-gpio-pullup.dtbo") 233 | } 234 | 235 | on-error { 236 | # Clean up in case something goes wrong 237 | fat_rm(${BOOT_PART_OFFSET}, "zImage.new") 238 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.new") 239 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.new") 240 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.new") 241 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.new") 242 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.new") 243 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") 244 | fat_rm(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.new") 245 | } 246 | } 247 | 248 | task upgrade.b { 249 | # This task upgrades the B partition 250 | require-partition1-offset = ${ROOTFS_A_PART_OFFSET} 251 | 252 | # Since the upgrade won't run until it has been finalized, it's ok 253 | # to write data as it is read. 254 | verify-on-the-fly = true 255 | 256 | on-init { 257 | fat_rm(${BOOT_PART_OFFSET}, "zImage.pre") 258 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.pre") 259 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.pre") 260 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.pre") 261 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.pre") 262 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.pre") 263 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.pre") 264 | 265 | fat_mkdir(${BOOT_PART_OFFSET}, "overlays") 266 | fat_rm(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.pre") 267 | } 268 | 269 | on-resource config.txt { fat_write(${BOOT_PART_OFFSET}, "config.txt.new") } 270 | on-resource cmdline.txt { fat_write(${BOOT_PART_OFFSET}, "cmdline.txt.new") } 271 | on-resource bootcode.bin { fat_write(${BOOT_PART_OFFSET}, "bootcode.bin.new") } 272 | on-resource start.elf { fat_write(${BOOT_PART_OFFSET}, "start.elf.new") } 273 | on-resource fixup.dat { fat_write(${BOOT_PART_OFFSET}, "fixup.dat.new") } 274 | on-resource zImage { fat_write(${BOOT_PART_OFFSET}, "zImage.new") } 275 | on-resource bcm2710-rpi-3-b.dtb { fat_write(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") } 276 | on-resource w1-gpio-pullup.dtbo { fat_write(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.new") } 277 | 278 | on-resource rootfs.img { 279 | # write to the first rootfs partition 280 | raw_write(${ROOTFS_B_PART_OFFSET}) 281 | } 282 | 283 | on-finish { 284 | # Switch over to boot the new firmware 285 | mbr_write(mbr-b) 286 | 287 | fat_mv(${BOOT_PART_OFFSET}, "zImage", "zImage.pre") 288 | fat_mv(${BOOT_PART_OFFSET}, "config.txt", "config.txt.pre") 289 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt", "cmdline.txt.pre") 290 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin", "bootcode.bin.pre") 291 | fat_mv(${BOOT_PART_OFFSET}, "start.elf", "start.elf.pre") 292 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat", "fixup.dat.pre") 293 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb", "bcm2710-rpi-3-b.dtb.pre") 294 | fat_mv(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo", "overlays/w1-gpio-pullup.dtbo.pre") 295 | 296 | fat_mv(${BOOT_PART_OFFSET}, "zImage.new", "zImage") 297 | fat_mv(${BOOT_PART_OFFSET}, "config.txt.new", "config.txt") 298 | fat_mv(${BOOT_PART_OFFSET}, "cmdline.txt.new", "cmdline.txt") 299 | fat_mv(${BOOT_PART_OFFSET}, "bootcode.bin.new", "bootcode.bin") 300 | fat_mv(${BOOT_PART_OFFSET}, "start.elf.new", "start.elf") 301 | fat_mv(${BOOT_PART_OFFSET}, "fixup.dat.new", "fixup.dat") 302 | fat_mv(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new", "bcm2710-rpi-3-b.dtb") 303 | fat_mv(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.new", "overlays/w1-gpio-pullup.dtbo") 304 | } 305 | 306 | on-error { 307 | # Clean up in case something goes wrong 308 | fat_rm(${BOOT_PART_OFFSET}, "zImage.new") 309 | fat_rm(${BOOT_PART_OFFSET}, "config.txt.new") 310 | fat_rm(${BOOT_PART_OFFSET}, "cmdline.txt.new") 311 | fat_rm(${BOOT_PART_OFFSET}, "bootcode.bin.new") 312 | fat_rm(${BOOT_PART_OFFSET}, "start.elf.new") 313 | fat_rm(${BOOT_PART_OFFSET}, "fixup.dat.new") 314 | fat_rm(${BOOT_PART_OFFSET}, "bcm2710-rpi-3-b.dtb.new") 315 | fat_rm(${BOOT_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo.new") 316 | } 317 | } 318 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/linux-4.4.defconfig: -------------------------------------------------------------------------------- 1 | # CONFIG_ARM_PATCH_PHYS_VIRT is not set 2 | CONFIG_PHYS_OFFSET=0 3 | CONFIG_LOCALVERSION="-v7" 4 | # CONFIG_LOCALVERSION_AUTO is not set 5 | CONFIG_SYSVIPC=y 6 | CONFIG_POSIX_MQUEUE=y 7 | CONFIG_FHANDLE=y 8 | CONFIG_NO_HZ=y 9 | CONFIG_HIGH_RES_TIMERS=y 10 | CONFIG_BSD_PROCESS_ACCT=y 11 | CONFIG_BSD_PROCESS_ACCT_V3=y 12 | CONFIG_TASKSTATS=y 13 | CONFIG_TASK_DELAY_ACCT=y 14 | CONFIG_TASK_XACCT=y 15 | CONFIG_TASK_IO_ACCOUNTING=y 16 | CONFIG_IKCONFIG=y 17 | CONFIG_IKCONFIG_PROC=y 18 | CONFIG_CGROUP_FREEZER=y 19 | CONFIG_CGROUP_DEVICE=y 20 | CONFIG_CPUSETS=y 21 | CONFIG_CGROUP_CPUACCT=y 22 | CONFIG_MEMCG=y 23 | CONFIG_BLK_CGROUP=y 24 | CONFIG_NAMESPACES=y 25 | CONFIG_SCHED_AUTOGROUP=y 26 | CONFIG_BLK_DEV_INITRD=y 27 | # CONFIG_RD_BZIP2 is not set 28 | # CONFIG_RD_LZMA is not set 29 | # CONFIG_RD_XZ is not set 30 | # CONFIG_RD_LZO is not set 31 | # CONFIG_RD_LZ4 is not set 32 | CONFIG_EMBEDDED=y 33 | # CONFIG_COMPAT_BRK is not set 34 | CONFIG_JUMP_LABEL=y 35 | CONFIG_MODULES=y 36 | CONFIG_MODULE_UNLOAD=y 37 | CONFIG_MODVERSIONS=y 38 | CONFIG_MODULE_SRCVERSION_ALL=y 39 | CONFIG_BLK_DEV_THROTTLING=y 40 | CONFIG_PARTITION_ADVANCED=y 41 | CONFIG_MAC_PARTITION=y 42 | CONFIG_CFQ_GROUP_IOSCHED=y 43 | CONFIG_ARCH_BCM2709=y 44 | # CONFIG_CACHE_L2X0 is not set 45 | CONFIG_SMP=y 46 | CONFIG_HAVE_ARM_ARCH_TIMER=y 47 | CONFIG_VMSPLIT_2G=y 48 | CONFIG_PREEMPT=y 49 | CONFIG_AEABI=y 50 | CONFIG_OABI_COMPAT=y 51 | # CONFIG_CPU_SW_DOMAIN_PAN is not set 52 | CONFIG_CLEANCACHE=y 53 | CONFIG_FRONTSWAP=y 54 | CONFIG_CMA=y 55 | CONFIG_UACCESS_WITH_MEMCPY=y 56 | CONFIG_SECCOMP=y 57 | # CONFIG_ATAGS is not set 58 | CONFIG_ZBOOT_ROM_TEXT=0x0 59 | CONFIG_ZBOOT_ROM_BSS=0x0 60 | CONFIG_CMDLINE="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=squashfs rootwait" 61 | CONFIG_CPU_FREQ=y 62 | # CONFIG_CPU_FREQ_STAT is not set 63 | CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y 64 | CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 65 | CONFIG_CPU_FREQ_GOV_USERSPACE=y 66 | CONFIG_CPU_FREQ_GOV_ONDEMAND=y 67 | CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y 68 | CONFIG_VFP=y 69 | CONFIG_NEON=y 70 | CONFIG_KERNEL_MODE_NEON=y 71 | # CONFIG_SUSPEND is not set 72 | CONFIG_PM=y 73 | CONFIG_NET=y 74 | CONFIG_PACKET=y 75 | CONFIG_UNIX=y 76 | CONFIG_INET=y 77 | CONFIG_IP_MULTICAST=y 78 | CONFIG_SYN_COOKIES=y 79 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 80 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set 81 | # CONFIG_INET_XFRM_MODE_BEET is not set 82 | # CONFIG_INET_LRO is not set 83 | # CONFIG_INET_DIAG is not set 84 | # CONFIG_IPV6 is not set 85 | CONFIG_CFG80211=y 86 | CONFIG_CFG80211_INTERNAL_REGDB=y 87 | CONFIG_CFG80211_WEXT=y 88 | CONFIG_MAC80211=y 89 | CONFIG_RFKILL=y 90 | CONFIG_DEVTMPFS=y 91 | CONFIG_DEVTMPFS_MOUNT=y 92 | CONFIG_DMA_CMA=y 93 | CONFIG_CMA_SIZE_MBYTES=5 94 | CONFIG_OF_CONFIGFS=y 95 | CONFIG_BLK_DEV_LOOP=y 96 | CONFIG_EEPROM_AT24=m 97 | CONFIG_SCSI=y 98 | # CONFIG_SCSI_PROC_FS is not set 99 | CONFIG_BLK_DEV_SD=y 100 | # CONFIG_SCSI_LOWLEVEL is not set 101 | CONFIG_NETDEVICES=y 102 | # CONFIG_ETHERNET is not set 103 | CONFIG_USB_USBNET=y 104 | # CONFIG_USB_NET_AX8817X is not set 105 | # CONFIG_USB_NET_AX88179_178A is not set 106 | # CONFIG_USB_NET_CDCETHER is not set 107 | # CONFIG_USB_NET_CDC_NCM is not set 108 | CONFIG_USB_NET_SMSC95XX=y 109 | # CONFIG_USB_NET_NET1080 is not set 110 | # CONFIG_USB_NET_CDC_SUBSET is not set 111 | # CONFIG_USB_NET_ZAURUS is not set 112 | CONFIG_BRCMFMAC=m 113 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set 114 | CONFIG_INPUT_EVDEV=m 115 | # CONFIG_INPUT_KEYBOARD is not set 116 | # CONFIG_INPUT_MOUSE is not set 117 | # CONFIG_SERIO is not set 118 | CONFIG_BRCM_CHAR_DRIVERS=y 119 | CONFIG_BCM_VC_CMA=y 120 | CONFIG_BCM_VCIO=y 121 | CONFIG_BCM_VC_SM=y 122 | CONFIG_BCM2835_DEVGPIOMEM=y 123 | # CONFIG_LEGACY_PTYS is not set 124 | # CONFIG_DEVKMEM is not set 125 | CONFIG_SERIAL_8250=y 126 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set 127 | CONFIG_SERIAL_8250_CONSOLE=y 128 | # CONFIG_SERIAL_8250_DMA is not set 129 | CONFIG_SERIAL_8250_NR_UARTS=1 130 | CONFIG_SERIAL_8250_RUNTIME_UARTS=0 131 | CONFIG_SERIAL_AMBA_PL011=y 132 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 133 | CONFIG_SERIAL_OF_PLATFORM=y 134 | CONFIG_TTY_PRINTK=y 135 | CONFIG_HW_RANDOM=y 136 | CONFIG_RAW_DRIVER=y 137 | CONFIG_I2C=y 138 | CONFIG_I2C_CHARDEV=y 139 | CONFIG_I2C_BCM2708=y 140 | CONFIG_SPI=y 141 | CONFIG_SPI_BCM2835=y 142 | CONFIG_SPI_SPIDEV=y 143 | CONFIG_GPIO_SYSFS=y 144 | CONFIG_GPIO_BCM_VIRT=y 145 | CONFIG_GPIO_STMPE=y 146 | CONFIG_W1=y 147 | CONFIG_W1_MASTER_GPIO=y 148 | CONFIG_W1_SLAVE_THERM=y 149 | # CONFIG_HWMON is not set 150 | CONFIG_THERMAL=y 151 | CONFIG_THERMAL_BCM2835=y 152 | CONFIG_WATCHDOG=y 153 | CONFIG_BCM2835_WDT=m 154 | CONFIG_MFD_STMPE=y 155 | CONFIG_STMPE_SPI=y 156 | CONFIG_FB=y 157 | CONFIG_FB_BCM2708=y 158 | CONFIG_FB_RPISENSE=m 159 | CONFIG_FRAMEBUFFER_CONSOLE=y 160 | CONFIG_LOGO=y 161 | # CONFIG_LOGO_LINUX_MONO is not set 162 | # CONFIG_LOGO_LINUX_VGA16 is not set 163 | CONFIG_SOUND=y 164 | CONFIG_SND=m 165 | CONFIG_SND_SEQUENCER=m 166 | CONFIG_SND_SEQ_DUMMY=m 167 | CONFIG_SND_MIXER_OSS=m 168 | CONFIG_SND_PCM_OSS=m 169 | CONFIG_SND_BCM2835=m 170 | CONFIG_SND_SOC=m 171 | CONFIG_SND_BCM2835_SOC_I2S=m 172 | CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m 173 | CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m 174 | CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m 175 | CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m 176 | CONFIG_SND_BCM2708_SOC_RPI_DAC=m 177 | CONFIG_SND_BCM2708_SOC_RPI_PROTO=m 178 | CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m 179 | CONFIG_SND_BCM2708_SOC_RASPIDAC3=m 180 | CONFIG_SND_SOC_ADAU1701=m 181 | CONFIG_SND_SOC_WM8804_I2C=m 182 | CONFIG_SND_SIMPLE_CARD=m 183 | CONFIG_SOUND_PRIME=m 184 | CONFIG_HIDRAW=y 185 | CONFIG_HID_APPLE=y 186 | CONFIG_HID_PID=y 187 | CONFIG_USB_HIDDEV=y 188 | CONFIG_USB=y 189 | CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 190 | CONFIG_USB_DWCOTG=y 191 | CONFIG_USB_ACM=y 192 | CONFIG_USB_PRINTER=m 193 | CONFIG_USB_WDM=m 194 | CONFIG_USB_STORAGE=y 195 | CONFIG_USB_SERIAL=y 196 | CONFIG_USB_SERIAL_FTDI_SIO=y 197 | CONFIG_MMC=y 198 | CONFIG_MMC_BLOCK_MINORS=32 199 | CONFIG_MMC_BCM2835=y 200 | CONFIG_MMC_BCM2835_DMA=y 201 | CONFIG_MMC_BCM2835_SDHOST=y 202 | CONFIG_MMC_SDHCI=y 203 | CONFIG_MMC_SDHCI_PLTFM=y 204 | CONFIG_NEW_LEDS=y 205 | CONFIG_LEDS_CLASS=y 206 | CONFIG_LEDS_GPIO=y 207 | CONFIG_LEDS_TRIGGERS=y 208 | CONFIG_LEDS_TRIGGER_TIMER=y 209 | CONFIG_LEDS_TRIGGER_ONESHOT=y 210 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y 211 | CONFIG_LEDS_TRIGGER_BACKLIGHT=y 212 | CONFIG_LEDS_TRIGGER_CPU=y 213 | CONFIG_LEDS_TRIGGER_GPIO=y 214 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 215 | CONFIG_LEDS_TRIGGER_TRANSIENT=y 216 | CONFIG_LEDS_TRIGGER_CAMERA=y 217 | CONFIG_LEDS_TRIGGER_INPUT=y 218 | CONFIG_RTC_CLASS=y 219 | # CONFIG_RTC_HCTOSYS is not set 220 | CONFIG_DMADEVICES=y 221 | CONFIG_DMA_BCM2835=y 222 | CONFIG_DMA_BCM2708=y 223 | CONFIG_UIO=m 224 | CONFIG_UIO_PDRV_GENIRQ=m 225 | CONFIG_STAGING=y 226 | CONFIG_R8712U=y 227 | CONFIG_STAGING_MEDIA=y 228 | CONFIG_MAILBOX=y 229 | CONFIG_BCM2835_MBOX=y 230 | # CONFIG_IOMMU_SUPPORT is not set 231 | CONFIG_RASPBERRYPI_POWER=y 232 | CONFIG_IIO=y 233 | CONFIG_DHT11=y 234 | CONFIG_PWM=y 235 | CONFIG_PWM_BCM2835=m 236 | CONFIG_RASPBERRYPI_FIRMWARE=y 237 | CONFIG_EXT4_FS=y 238 | CONFIG_FANOTIFY=y 239 | CONFIG_MSDOS_FS=y 240 | CONFIG_VFAT_FS=y 241 | CONFIG_TMPFS=y 242 | CONFIG_TMPFS_POSIX_ACL=y 243 | CONFIG_SQUASHFS=y 244 | # CONFIG_NETWORK_FILESYSTEMS is not set 245 | CONFIG_NLS_DEFAULT="utf8" 246 | CONFIG_NLS_CODEPAGE_437=y 247 | CONFIG_NLS_CODEPAGE_850=y 248 | CONFIG_NLS_ASCII=y 249 | CONFIG_NLS_ISO8859_1=y 250 | CONFIG_NLS_UTF8=y 251 | CONFIG_PRINTK_TIME=y 252 | CONFIG_BOOT_PRINTK_DELAY=y 253 | CONFIG_DEBUG_MEMORY_INIT=y 254 | CONFIG_DETECT_HUNG_TASK=y 255 | # CONFIG_DEBUG_PREEMPT is not set 256 | CONFIG_STACKTRACE=y 257 | # CONFIG_FTRACE is not set 258 | # CONFIG_CRYPTO_HW is not set 259 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/mix.exs: -------------------------------------------------------------------------------- 1 | defmodule KegeratorSystemRpi3.Mixfile do 2 | use Mix.Project 3 | 4 | @version Path.join(__DIR__, "VERSION") 5 | |> File.read! 6 | |> String.strip 7 | 8 | def project do 9 | [app: :kegerator_system_rpi3, 10 | version: @version, 11 | elixir: "~> 1.3", 12 | compilers: Mix.compilers ++ [:nerves_package], 13 | description: description(), 14 | package: package(), 15 | deps: deps(), 16 | aliases: ["deps.precompile": ["nerves.env", "deps.precompile"]]] 17 | end 18 | 19 | def application do 20 | [] 21 | end 22 | 23 | defp deps do 24 | [{:nerves, "~> 0.4.0"}, 25 | {:nerves_system_br, "~> 0.9.2"}, 26 | {:nerves_toolchain_arm_unknown_linux_gnueabihf, "~> 0.9.0"}] 27 | end 28 | 29 | defp description do 30 | """ 31 | Nerves System - Raspberry Pi 3 B 32 | """ 33 | end 34 | 35 | defp package do 36 | [maintainers: ["Frank Hunleth", "Justin Schneck"], 37 | files: ["LICENSE", "mix.exs", "nerves_defconfig", "nerves.exs", "README.md", "VERSION", "rootfs-additions", "fwup.conf", "cmdline.txt", "linux-4.4.defconfig", "config.txt", "post-createfs.sh"], 38 | licenses: ["Apache 2.0"], 39 | links: %{"Github" => "https://github.com/nerves-project/nerves_system_rpi3"}] 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/mix.lock: -------------------------------------------------------------------------------- 1 | %{"distillery": {:hex, :distillery, "1.1.0", "e9943bd29557e9c252a051d8ac4b47e597cd9bf2a74332b8628eab4954eb51d7", [:mix], []}, 2 | "nerves": {:hex, :nerves, "0.4.6", "2026851cfbf67fd797e6a9f304498bb2d04f39f2d17d6e77ed82fab361178eae", [:mix], [{:distillery, "~> 1.0", [hex: :distillery, optional: false]}]}, 3 | "nerves_system_br": {:hex, :nerves_system_br, "0.9.2", "81bde162f46cfc5a84f08ed34f5a1c8ede4c1d5a8d89f5658afc05388fe4ff69", [:mix], []}, 4 | "nerves_toolchain_arm_unknown_linux_gnueabihf": {:hex, :nerves_toolchain_arm_unknown_linux_gnueabihf, "0.9.0", "5a1bca8c46776ad24c358ab58800ed470f91a3e294ac6eb8ffda0041954781e1", [:mix], [{:nerves, "~> 0.4.0", [hex: :nerves, optional: false]}, {:nerves_toolchain_ctng, "~> 0.8.0", [hex: :nerves_toolchain_ctng, optional: false]}]}, 5 | "nerves_toolchain_ctng": {:hex, :nerves_toolchain_ctng, "0.8.0", "6dff7ed51e1711c5f4da3d559bc528a8265e3dd950dda95f4d6832aed9dbe320", [:mix], []}} 6 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/nerves.exs: -------------------------------------------------------------------------------- 1 | use Mix.Config 2 | 3 | version = 4 | Path.join(__DIR__, "VERSION") 5 | |> File.read! 6 | |> String.strip 7 | 8 | pkg = :kegerator_system_rpi3 9 | 10 | config pkg, :nerves_env, 11 | type: :system, 12 | version: version, 13 | compiler: :nerves_package, 14 | platform: Nerves.System.BR, 15 | platform_config: [ 16 | defconfig: "nerves_defconfig", 17 | ], 18 | checksum: [ 19 | "nerves_defconfig", 20 | "rootfs-additions", 21 | "linux-4.4.defconfig", 22 | "fwup.conf", 23 | "cmdline.txt", 24 | "config.txt", 25 | "post-createfs.sh", 26 | "VERSION" 27 | ] 28 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/nerves_defconfig: -------------------------------------------------------------------------------- 1 | BR2_arm=y 2 | BR2_cortex_a7=y 3 | BR2_ARM_FPU_NEON_VFPV4=y 4 | BR2_TOOLCHAIN_EXTERNAL=y 5 | BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y 6 | BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y 7 | BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/nerves-project/toolchains/releases/download/v0.9.0/nerves_toolchain_arm_unknown_linux_gnueabihf-0.9.0.linux-x86_64.tar.xz" 8 | BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-unknown-linux-gnueabihf" 9 | BR2_TOOLCHAIN_EXTERNAL_GCC_5=y 10 | BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_4=y 11 | BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y 12 | BR2_TOOLCHAIN_EXTERNAL_CXX=y 13 | BR2_TARGET_GENERIC_HOSTNAME="" 14 | BR2_TARGET_GENERIC_ISSUE="" 15 | BR2_INIT_NONE=y 16 | # BR2_TARGET_GENERIC_GETTY is not set 17 | # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set 18 | BR2_ENABLE_LOCALE_WHITELIST="locale-archive" 19 | BR2_GENERATE_LOCALE="en_US.UTF-8" 20 | BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/rootfs-additions ${NERVES_DEFCONFIG_DIR}/rootfs-additions" 21 | BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/post-build.sh" 22 | BR2_ROOTFS_POST_IMAGE_SCRIPT="${NERVES_DEFCONFIG_DIR}/post-createfs.sh" 23 | BR2_LINUX_KERNEL=y 24 | BR2_LINUX_KERNEL_CUSTOM_GIT=y 25 | BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/raspberrypi/linux.git" 26 | BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="1ebe8d4a4c96cd6a90805c74233a468854960f67" 27 | BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y 28 | BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${NERVES_DEFCONFIG_DIR}/linux-4.4.defconfig" 29 | BR2_LINUX_KERNEL_DTS_SUPPORT=y 30 | BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b" 31 | BR2_LINUX_KERNEL_EXT_KERNEL_WIRELESS_REGDB=y 32 | BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_NERVES_PATH}/board/nerves-common/busybox-1.22.config" 33 | BR2_PACKAGE_E2FSPROGS=y 34 | # BR2_PACKAGE_E2FSPROGS_BADBLOCKS is not set 35 | # BR2_PACKAGE_E2FSPROGS_CHATTR is not set 36 | # BR2_PACKAGE_E2FSPROGS_DUMPE2FS is not set 37 | # BR2_PACKAGE_E2FSPROGS_E2FREEFRAG is not set 38 | # BR2_PACKAGE_E2FSPROGS_E2FSCK is not set 39 | # BR2_PACKAGE_E2FSPROGS_E2LABEL is not set 40 | # BR2_PACKAGE_E2FSPROGS_E2UNDO is not set 41 | # BR2_PACKAGE_E2FSPROGS_FILEFRAG is not set 42 | # BR2_PACKAGE_E2FSPROGS_FSCK is not set 43 | # BR2_PACKAGE_E2FSPROGS_LOGSAVE is not set 44 | # BR2_PACKAGE_E2FSPROGS_LSATTR is not set 45 | # BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND is not set 46 | # BR2_PACKAGE_E2FSPROGS_TUNE2FS is not set 47 | # BR2_PACKAGE_E2FSPROGS_UUIDGEN is not set 48 | BR2_PACKAGE_FWUP=y 49 | BR2_PACKAGE_RPI_FIRMWARE=y 50 | BR2_PACKAGE_RPI_FIRMWARE_X=y 51 | BR2_PACKAGE_RPI_USERLAND=y 52 | BR2_PACKAGE_ERLANG_SMP=y 53 | BR2_PACKAGE_LIBMNL=y 54 | BR2_PACKAGE_NCURSES=y 55 | BR2_PACKAGE_WPA_SUPPLICANT=y 56 | BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG=y 57 | BR2_TARGET_ROOTFS_SQUASHFS=y 58 | # BR2_TARGET_ROOTFS_TAR is not set 59 | BR2_NERVES_SYSTEM_NAME="nerves_system_rpi3" 60 | BR2_NERVES_ADDITIONAL_IMAGE_FILES="$(NERVES_DEFCONFIG_DIR)/fwup.conf ${NERVES_DEFCONFIG_DIR}/cmdline.txt ${NERVES_DEFCONFIG_DIR}/config.txt" 61 | BR2_PACKAGE_BOARDID=y 62 | BR2_PACKAGE_ERLANG_HISTORY=y 63 | BR2_PACKAGE_NERVES_CONFIG=y 64 | BR2_PACKAGE_NERVES_CONFIG_NO_ERLINIT_CONF=y 65 | BR2_PACKAGE_NERVES_CONFIG_APPS="crypto" 66 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/post-createfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | FWUP_CONFIG=$NERVES_DEFCONFIG_DIR/fwup.conf 6 | 7 | # Run the common post-image processing for nerves 8 | $BR2_EXTERNAL_NERVES_PATH/board/nerves-common/post-createfs.sh $TARGET_DIR $FWUP_CONFIG 9 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/etc/erlinit.config: -------------------------------------------------------------------------------- 1 | # Additional configuration for erlinit 2 | 3 | # Turn on the debug prints 4 | #-v 5 | 6 | # Specify the UART port that the shell should use. 7 | -c tty1 8 | 9 | # If more than one tty are available, always warn if the user is looking at 10 | # the wrong one. 11 | --warn-unused-tty 12 | 13 | # Use dtach to capture the iex session so that it can be redirected 14 | # to the app's GUI 15 | #-s "/usr/bin/dtach -N /tmp/iex_prompt" 16 | 17 | # Specify the user and group IDs for the Erlang VM 18 | #--uid 100 19 | #--gid 200 20 | 21 | # Uncomment to hang the board rather than rebooting when Erlang exits 22 | --hang-on-exit 23 | 24 | # Optionally run a program if the Erlang VM exits 25 | #--run-on-exit /bin/sh 26 | 27 | # Enable UTF-8 filename handling in Erlang and custom inet configuration 28 | -e LANG=en_US.UTF-8;LANGUAGE=en;ERL_INETRC=/etc/erl_inetrc 29 | 30 | # Mount the application partition 31 | # See http://www.linuxfromscratch.org/lfs/view/6.3/chapter08/fstab.html about 32 | # ignoring warning the Linux kernel warning about using UTF8 with vfat. 33 | -m /dev/mmcblk0p3:/root:vfat:: 34 | 35 | # Erlang release search path 36 | -r /srv/erlang 37 | 38 | # Assign a unique hostname based on the board id 39 | -d "/usr/bin/boardid -b rpi -n 4" 40 | -n nerves-%.4s 41 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/bcm43xx-0.fw-610.812: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/bcm43xx-0.fw-610.812 -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/bcm43xx_hdr-0.fw-610.812: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/bcm43xx_hdr-0.fw-610.812 -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43143-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43143-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43143.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43143.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43241b0-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43241b0-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43241b4-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43241b4-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4329-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4329-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4330-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4330-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4334-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4334-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4335-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4335-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43362-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43362-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43430-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43430-sdio.bin -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac43430-sdio.txt: -------------------------------------------------------------------------------- 1 | # NVRAM file for BCM943430WLPTH 2 | # 2.4 GHz, 20 MHz BW mode 3 | 4 | # The following parameter values are just placeholders, need to be updated. 5 | manfid=0x2d0 6 | prodid=0x0727 7 | vendid=0x14e4 8 | devid=0x43e2 9 | boardtype=0x0727 10 | boardrev=0x1101 11 | boardnum=22 12 | macaddr=00:90:4c:c5:12:38 13 | sromrev=11 14 | boardflags=0x00404201 15 | boardflags3=0x08000000 16 | xtalfreq=37400 17 | nocrc=1 18 | ag0=255 19 | aa2g=1 20 | ccode=ALL 21 | 22 | pa0itssit=0x20 23 | extpagain2g=0 24 | #PA parameters for 2.4GHz, measured at CHIP OUTPUT 25 | pa2ga0=-168,7161,-820 26 | AvVmid_c0=0x0,0xc8 27 | cckpwroffset0=5 28 | 29 | # PPR params 30 | maxp2ga0=84 31 | txpwrbckof=6 32 | cckbw202gpo=0 33 | legofdmbw202gpo=0x66111111 34 | mcsbw202gpo=0x77711111 35 | propbw202gpo=0xdd 36 | 37 | # OFDM IIR : 38 | ofdmdigfilttype=18 39 | ofdmdigfilttypebe=18 40 | # PAPD mode: 41 | papdmode=1 42 | papdvalidtest=1 43 | pacalidx2g=42 44 | papdepsoffset=-22 45 | papdendidx=58 46 | 47 | # LTECX flags 48 | ltecxmux=0 49 | ltecxpadnum=0x0102 50 | ltecxfnsel=0x44 51 | ltecxgcigpio=0x01 52 | 53 | il0macaddr=00:90:4c:c5:12:38 54 | wl0id=0x431b 55 | 56 | deadman_to=0xffffffff 57 | # muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG 58 | muxenab=0x1 59 | # CLDO PWM voltage settings - 0x4 - 1.1 volt 60 | #cldo_pwm=0x4 61 | 62 | #VCO freq 326.4MHz 63 | spurconfig=0x3 64 | 65 | edonthd20l=-75 66 | edoffthd20ul=-80 67 | -------------------------------------------------------------------------------- /apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4354-sdio.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mobileoverlord/kegerator/dc0327cfc95d104304eac676138370d374978e22/apps/kegerator_system_rpi3/rootfs-additions/lib/firmware/brcm/brcmfmac4354-sdio.bin -------------------------------------------------------------------------------- /config/config.exs: -------------------------------------------------------------------------------- 1 | # This file is responsible for configuring your application 2 | # and its dependencies with the aid of the Mix.Config module. 3 | use Mix.Config 4 | 5 | # By default, the umbrella project as well as each child 6 | # application will require this configuration file, ensuring 7 | # they all use the same configuration. While one could 8 | # configure all applications here, we prefer to delegate 9 | # back to each application for organization purposes. 10 | import_config "../apps/*/config/config.exs" 11 | 12 | # Sample configuration (overrides the imported configuration above): 13 | # 14 | # config :logger, :console, 15 | # level: :info, 16 | # format: "$date $time [$level] $metadata$message\n", 17 | # metadata: [:user_id] 18 | -------------------------------------------------------------------------------- /mix.exs: -------------------------------------------------------------------------------- 1 | defmodule KegeratorUmbrella.Mixfile do 2 | use Mix.Project 3 | 4 | def project do 5 | [apps_path: "apps", 6 | build_embedded: Mix.env == :prod, 7 | start_permanent: Mix.env == :prod, 8 | deps: deps()] 9 | end 10 | 11 | # Dependencies can be Hex packages: 12 | # 13 | # {:my_dep, "~> 0.3.0"} 14 | # 15 | # Or git/path repositories: 16 | # 17 | # {:my_dep, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"} 18 | # 19 | # Type "mix help deps" for more examples and options. 20 | # 21 | # Dependencies listed here are available only for this project 22 | # and cannot be accessed from applications inside the apps folder 23 | defp deps do 24 | [] 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /mix.lock: -------------------------------------------------------------------------------- 1 | %{"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, optional: false]}]}, 2 | "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], []}, 3 | "distillery": {:hex, :distillery, "1.1.2", "4cf32ecc70ca7eecca9e52e111edf320bd78011050825863cd8bc7ffee686c5d", [:mix], []}, 4 | "elixir_ale": {:hex, :elixir_ale, "0.5.7", "f6b978dd30dc3ecf2b5feaef862d30873c6a6fdca41fc7f6bb743d6783b3fe4b", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, optional: false]}]}, 5 | "elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [:mix], []}, 6 | "exjsx": {:hex, :exjsx, "3.2.1", "1bc5bf1e4fd249104178f0885030bcd75a4526f4d2a1e976f4b428d347614f0f", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, optional: false]}]}, 7 | "jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [:mix, :rebar3], []}, 8 | "nerves": {:git, "https://github.com/nerves-project/nerves.git", "51ff223c15dc17ad61614c6951ee02d67bda2f97", []}, 9 | "nerves_firmware": {:git, "https://github.com/nerves-project/nerves_firmware.git", "b783df3867c82dc0abe6770079077a6f922c00a9", []}, 10 | "nerves_firmware_http": {:git, "https://github.com/nerves-project/nerves_firmware_http.git", "d8206a58ba7184bd8419080fc51d13543af705ca", []}, 11 | "nerves_interim_wifi": {:hex, :nerves_interim_wifi, "0.2.0", "d8fa51dfcdaf06c2d453de03ef22e7a3ca673412718b1c988b5742fb1629d8cc", [:make, :mix], [{:elixir_make, "~> 0.3", [hex: :elixir_make, optional: false]}, {:nerves_network_interface, "~> 0.4.0", [hex: :nerves_network_interface, optional: false]}, {:nerves_wpa_supplicant, "~> 0.3.0", [hex: :nerves_wpa_supplicant, optional: false]}]}, 12 | "nerves_network_interface": {:hex, :nerves_network_interface, "0.4.0", "a8e7662cd56fb4fe9060c891d35c43bbbff692ee6fd2d5efd538717da0cd96b8", [:make, :mix], [{:elixir_make, "~> 0.3", [hex: :elixir_make, optional: false]}]}, 13 | "nerves_system_br": {:hex, :nerves_system_br, "0.9.4", "5096a9dfec49d4663ccb94c4a4fe45885303fbf31108f7e9400369bdec94b5e7", [:mix], []}, 14 | "nerves_toolchain_arm_unknown_linux_gnueabihf": {:hex, :nerves_toolchain_arm_unknown_linux_gnueabihf, "0.9.0", "5a1bca8c46776ad24c358ab58800ed470f91a3e294ac6eb8ffda0041954781e1", [:mix], [{:nerves, "~> 0.4.0", [hex: :nerves, optional: false]}, {:nerves_toolchain_ctng, "~> 0.8.0", [hex: :nerves_toolchain_ctng, optional: false]}]}, 15 | "nerves_toolchain_ctng": {:hex, :nerves_toolchain_ctng, "0.8.0", "6dff7ed51e1711c5f4da3d559bc528a8265e3dd950dda95f4d6832aed9dbe320", [:mix], []}, 16 | "nerves_wpa_supplicant": {:hex, :nerves_wpa_supplicant, "0.3.0", "dfda748df2662e1e9e95df6662c3a512d371ef23359b2c090b9c8c884b236a3d", [:make, :mix], [{:elixir_make, "~> 0.3", [hex: :elixir_make, optional: false]}]}, 17 | "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], []}} 18 | --------------------------------------------------------------------------------