Skip to content

Instantly share code, notes, and snippets.

Haskell, nix, functional programming

Aleksandar Topuzović atopuzov

Block or report user

Report or block atopuzov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
atopuzov /
Created May 14, 2019 — forked from markwylde/
Build Coreboot for ARM Chromebook - C201 Veyron Speedy

These instructions will take you through the step by step process of building and flashing a custom build of the Coreboot ROM to a Chromebook C201.

This guide expects you to have a Chromebook C201, and another ARM computer with Ubuntu installed. Specifically I used the Odroid XU2. You may be able to do this on an Intel platform, using a cross compiler. See the sidenotes section for more information.

Setting up your Ubuntu

Install dependancies

Update your Ubuntu aptitude and install the dependancies we will need.

sudo apt update
View writer_monad.hs
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad.Writer (MonadWriter, Writer, tell, runWriter, runWriterT)
import Data.Functor.Identity (Identity, runIdentity)
import Data.Monoid (mempty)
-- manual threading of log
logSum :: [(Int, Int)] -> Int -> Int -> (Int, [(Int, Int)])
logSum log x y = (result, newlog)
View state_monad.hs
{-# LANGUAGE FlexibleContexts #-}
-- FelixbleContexts required for MonadState
import Control.Monad.State (MonadState, State, get, put, runStateT, evalStateT, execStateT)
import Data.Functor.Identity (Identity, runIdentity)
-- Threading the state trough functions and returning vale and state product
inc1 :: Int -> (Int, Int)
inc1 state = (value, newState)
View reader_monad_and_io.hs
{-# LANGUAGE FlexibleContexts #-}
-- FelixbleContexts required for MonadReader, MonadIO
-- Based on
import Control.Monad.Reader (MonadReader, ReaderT, ask, runReaderT)
import Control.Monad.IO.Class (MonadIO, liftIO)
-- Need 2 files in the current directory
-- test.txt (read by the load function)
-- history5.txt (read by the loadRevsion function)
View reader_monad.hs
{-# LANGUAGE FlexibleContexts #-}
-- FelixbleContexts required for MonadReader
-- Based on
import Control.Monad.Reader (ask, runReader, MonadReader, Reader)
import Control.Applicative ((<*>))
import Control.Monad ((>>=))
-- Environment type
type MyEnv = String
View diff -Naur before.yaml now.yaml | cat -vet
--- before.yaml^I2017-09-29 11:44:09.000000000 +0100$
+++ now.yaml^I2017-09-29 12:18:11.000000000 +0100$
@@ -13,7 +13,7 @@$
kube-api.rules: |-$
# NOTE: These rules were kindly contributed by the SoundCloud engineering team.$
+ $
ALERT K8SApiServerLatency$
IF histogram_quantile($
export ARCH=arm
export CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi-
export KERNEL_SERIES=v4.13
export KERNEL_BRANCH=v4.13-rc1
export MALI_VERSION=r19p0-01rel0
export DTB_FILES="
Starting Google_Veyron_Speedy firmware updater v5 (recovery)... 
 - Updater package: [Google_Veyron_Speedy.6588.197.0 / EC:speedy_v1.1.2712-242f6bd] 
 - Current system:  [RO:libreboot-r20160907 , ACT:libreboot-r20160907 / EC:speedy_v1.1.2697-faafaa5] 
 - Write protection: Hardware: off, Software: Main=ON EC=ON 
  Sorry, this firmware update is only for Google_Veyron_Speedy platform. 
  Your system (libreboot-r20160907) is either incompatible or using an 
  unknown version of firmware. 
#!/usr/bin/env python
import re
cpy_regex = re.compile(r"cpy ((?P<reg>[a-z]+)|(?P<num>\d+)) (?P<y>\w+)")
inc_regex = re.compile(r"inc (?P<x>\w+)")
dec_regex = re.compile(r"dec (?P<x>\w+)")
jnz_regex = re.compile(r"jnz ((?P<reg>[a-z]+)|(?P<num>\d+)) (?P<y>[\w-]+)")
class Cmd(object):
#!/usr/bin/env python
import re
value_regex = re.compile("value (?P<value>\d+) goes to bot (?P<dest>\d+)")
gives_regex = re.compile("bot (?P<bot>\d+) gives low to (?P<low_dest>(output|bot)) (?P<low_id>\d+) and high to (?P<high_dest>(output|bot)) (?P<high_id>\d+)")
class Element(object):
def store(self):
raise NotImplemented('Need to override this.')
You can’t perform that action at this time.