Content :
The following code should work to test WebAssembly in various JS runtimes with minor modifications:
const bytes = /* read a .wasm file somehow */;
const mod = new WebAssembly.Module(bytes);
const instance = new WebAssembly.Instance(mod, { /* imports */ });
const { foo, bar } = instance.exports;
These instructions are based on this blogpost by Anton Semjonov and this video by Animortis Productions. Please follow the link if you want more details, they go into much more detail about each step, whereas this document is more focused on being a concise cheat sheet. Let's go.
Boot the Ubuntu installation medium. When asked, choose the "Try Ubuntu" option and open a terminal.
Switch to root, otherwise you'll have to type sudo
all the time:
sudo su -
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### just for arm64 | |
```` | |
BASE=`pwd` | |
## cross-compile toolchain | |
git clone https://github.com/0neday/buildroot | |
cd buildroot | |
make menuconfig | |
### select aarch64 and enable ssp , c++ support | |
make -j$(nproc) toolchain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWARD BIOS: | |
01322222 | |
589589 | |
589721 | |
595595 | |
598598 | |
aLLy | |
aLLY | |
ALLY | |
ALFAROME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export CFLAGS="-Os -ffunction-sections -fdata-sections -fno-unwind-tables -fno-asynchronous-unwind-tables -flto" | |
export LDFLAGS="-Wl,-s -Wl,-Bsymbolic -Wl,--gc-sections" | |
./configure \ | |
--disable-cookies \ | |
--disable-crypto-auth \ | |
--disable-dict \ | |
--disable-file \ | |
--disable-ftp \ | |
--disable-gopher \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!-- Copyright (C) 2010-2017 Free Software Foundation, Inc. | |
Copying and distribution of this file, with or without modification, | |
are permitted in any medium without royalty provided the copyright | |
notice and this notice are preserved. --> | |
<!DOCTYPE target SYSTEM "gdb-target.dtd"> | |
<target> | |
<architecture>i8086</architecture> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# References: | |
# https://cmake.org/cmake/help/latest/command/add_custom_target.html | |
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/ | |
# https://gist.github.com/socantre/7ee63133a0a3a08f3990 | |
# https://stackoverflow.com/questions/24163778/how-to-add-custom-target-that-depends-on-make-install | |
# https://stackoverflow.com/questions/30719275/add-custom-command-is-not-generating-a-target | |
# https://stackoverflow.com/questions/26024235/how-to-call-a-cmake-function-from-add-custom-target-command | |
# https://blog.csdn.net/gubenpeiyuan/article/details/51096777 | |
cmake_minimum_required(VERSION 3.10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************* | |
jpegtest.c | |
$ gcc jpegtest.c -std=c11 -ljpeg | |
*********************************/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <jpeglib.h> |
NewerOlder