Skip to content

Instantly share code, notes, and snippets.

View paranlee's full-sized avatar
๐Ÿง
Run RISC-V run!

Paran Lee paranlee

๐Ÿง
Run RISC-V run!
View GitHub Profile
@paranlee
paranlee / run-aarch64.sh
Created August 13, 2022 00:26 — forked from bvibber/run-aarch64.sh
Fedora aarch64 QEMU system image runner script
#!/bin/bash
# Starter script for Fedora aarch64 in QEMU, cobbled from various sources.
# Requires qemu-system-aarch64 to be installed.
# Configuration options:
IMAGE=fedora-29-aarch64.img
RAM=2048
CPUS=4
Linking libstdc++ statically
Christopher Baus writes about his problems linking libstdc++ statically. Yes, making C++ binaries that will work properly in different Linux distributions is somewhat painful. The problem is not so much linking libstdc++ statically โ€“ it is just a library, after all โ€“ but the runtime support required by C++ code in general, to enable features like RTTI and exception handling.
The runtime support code used by different parts of a C++ application needs to be compatible. If one part of the program needs to dynamic_cast or catch objects provided by another, both parts must agree on certain implementation details: how to find vtables, how to unwind the stack, and so on.
For C++ and a few other GCC-supported languages with similar features, such details are specified by a C++ ABI. Whenever the ABI used by GCC changes you'll end up with incompatible libraries produced by the different GCC versions. The same is true for plain C, but the C ABI is much simpler and has been around a lot lon
@paranlee
paranlee / lwnfs.c
Created August 8, 2022 12:28 — forked from RadNi/lwnfs.c
Updated lwnfs
/*
* Demonstrate a trivial filesystem using libfs.
*
* Copyright 2002, 2003 Jonathan Corbet <[email protected]>
* This file may be redistributed under the terms of the GNU GPL.
*
* Chances are that this code will crash your system, delete your
* nethack high scores, and set your disk drives on fire. You have
* been warned.
@paranlee
paranlee / lwnfs.c
Created August 8, 2022 12:27 — forked from prashants/lwnfs.c
Updated lwnfs
/*
* Demonstrate a trivial filesystem using libfs.
*
* Copyright 2002, 2003 Jonathan Corbet <[email protected]>
* This file may be redistributed under the terms of the GNU GPL.
*
* Chances are that this code will crash your system, delete your
* nethack high scores, and set your disk drives on fire. You have
* been warned.
*/
@paranlee
paranlee / driver.c
Created August 3, 2022 13:11
Proc Filesystem Example.
/**
* Linux Device Driver Tutorial Part 9 โ€“ Procfs in Linux
* - https://embetronicx.com/tutorials/linux/device-drivers/procfs-in-linux/
**/
/***************************************************************************//**
* \file driver.c
*
* \details Simple Linux device driver (procfs)
*
@paranlee
paranlee / dump_pmem.sh
Created August 3, 2022 12:45 — forked from jgru/dump_pmem.sh
Script to dump the process memory of a given process on a Linux system to a file
#!/bin/sh
#
# Version dump_proc_mem 0.0.1
# Author Jan Gru
# Copyright Copyright (c) Jan Gru
# License GNU General Public License
# Checks, if root permissions
if [ $(id -u) -ne 0 ]
then echo "Error: needing root permissions!" >&2
@paranlee
paranlee / kernel-aarch64-debug-rhel-full.config
Created June 26, 2022 14:05
ARM 64 Linux kernel-5.14.0-70.13.1.el9_0 Debug Kernel Config.
# arm64
# CONFIG_60XX_WDT is not set
CONFIG_64BIT=y
# CONFIG_6LOWPAN_DEBUGFS is not set
# CONFIG_6LOWPAN is not set
# CONFIG_6LOWPAN_NHC is not set
CONFIG_8139CP=m
# CONFIG_8139_OLD_RX_RESET is not set
CONFIG_8139TOO_8129=y
CONFIG_8139TOO=m
@paranlee
paranlee / centos7-install.sh
Last active June 9, 2022 19:41
Computer System Monotoring Evironmental based on eBPF.
# bcc
sudo yum install -y epel-release
sudo yum update -y
sudo yum groupinstall -y "Development tools"
sudo yum install -y elfutils-libelf-devel git bison flex ncurses-devel
sudo yum install -y luajit luajit-devel # for Lua support
sudo yum install -y python3 python3-devel python3-pip
pip3 install cmake
@paranlee
paranlee / Svn2Git.md
Created June 5, 2022 18:18 — forked from ikaruce/Svn2Git.md
SVN์—์„œ Git์œผ๋กœ ์ „ํ™˜ํ•˜๊ธฐ(๋ธŒ๋žœ์น˜์™€ ํƒœ๊ทธ ๋ณด์ „ํ•˜๋ฉด์„œ)

SVN์—์„œ Git์œผ๋กœ ์ „ํ™˜ํ•˜๊ธฐ

(์›๋ฌธ http://www.sailmaker.co.uk/blog/2013/05/05/migrating-from-svn-to-git-preserving-branches-and-tags-3/ )

๋ธŒ๋žœ์น˜์™€ ํƒœ๊ทธ ๋ณด์ „ํ•˜๋ฉด์„œ

git svn ์„ ์‚ฌ์šฉํ•ด์„œ SVN์—์„œ ๋ธŒ๋žœ์น˜์™€ ํƒœ๊ทธ๋ฅผ ๋ณด์กดํ•˜๋ฉด์„œ Git์œผ๋กœ ์ „ํ™˜ํ•˜๋Š” ๊ฒƒ์„ ์„ค๋ช…ํ•œ๋‹ค.

๋กœ์ปฌ ์Šคํ…Œ์ด์ง• ๋ฆฌํŒŒ์ง€ํ† ๋ฆฌ๋กœ import

๋กœ์ปฌ ์Šคํ…Œ์ด์ง• ํด๋” ์ƒ์„ฑ
$ mkdir staging
@paranlee
paranlee / gist:1e4b571f82459cd5508bb5d4d4599ea3
Created June 5, 2022 16:25 — forked from danieldk/gist:5700533
Berkeley DB 4.8 patch for compilers that have __atomic_compare_exchange.
Binary files dbxml-2.5.16.orig/db-4.8.26/dbinc/.atomic.h.un~ and dbxml-2.5.16/db-4.8.26/dbinc/.atomic.h.un~ differ
diff -ruN dbxml-2.5.16.orig/db-4.8.26/dbinc/atomic.h dbxml-2.5.16/db-4.8.26/dbinc/atomic.h
--- dbxml-2.5.16.orig/db-4.8.26/dbinc/atomic.h 2013-06-03 21:04:07.000000000 +0200
+++ dbxml-2.5.16/db-4.8.26/dbinc/atomic.h 2013-06-03 21:10:53.000000000 +0200
@@ -144,7 +144,7 @@
#define atomic_inc(env, p) __atomic_inc(p)
#define atomic_dec(env, p) __atomic_dec(p)
#define atomic_compare_exchange(env, p, o, n) \
- __atomic_compare_exchange((p), (o), (n))
+ __atomic_compare_exchange_db((p), (o), (n))