Skip to content

Commit 7cf2709

Browse files
authored
Merge pull request #1 from FrameworkComputer/native-compilation
Native compilation
2 parents 62f4f34 + 02e14b8 commit 7cf2709

3 files changed

Lines changed: 37 additions & 13 deletions

File tree

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
gpu_cfg_generator.o : gpu_cfg_generator.c gpu_cfg_generator.h
1+
.PHONY: native clean
2+
3+
gpu_cfg_generator.exe: gpu_cfg_generator
4+
cp gpu_cfg_gen gpu_cfg_gen.exe
5+
6+
gpu_cfg_generator: gpu_cfg_generator.c gpu_cfg_generator.h
27
../cosmopolitan/bin/cosmocc -o gpu_cfg_gen gpu_cfg_generator.c
8+
9+
native: gpu_cfg_generator.c gpu_cfg_generator.h
10+
$(CC) -o gpu_cfg_gen gpu_cfg_generator.c -Wall
311

412

513
clean :

gpu_cfg_generator.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#include <stdio.h>
22
#include <stdarg.h>
33
#include <stddef.h>
4+
#include <stdint.h>
5+
#include <stdlib.h>
46
#include <unistd.h>
7+
#include <string.h>
58
#include <ctype.h>
69

710
#include "crc.h"
@@ -214,8 +217,6 @@ static struct default_ssd_cfg ssd_cfg = {
214217
void program_eeprom(const char * serial, struct gpu_cfg_descriptor * descriptor, size_t len, const char * outpath)
215218
{
216219
crc_t crc;
217-
size_t addr = 0;
218-
int d, i;
219220
FILE *fptr;
220221
printf("generating EEPROM\n");
221222
memset(descriptor->serial, 0x00, GPU_SERIAL_LEN);
@@ -243,7 +244,6 @@ int main(int argc, char *argv[]) {
243244
char *serialvalue = NULL;
244245
char *pcbvalue = NULL;
245246
char *outfilename = "eeprom.bin";
246-
int index;
247247
int c;
248248

249249
opterr = 0;

readme.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
# build notes
22

3-
uses
4-
https://github.com/jart/cosmopolitan
3+
Uses [cosmpopolitan](https://github.com/jart/cosmopolitan).
54

6-
extract cosmopolitan one folder up
5+
Extract cosmopolitan release zip one folder up.
76

7+
```sh
88
run make
9+
```
910

11+
To use it on windows, rename `gpu_cfg_gen` to `gpu_cfg_gen.exe`.
1012

11-
to use on windows rename
1213

13-
gpu_cfg_gen to gpu_cfg_gen.exe
1414

15+
# Running
16+
When the application is run, pass in the serial, and for the GPU, the PCB serial.
17+
The application will generate a `.bin` file in the same directory with the EEPROM contents.
1518

16-
17-
# Running
18-
when the application is run, pass in the serial, and for the GPU, the PCB serial.
19-
The application will generate a .bin file in the same directory with the EEPROM contents
2019
## Generate GPU Serial
2120

21+
```
2222
./gpu_cfg_gen -g -s FRAKMBCP81331ASSY0 -p FRAGMASP81331PCB00
23+
```
2324

2425

2526
## Generate SSD
2627

28+
```
2729
./gpu_cfg_gen -d -s FRAKMBCP81331ASSY0
30+
```
31+
32+
# Build natively
33+
34+
While the regular build builds a single executable that runs on Linux and
35+
Windows, for development purpose you might want to build using native tooling.
36+
37+
```sh
38+
# With GCC
39+
make native CC=gcc
40+
41+
# With clang
42+
make native CC=clang
43+
```

0 commit comments

Comments
 (0)