aboutsummaryrefslogtreecommitdiffstats
path: root/rpi2-debian-stdkernel/copy-to-sdcard.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpi2-debian-stdkernel/copy-to-sdcard.py')
-rwxr-xr-xrpi2-debian-stdkernel/copy-to-sdcard.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/rpi2-debian-stdkernel/copy-to-sdcard.py b/rpi2-debian-stdkernel/copy-to-sdcard.py
index 2717838..921982d 100755
--- a/rpi2-debian-stdkernel/copy-to-sdcard.py
+++ b/rpi2-debian-stdkernel/copy-to-sdcard.py
@@ -8,6 +8,11 @@ import sys
import tempfile
import time
+
+def join(item0, *items):
+ return os.path.join(item0, *[p.lstrip('/') for p in items])
+
+
def reexec_root():
# run as root
if os.geteuid() != 0:
@@ -34,16 +39,29 @@ def get_fresh_firmware(firmware_dir):
firmware_dir], check=True)
-def copy_to_partitions(firmware_dir, boot_mountpoint, root_mountpoint):
+def copy_to_boot(firmware_dir, boot_mountpoint):
for path in glob.glob(firmware_dir + '/boot/*'):
if os.path.isfile(path):
shutil.copy(path, boot_mountpoint)
- for path in glob.glob('other_boot_files/*'):
- shutil.copy(path, boot_mountpoint)
+ elif os.path.isdir(path):
+ shutil.copytree(path, boot_mountpoint + '/'
+ + os.path.basename(path.rstrip('/')))
+ shutil.copy('files/cmdline.txt', boot_mountpoint)
+ shutil.copy('files/config.txt', boot_mountpoint)
+ shutil.copy('debootstrap/vmlinuz', join(boot_mountpoint, 'vmlinuz'),
+ follow_symlinks=True)
+ shutil.copy('debootstrap/initrd.img', join(boot_mountpoint, 'initrd.img'),
+ follow_symlinks=True)
+ content = run(['ls', '-lah',
+ 'debootstrap/vmlinuz', 'debootstrap/initrd.img'])
+ with open(join(boot_mountpoint, 'versions.txt'), 'wb') as f:
+ f.write(content)
+
+
+def copy_to_partitions(firmware_dir, boot_mountpoint, root_mountpoint):
+ copy_to_boot(firmware_dir, boot_mountpoint)
run(['rsync', '-aHX', 'debootstrapdir/.', root_mountpoint + '/.'],
check=True)
- #shutil.copyfile('debootstrapdir/vmlinuz', boot_mountpoint + '/zImage',
- # follow_symlinks=True)
def main():