Skip to content

Commit 155481a

Browse files
committed
Initial commit
0 parents  commit 155481a

File tree

7 files changed

+243
-0
lines changed

7 files changed

+243
-0
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.zip
2+
tmp_files
3+
data

Diff for: custom.conf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Comments start with #
2+
# to delete a locale, place:
3+
# "l_enUS" for enUS and "l_ptBR" for brazilian portugese
4+
# programs are "pNAME" so pAddIt removes files starting with AddIt

Diff for: customize-rom.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
#
3+
4+
cut_line()
5+
{
6+
echo $1 | cut -c $2
7+
}
8+
9+
echo "" > locales
10+
echo "" > remove_files
11+
12+
cat custom.conf | while read LINE; do
13+
if [ ! -z "$LINE" -a "`echo $LINE | cut -c 0`" != "#" ]; then
14+
15+
# remove this locale
16+
if [ "$(cut_line $LINE 0)" == "l" ]; then
17+
LOCALE="$(cut_line $LINE "1-5")"
18+
case $LOCALE in
19+
* ) echo "$LOCALE" >> locales
20+
esac
21+
fi
22+
23+
#remove this program
24+
if [ "$(cut_line $LINE 0)" == "p" ]; then
25+
PROGRAM="$(cut_line $LINE "1-5")"
26+
case $PROGRAM in
27+
* ) echo "$PROGRAM" >> remove_files
28+
esac
29+
fi
30+
31+
done
32+
33+
if [ ! -d data ]; then
34+
unzip brahma-palmos -d data > /dev/null || exit
35+
fi
36+
37+
cd data
38+
mv ../locales ./
39+
mv ../remove_files ./
40+
41+
# Removes locales not wanted
42+
cat locales | while read -n 5 LOCALE; do
43+
echo $LOCALE
44+
echo rm *$LOCALE
45+
done

Diff for: make_rom.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
cd data
4+
zip ../data.zip *
5+
cd ..
6+
7+
python makecafe.py -c data.zip > rom-partition
8+
9+
echo "Now run:"
10+
echo "dd if=table.sct of=/dev/DEVICE conv=notrunc"
11+
echo "dd if=rom-partition of=/dev/DEVICE seek=134079 bs=512 conv=notrunc"

Diff for: makecafe.py

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Generate an acecafe header suitable for the LD ROM partition
2+
#
3+
import getopt, os, sys
4+
from struct import pack
5+
from sys import stdout, stderr
6+
7+
HEADER = 0xacecafe0
8+
DEF_OFFSET = 134080 # in sectors (1 sector = 512 bytes)
9+
DEF_LENGTH = 20479778 # in bytes
10+
BLOCKSIZE = 512 # for cancatenate option
11+
12+
def usage():
13+
stderr.write('Usage: %s [-c] [-o offset] [-l length] [romfile]\n' % sys.argv[0])
14+
stderr.write('Generate a LD rom partition header.\n\n')
15+
stderr.write(' -o [offset] image offset in sectors (defaults to %d)\n' % DEF_OFFSET)
16+
stderr.write(' -l [length] image length in bytes (defaults to size of given filename)\n')
17+
stderr.write(' -c concatenate header with rom image\n')
18+
19+
20+
def main():
21+
try:
22+
opts, args = getopt.getopt(sys.argv[1:], 'o:l:c')
23+
except getopt.GetoptError:
24+
usage()
25+
sys.exit(2)
26+
27+
offset = DEF_OFFSET
28+
length = DEF_LENGTH
29+
concat = 0
30+
31+
if args:
32+
filename = args[0]
33+
length = os.path.getsize(filename)
34+
35+
for o, a in opts:
36+
if o == '-o':
37+
offset = int(a)
38+
elif o == '-l':
39+
length = int(a)
40+
elif o == '-c':
41+
concat = 1
42+
43+
44+
# first sector
45+
# image offset stuff
46+
stdout.write( pack('<IIII', HEADER, 4, 0x10000, 0) )
47+
stdout.write( pack('<IIII', 0, offset, 0xb000, 0) )
48+
stdout.write('\0' * 0x1e0)
49+
50+
# second sector
51+
# image length
52+
stdout.write( pack('<IIII', length, 0, 0, 0) )
53+
stdout.write('\0' * 0x1f0)
54+
55+
if concat and filename:
56+
f = file(filename, 'rb')
57+
while 1:
58+
data = f.read(BLOCKSIZE)
59+
if data == '': break
60+
stdout.write(data)
61+
del data
62+
63+
if __name__ == '__main__': main()
64+

