Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-tools-update
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-tools-update
Commits
60273fc3
Commit
60273fc3
authored
Nov 24, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete file system tables
parent
46096a84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
write_bootable_usb.py
write_bootable_usb.py
+29
-6
No files found.
write_bootable_usb.py
View file @
60273fc3
...
@@ -61,7 +61,27 @@ def print_help():
...
@@ -61,7 +61,27 @@ def print_help():
print
(
" ~$ python make_sdcard.py /dev/sdz someimage.img"
)
print
(
" ~$ python make_sdcard.py /dev/sdz someimage.img"
)
print
(
" * To write *.iso use a standard os tool that burns bootable USB drives"
)
print
(
" * To write *.iso use a standard os tool that burns bootable USB drives"
)
print
(
""
)
print
(
""
)
def
check_program_installed
(
program
):
try
:
result
=
subprocess
.
check_output
(
"which "
+
program
,
shell
=
True
)
except
subprocess
.
CalledProcessError
:
print
(
"Program missing: "
+
program
)
return
False
return
True
required_programs
=
(
"parted"
,
"kpartx"
)
something_is_missing
=
False
for
i
in
required_programs
:
tmpres
=
check_program_installed
(
i
)
something_is_missing
=
something_is_missing
or
(
not
tmpres
)
if
something_is_missing
:
sys
.
exit
()
if
len
(
sys
.
argv
)
>
1
:
if
len
(
sys
.
argv
)
>
1
:
DEVICE
=
sys
.
argv
[
1
]
DEVICE
=
sys
.
argv
[
1
]
else
:
else
:
...
@@ -77,6 +97,7 @@ if len(sys.argv) > 2:
...
@@ -77,6 +97,7 @@ if len(sys.argv) > 2:
else
:
else
:
IMAGE_FILE
=
""
IMAGE_FILE
=
""
print
(
"NOTE: if plasma crash do not worry"
)
#params
#params
SDCARD_SIZE
=
4000
SDCARD_SIZE
=
4000
...
@@ -118,18 +139,20 @@ if not os.path.exists(DEVICE):
...
@@ -118,18 +139,20 @@ if not os.path.exists(DEVICE):
if
something_is_missing
:
if
something_is_missing
:
sys
.
exit
()
sys
.
exit
()
print
(
"= Erase partition table on "
+
DEVICE
)
print
(
"= Erase partition table on "
+
DEVICE
+
" and everything else"
)
shout
(
"dd if=/dev/zero of="
+
DEVICE
+
" bs=
512 count=2048"
)
shout
(
"dd if=/dev/zero of="
+
DEVICE
+
" bs=
1M count="
+
str
(
BOOT_SIZE
+
2
)
)
print
(
"= Create partition table"
)
print
(
"= Create partition table"
)
shout
(
"parted -s "
+
DEVICE
+
" mktable "
+
PT_TYPE
)
shout
(
"parted -s "
+
DEVICE
+
" mktable "
+
PT_TYPE
)
print
(
"= Create FAT
32
parttion"
)
print
(
"= Create FAT parttion"
)
shout
(
"parted -s "
+
DEVICE
+
" mkpart primary "
+
BOOT_FS
+
" 1 "
+
str
(
BOOT_SIZE
))
shout
(
"parted -s "
+
DEVICE
+
" mkpart primary "
+
BOOT_FS
+
" 1 "
+
str
(
BOOT_SIZE
))
shout
(
"parted -s "
+
DEVICE
+
" mkpart primary "
+
ROOT_FS
+
" "
+
str
(
BOOT_SIZE
+
1
)
+
" 100
%
"
)
shout
(
"parted -s "
+
DEVICE
+
" mkpart primary "
+
ROOT_FS
+
" "
+
str
(
BOOT_SIZE
+
1
)
+
" 100
%
"
)
# no need?
# no need?
shout
(
"parted -s "
+
DEVICE
+
" align-check optimal 1"
)
#shout("parted -s "+DEVICE+" align-check optimal 1")
shout
(
"parted -s "
+
DEVICE
+
" align-check optimal 2"
)
#shout("parted -s "+DEVICE+" align-check optimal 2")
#sys.exit()
devs_created
=
False
devs_created
=
False
while
not
devs_created
:
while
not
devs_created
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment