Skip to content

Instantly share code, notes, and snippets.

View ibndias's full-sized avatar
⚔️

Derry Pratama ibndias

⚔️
View GitHub Profile
@ibndias
ibndias / RiscV-Linux-on-Arty-A7-100T.md
Last active April 6, 2024 09:38
Quickstart Running Linux on Arty A7-100T FPGA

A quickstart guide to run Linux on Arty A7 100T FPGA

Because everyone keeps posting about Arty A7 35T while I only have the 100T. This is basically just a guide for linux on litex [https://github.com/litex-hub/linux-on-litex-vexriscv].

Requirements

  • Arty A7 100T FPGA
  • Micro USB Cable
  • and a PC

Prerequisites

@ibndias
ibndias / install_openssl_aarch64.sh
Created January 5, 2022 08:16 — forked from Matheus-Garbelini/install_openssl_aarch64.sh
Compile and install OpenSSL 1.1.1 for arm64 aarch64 android
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz
tar -xvzf openssl-1.1.1.tar.gz
cd openssl-1.1.1/
./Configure linux-aarch64 --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
make -j$(($(nproc)+1))
sudo make install
sudo echo 'LD_LIBRARY_PATH=/usr/local/ssl/lib:${LD_LIBRARY_PATH}' >> /etc/environment
rm openssl-1.1.1.tar.gz
sudo rm openssl-1.1.1 -r
@ibndias
ibndias / keychronfn.sh
Created October 14, 2021 00:38
Keychron Function Key Ubuntu, use F1-F12 first, press FN to use multimedia
echo options hid_apple fnmode=2 | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
sudo reboot # optional
@ibndias
ibndias / maven_single_test.sh
Created August 18, 2021 08:40
Maven run single test
mvn -Dtest=ClassNameTest#TestMethod test -DfailIfNoTests=false
@ibndias
ibndias / erase_from_memory.h
Created July 15, 2021 05:15 — forked from mimoo/erase_from_memory.h
Include this file to get the `erase_from_memory` function that zeros memory. See https://www.cryptologie.net/article/419/zeroing-memory-compiler-optimizations-and-memset_s/
#ifndef __ERASE_FROM_MEMORY_H__
#define __ERASE_FROM_MEMORY_H__ 1
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdlib.h>
#include <string.h>
void *erase_from_memory(void *pointer, size_t size_data, size_t size_to_remove) {
#ifdef __STDC_LIB_EXT1__
memset_s(pointer, size_data, 0, size_to_remove);
@ibndias
ibndias / printbuff.c
Created June 23, 2021 07:15
Print buffer
int i;
for (i = 0; i < 32; i++)
{
if (i > 0) printf(":");
printf("%02X", pk_buf[i]);
}
printf("\n");
ret =0;
@ibndias
ibndias / aria-cbc-test-openssl.c
Created May 11, 2021 09:01
Aria CBC Test OpenSSL
#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/engine.h>
#include <string.h>
#define MAX_MSG_LEN 256
static void handleErrors()
@ibndias
ibndias / build-openssl-clang-riscv.sh
Last active January 6, 2022 00:21
How to build OpenSSL for RISCV using clang
#Adapted from
#https://github.com/openssl/openssl/issues/11073
#How to add -fPIC
#https://stackoverflow.com/questions/2537271/compile-openssl-with-the-shared-option
#export CFLAGS=-fPIC
#or CFLAGS=-fPIC ./config shared --prefix=/your/path
./Configure linux-generic64 -DSOMEMACRO CC="clang -march=rv64g"
CC="clang -march=rv64g" make
@ibndias
ibndias / rebuild-clang-riscv-linux.sh
Created May 11, 2021 06:14
Rebuild the clang using riscv64-unknown-linux-gnu
#/bin/bash
set -e
#rm -rf build
#mkdir build
pushd build
#cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" -DLLVM_ENABLE_PROJECTS=clang -DBUILD_SHARED_LIBS=False -DLLVM_USE_SPLIT_DWARF=True -DCMAKE_INSTALL_PREFIX="/home/derry/riscv/" -DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False -DLLVM_PARALLEL_LINK_JOBS=False -DDEFAULT_SYSROOT="/home/derry/riscv/riscv64-unknown-elf" -DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-elf" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm
cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" -DLLVM_ENABLE_PROJECTS=clang -DBUILD_SHARED_LIBS=False -DLLVM_USE_SPLIT_DWARF=True -DCMAKE_INSTALL_PREFIX="/home/derry/riscv/" -DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False -DLLVM_PARALLEL_LINK_JOBS=False -DDEFAULT_SYSROOT="/home/derry/riscv/sysroot" -DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-linux-gnu" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm
cmake --build . --target install
popd
@ibndias
ibndias / make-clang-mbedtls.sh
Created May 11, 2021 04:52
Compile mbedtls with clang (RISCV64)
CC="clang -march=rv64g -Dunix" make