build-system: import build system from HelloSTK2
The current build system (Makefile) uses a very old java SDK that is no longer available on modern platforms. There is a community supported project HelloSTK2 (maintained by Merlin Chlosta, see also [1]) that uses not only a comfortable ANT based approach. It also uses more modern Java SDKs which are automatically downloaded using .gitmodules. All this makes it very comfortable to use and also lowers the barrier for beginners. Let's take this approach as an example and use it in our hello-stk.git as well. [1] https://github.com/mrlnc/HelloSTK2.git Related: OS#6069 Change-Id: Ic1828b7ccaf3bf953c0f4889fa1c3f21b80a1b73
This commit is contained in:
parent
d3d776e26c
commit
f08edf94f9
|
@ -1 +1,5 @@
|
|||
.vscode
|
||||
|
||||
ant-javacard.jar
|
||||
gp.jar
|
||||
build/
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "oracle_javacard_sdks"]
|
||||
path = oracle_javacard_sdks
|
||||
url = https://github.com/martinpaljak/oracle_javacard_sdks.git
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="HelloSTK" default="dist" basedir=".">
|
||||
<description>Builds the project.</description>
|
||||
<target name="dist" description="generate the distribution">
|
||||
<tstamp/>
|
||||
<get src="https://github.com/martinpaljak/ant-javacard/releases/latest/download/ant-javacard.jar" dest="." skipexisting="true"/>
|
||||
<!-- Create the distribution directory -->
|
||||
<taskdef name="javacard" classname="pro.javacard.ant.JavaCard" classpath="ant-javacard.jar"/>
|
||||
<javacard>
|
||||
<cap targetsdk="oracle_javacard_sdks/jc221_kit" jckit="oracle_javacard_sdks/jc305u3_kit" output="build/HelloSTK.cap" sources="hello-stk" classes="build/classes" version="1.0">
|
||||
<applet class="org.toorcamp.HelloSTK.HelloSTK" aid="d0:70:02:CA:44:90:01:01"/>
|
||||
<import exps="exp" jar="lib/sim.jar"/>
|
||||
</cap>
|
||||
<cap targetsdk="oracle_javacard_sdks/jc221_kit" jckit="oracle_javacard_sdks/jc305u3_kit" output="build/ImsiChange.cap" sources="imsi-change" excludes="src/**/Test*.java" classes="build/classes" version="1.0">
|
||||
<applet class="org.osmocom.IMSIChange.IMSIChange" aid="d0:70:02:CA:44:90:01:02"/>
|
||||
<import exps="exp" jar="lib/sim.jar"/>
|
||||
</cap>
|
||||
</javacard>
|
||||
</target>
|
||||
<target name="clean" description="clean up">
|
||||
<!-- Delete the built applet -->
|
||||
<delete dir="HelloSTK.cap"/>
|
||||
</target>
|
||||
</project>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +0,0 @@
|
|||
SIMTOOLS_DIR = ../../sim-tools
|
||||
|
||||
APPLET_AID = 0xd0:0x70:0x02:0xca:0x44:0x90:0x01:0x01
|
||||
APPLET_NAME = org.toorcamp.HelloSTK.HelloSTK
|
||||
PACKAGE_AID = 0xd0:0x70:0x02:0xCA:0x44:0x90:0x01
|
||||
PACKAGE_NAME = org.toorcamp.HelloSTK
|
||||
PACKAGE_VERSION = 1.0
|
||||
|
||||
SOURCES = \
|
||||
src/org/toorcamp/HelloSTK/HelloSTK.java
|
||||
|
||||
include $(SIMTOOLS_DIR)/javacard/makefiles/applet-project.mk
|
|
@ -1,71 +0,0 @@
|
|||
SIMTOOLS_DIR = ../../sim-tools
|
||||
|
||||
APPLET_AID = 0xd0:0x70:0x02:0xca:0x44:0x90:0x01:0x01
|
||||
APPLET_NAME = org.osmocom.IMSIChange.IMSIChange
|
||||
PACKAGE_AID = 0xd0:0x70:0x02:0xCA:0x44:0x90:0x01
|
||||
PACKAGE_NAME = org.osmocom.IMSIChange
|
||||
PACKAGE_VERSION = 1.0
|
||||
|
||||
SOURCES = \
|
||||
src/org/osmocom/IMSIChange/Bytes.java \
|
||||
src/org/osmocom/IMSIChange/MobileIdentity.java \
|
||||
src/org/osmocom/IMSIChange/IMSIChange.java \
|
||||
$(NULL)
|
||||
|
||||
CAP_FILE = build/javacard/org/osmocom/IMSIChange/javacard/IMSIChange.cap
|
||||
|
||||
include ./applet-project.mk
|
||||
|
||||
.PHONY: flash
|
||||
flash: classes
|
||||
$(eval MODULE_AID := $(shell echo $(APPLET_AID) | sed 's/0x//g' | sed 's/\://g'))
|
||||
$(eval INSTANCE_AID := $(shell echo $(APPLET_AID) | sed 's/0x//g' | sed 's/\://g'))
|
||||
. $$PWD/.sim-keys && $(SIMTOOLS_DIR)/bin/shadysim \
|
||||
--pcsc \
|
||||
-l $(CAP_FILE) \
|
||||
-i $(CAP_FILE) \
|
||||
--enable-sim-toolkit \
|
||||
--access-domain=00 \
|
||||
--module-aid $(MODULE_AID) \
|
||||
--instance-aid $(INSTANCE_AID) \
|
||||
--nonvolatile-memory-required 0100 \
|
||||
--volatile-memory-for-install 0100 \
|
||||
--max-menu-entry-text 21 \
|
||||
--max-menu-entries 01 \
|
||||
--kic "$$KIC1" \
|
||||
--kid "$$KID1"
|
||||
|
||||
.PHONY: remove
|
||||
remove:
|
||||
. $$PWD/.sim-keys && $(SIMTOOLS_DIR)/bin/shadysim \
|
||||
--pcsc \
|
||||
-d "$$(echo $(PACKAGE_AID) | sed 's/0x//g' | sed 's/\://g')" \
|
||||
--kic "$$KIC1" \
|
||||
--kid "$$KID1"
|
||||
|
||||
.PHONY: list
|
||||
list:
|
||||
. $$PWD/.sim-keys && $(SIMTOOLS_DIR)/bin/shadysim \
|
||||
--pcsc \
|
||||
--list-applets \
|
||||
--kic "$$KIC1" \
|
||||
--kid "$$KID1"
|
||||
|
||||
.PHONY: delete
|
||||
delete: remove
|
||||
|
||||
.PHONY: reflash
|
||||
reflash:
|
||||
$(MAKE) remove
|
||||
$(MAKE) flash
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
mkdir -p ./test/classes
|
||||
javac -target 1.1 -source 1.3 -classpath test/classes -g -d ./test/classes src/org/osmocom/IMSIChange/Bytes.java
|
||||
javac -target 1.1 -source 1.3 -classpath test/classes -g -d ./test/classes src/org/osmocom/IMSIChange/MobileIdentity.java
|
||||
javac -target 1.1 -source 1.3 -classpath test/classes -g -d ./test/classes src/org/osmocom/IMSIChange/Test.java
|
||||
java -classpath test/classes org.osmocom.IMSIChange.Test
|
||||
|
||||
.PHONY: check
|
||||
check: test
|
|
@ -1,51 +0,0 @@
|
|||
BUILD_DIR = ./build
|
||||
BUILD_CLASSES_DIR = $(BUILD_DIR)/classes
|
||||
BUILD_JAVACARD_DIR = $(BUILD_DIR)/javacard
|
||||
JAVACARD_SDK_DIR ?= $(SIMTOOLS_DIR)/javacard
|
||||
JAVACARD_EXPORT_DIR ?= $(JAVACARD_SDK_DIR)/api21_export_files
|
||||
ifdef COMSPEC
|
||||
CLASSPATH = $(JAVACARD_SDK_DIR)/lib/api21.jar;$(JAVACARD_SDK_DIR)/lib/sim.jar
|
||||
else
|
||||
CLASSPATH = $(JAVACARD_SDK_DIR)/lib/api21.jar:$(JAVACARD_SDK_DIR)/lib/sim.jar
|
||||
endif
|
||||
JFLAGS = -target 1.1 -source 1.3 -g -d $(BUILD_CLASSES_DIR) -classpath "$(BUILD_CLASSES_DIR):$(CLASSPATH)"
|
||||
JAVA ?= java
|
||||
JC ?= javac
|
||||
|
||||
.SUFFIXES: .java .class
|
||||
.java.class:
|
||||
@mkdir -p $(BUILD_CLASSES_DIR)
|
||||
@mkdir -p $(BUILD_JAVACARD_DIR)
|
||||
$(JC) $(JFLAGS) $*.java
|
||||
|
||||
.PHONY: jar
|
||||
jar: classes
|
||||
$(JAVA) -jar $(JAVACARD_SDK_DIR)/bin/converter.jar \
|
||||
-d $(BUILD_JAVACARD_DIR) \
|
||||
-classdir $(BUILD_CLASSES_DIR) \
|
||||
-exportpath $(JAVACARD_EXPORT_DIR) \
|
||||
-applet $(APPLET_AID) $(APPLET_NAME) \
|
||||
$(PACKAGE_NAME) $(PACKAGE_AID) $(PACKAGE_VERSION)
|
||||
|
||||
default: jar
|
||||
|
||||
classes: $(SOURCES:.java=.class)
|
||||
|
||||
clean:
|
||||
$(RM) -rf $(BUILD_DIR)
|
||||
|
||||
install:
|
||||
$(eval CAP_FILE := $(shell find $(BUILD_JAVACARD_DIR) -name *.cap))
|
||||
$(eval MODULE_AID := $(shell echo $(APPLET_AID) | sed 's/0x//g' | sed 's/\://g'))
|
||||
$(eval INSTANCE_AID := $(shell echo $(APPLET_AID) | sed 's/0x//g' | sed 's/\://g'))
|
||||
$(SIMTOOLS_DIR)/bin/shadysim \
|
||||
$(SHADYSIM_OPTIONS) \
|
||||
-l $(CAP_FILE) \
|
||||
-i $(CAP_FILE) \
|
||||
--enable-sim-toolkit \
|
||||
--module-aid $(MODULE_AID) \
|
||||
--instance-aid $(INSTANCE_AID) \
|
||||
--nonvolatile-memory-required 0100 \
|
||||
--volatile-memory-for-install 0100 \
|
||||
--max-menu-entry-text 10 \
|
||||
--max-menu-entries 01
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright 2020 sysmocom s.f.m.c. GmbH
|
||||
* SPDX-License-Identifier: Apache-2.0 */
|
||||
package org.osmocom.IMSIChange;
|
||||
import org.osmocom.IMSIChange.*;
|
||||
package org.osmocom.IMSIPseudo;
|
||||
import org.osmocom.IMSIPseudo.*;
|
||||
|
||||
public class Test {
|
||||
private static byte nibble2hex(byte nibble)
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
Subproject commit e305a1a0b9bf6b9a8b0c91a9aad8d73537e7ff1b
|
Loading…
Reference in New Issue