Diff for: reget_files.sh

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/sh
2+
# Copyright HacknDev (Fahrzin Hemmati [email protected])
3+
# This script automatically installs Palm OS to your microdrive
4+
#
5+
# Programs needed before install:
6+
# curl | wget
7+
# unzip
8+
# cabextract
9+
# unshield
10+
# python2.4
11+
# subversion
12+
# xargs
13+
# sdd | dd
14+
# md5sum
15+
16+
17+
# Now checking for all necessary programs
18+
# curl or wget. curl preferred
19+
if [ -n "$(which curl)" ]; then
20+
DL_PROG="$(which curl)"
21+
DL_OPTS="-C - -O"
22+
elif [ -n "$(which wget)" ]; then
23+
DL_PROG="$(which wget)"
24+
DL_OPTS="-c"
25+
else
26+
echo "Please install curl or wget."
27+
INSTALL_STUFF="yes"
28+
fi
29+
30+
check_exist() {
31+
if [ -z "$(which $1)" ]; then
32+
echo "Please install $1."
33+
INSTALL_STUFF="yes"
34+
fi
35+
}
36+
37+
check_exist unzip
38+
check_exist cabextract
39+
check_exist unshield
40+
#check_exist python2.4
41+
check_exist svn
42+
check_exist xargs
43+
check_exist md5sum
44+
check_exist dd
45+
if [ "$INSTALL_STUFF" == "yes" ]; then
46+
exit
47+
fi
48+
49+
50+
# Now that everything is here, use it.
51+
52+
if [ -z "$(pwd | grep \"/tmp_files\$\")" ]; then
53+
mkdir -p tmp_files && cd tmp_files
54+
fi
55+
56+
if [ -z "$(du LifeDrive_Update_2_0_EFIGS_win.zip 2> /dev/null| grep 21853)" ]; then
57+
$DL_PROG $DL_OPTS http://palmone.r3h.net/downloads.palmone.com/LifeDrive_Update_2_0_EFIGS_win.zip
58+
fi
59+
60+
if [ ! -e "LifeDrive 2.0 Updater.exe" ]; then
61+
unzip LifeDrive_Update_2_0_EFIGS_win.zip
62+
fi
63+
64+
if [ ! -d "Disk1" ]; then
65+
cabextract 'LifeDrive 2.0 Updater.exe'
66+
fi
67+
68+
#mkdir -p data && cd data
69+
70+
if [ ! -d "BrahmaUpdate" ]; then
71+
unshield x Disk1/data1.cab
72+
fi
73+
74+
cd Brahma* 2> /dev/null
75+
76+
if [ ! -e "unpdb.py" ]; then
77+
svn cat https://svn.sourceforge.net/svnroot/hackndev/linux4palm/tools/unpdb.py > unpdb.py
78+
fi
79+
80+
if [ ! -e "brahma-palmos.zip" ]; then
81+
ls brahma-palmos.zip.?.pdb | sort | xargs -ti python unpdb.py {} - | dd skip=1 bs=32 > brahma-palmos.zip
82+
fi
83+
84+
if [ -z "$(du -b brahma-palmos.zip | grep 20479778)" \
85+
-o \
86+
-z "$(md5sum brahma-palmos.zip | grep 242847c981475636f7b74c7ba9a40379)" \
87+
\
88+
]; then
89+
echo "Something went wrong."
90+
echo "This is likely linked to python or the subversion repository."
91+
echo "PM fahhem about this."
92+
exit
93+
fi
94+
95+
if [ ! -e "makecafe.py" ]; then
96+
svn cat https://svn.sourceforge.net/svnroot/hackndev/linux4palm/tools/makecafe.py > makecafe.py
97+
fi
98+
99+
if [ ! -e "rom-partition" ]; then
100+
python makecafe.py -c brahma-palmos.zip > ../rom-partition
101+
fi
102+
103+
if [ -z "$(md5sum ../rom-partition | grep 639952c7a50e8d12d1d9351f3cbe9aa6)" ]; then
104+
echo "Something else went wrong."
105+
echo "I have no idea what. Might be python, could be a bad makecafe.py."
106+
echo "PM fahhem about this."
107+
exit
108+
fi
109+
110+
if [ ! -e "table.sct" ]; then
111+
echo 'AAAAAAAAAAAAAAAAAAAAAQEABlgPCD8AAACACwIAAFgQCAAoHAu/CwIAgLAAAAAoHQsLz13xP7wCAIBLdwAAAAAAAAAAAAAAAAAAAAAAVao=' | python -c 'import base64,sys;sys.stdout.write("\0"*432+base64.b64decode(sys.stdin.read()))' > ../table.sct
112+
fi
113+
114+
mv brahma-palmos.zip ../
115+
116+
echo "All the files are set up now."

Diff for: table.sct

512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)