aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrpi2-debian-stdkernel/copy-to-sdcard.py28
-rw-r--r--rpi2-debian-stdkernel/files/autologin.conf3
-rw-r--r--rpi2-debian-stdkernel/files/cmdline.txt1
-rw-r--r--rpi2-debian-stdkernel/files/config.txt39
-rw-r--r--rpi2-debian-stdkernel/files/fstab3
-rw-r--r--rpi2-debian-stdkernel/files/hostname1
-rw-r--r--rpi2-debian-stdkernel/files/hosts6
-rw-r--r--rpi2-debian-stdkernel/files/interfaces5
-rw-r--r--rpi2-debian-stdkernel/files/keyboard4
-rw-r--r--rpi2-debian-stdkernel/files/locale4
-rw-r--r--rpi2-debian-stdkernel/files/main.sources12
-rw-r--r--rpi2-debian-stdkernel/files/ubuntu.pref (renamed from rpi2-debian-stdkernel/other_boot_files/ubuntu.pref)0
-rw-r--r--rpi2-debian-stdkernel/files/ubuntu.sources (renamed from rpi2-debian-stdkernel/other_boot_files/ubuntu.sources)0
-rwxr-xr-xrpi2-debian-stdkernel/files/vg-copy-rpi (renamed from rpi2-debian-stdkernel/other_boot_files/vg-copy-rpi)0
-rw-r--r--rpi2-debian-stdkernel/files/vimrc23
-rw-r--r--rpi2-debian-stdkernel/files/zoneinfo1
-rwxr-xr-xrpi2-debian-stdkernel/make-rpi-debootstrap.py145
-rw-r--r--rpi2-debian-stdkernel/other_boot_files/boot.scr25
-rw-r--r--rpi2-debian-stdkernel/other_boot_files/config.txt6
-rwxr-xr-xrpi2-debian-stdkernel/other_boot_files/update-boot-uimage.sh3
20 files changed, 158 insertions, 151 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():
diff --git a/rpi2-debian-stdkernel/files/autologin.conf b/rpi2-debian-stdkernel/files/autologin.conf
new file mode 100644
index 0000000..4aa64d2
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/autologin.conf
@@ -0,0 +1,3 @@
+[Service]
+ExecStart=
+ExecStart=-/sbin/agetty --autologin root --login-pause --noclear %I 115200,38400,9600 vt102
diff --git a/rpi2-debian-stdkernel/files/cmdline.txt b/rpi2-debian-stdkernel/files/cmdline.txt
new file mode 100644
index 0000000..0142fe1
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/cmdline.txt
@@ -0,0 +1 @@
+console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootdelay=10
diff --git a/rpi2-debian-stdkernel/files/config.txt b/rpi2-debian-stdkernel/files/config.txt
new file mode 100644
index 0000000..ce7ca8e
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/config.txt
@@ -0,0 +1,39 @@
+# raspberry pi 2 configuration file
+
+################################################################################
+# HDMI AND COMPOSITE
+################################################################################
+
+# display without heretic overscan
+disable_overscan=1
+
+################################################################################
+# UART
+################################################################################
+
+#enable_uart=1
+
+################################################################################
+# KERNEL
+################################################################################
+
+kernel=vmlinuz
+#kernel=vmlinuz-4.4.0-1029-raspi2
+#kernel=vmlinuz-4.7.0-1-armmp-lpae
+#kernel=vmlinuz-4.4.0-1-rpi2
+#kernel=u-boot.bin
+#kernel=yui-kernel.img
+
+initramfs initrd.img followkernel
+#initramfs initrd.img-4.4.0-1029-raspi2
+#initramfs initrd.img-4.7.0-1-armmp-lpae followkernel
+#initramfs initrd.img-4.4.0-1-rpi2 followkernel
+
+#device_tree_address=0x100
+#device_tree_end=0x8000
+#dtparam=i2c_arm=on
+#dtparam=spi=on
+#device_tree=bcm2709-rpi-2-b.dtb
+
+#cmdline="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait"
+#cmdline="console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/root elevator=deadline rootdelay=30 panic=30 "
diff --git a/rpi2-debian-stdkernel/files/fstab b/rpi2-debian-stdkernel/files/fstab
new file mode 100644
index 0000000..aaa77f3
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/fstab
@@ -0,0 +1,3 @@
+# <device> <mount point> <type> <options> <dump> <pass>
+/dev/mmcblk0p2 / ext4 errors=remount-ro,relatime 0 1
+/dev/mmcblk0p1 /boot/firmware vfat errors=remount-ro,relatime 0 2
diff --git a/rpi2-debian-stdkernel/files/hostname b/rpi2-debian-stdkernel/files/hostname
new file mode 100644
index 0000000..2dee175
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/hostname
@@ -0,0 +1 @@
+debian
diff --git a/rpi2-debian-stdkernel/files/hosts b/rpi2-debian-stdkernel/files/hosts
new file mode 100644
index 0000000..6984fc0
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/hosts
@@ -0,0 +1,6 @@
+127.0.0.1 localhost localhost.localdomain debian
+
+# the following lines are desirable for IPv6 capable hosts
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
diff --git a/rpi2-debian-stdkernel/files/interfaces b/rpi2-debian-stdkernel/files/interfaces
new file mode 100644
index 0000000..8dc54bc
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/interfaces
@@ -0,0 +1,5 @@
+auto lo
+iface lo inet loopback
+
+allow-hotplug e0
+iface e0 inet dhcp
diff --git a/rpi2-debian-stdkernel/files/keyboard b/rpi2-debian-stdkernel/files/keyboard
new file mode 100644
index 0000000..61d51dc
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/keyboard
@@ -0,0 +1,4 @@
+XKBMODEL="pc105"
+XKBLAYOUT="fr"
+XKBVARIANT="bepo"
+XKBOPTIONS=""
diff --git a/rpi2-debian-stdkernel/files/locale b/rpi2-debian-stdkernel/files/locale
new file mode 100644
index 0000000..6fe12f3
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/locale
@@ -0,0 +1,4 @@
+LANG="en_US.UTF-8"
+LC_TIME="en_DK.UTF-8"
+LC_PAPER="en_GB.UTF-8"
+LC_MEASUREMENT="en_GB.UTF-8"
diff --git a/rpi2-debian-stdkernel/files/main.sources b/rpi2-debian-stdkernel/files/main.sources
new file mode 100644
index 0000000..a8024c3
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/main.sources
@@ -0,0 +1,12 @@
+# main distrib repositories in new deb822 style
+
+#Types can have deb-src if needed
+Types: deb
+URIs: http://httpredir.debian.org/debian/ http://security.debian.org/
+Suites: testing testing/updates
+Components: main contrib
+
+#Types: deb
+#URIs: http://security.debian.org/
+#Suites: testing
+#Components: main contrib non-free
diff --git a/rpi2-debian-stdkernel/other_boot_files/ubuntu.pref b/rpi2-debian-stdkernel/files/ubuntu.pref
index 844bf1c..844bf1c 100644
--- a/rpi2-debian-stdkernel/other_boot_files/ubuntu.pref
+++ b/rpi2-debian-stdkernel/files/ubuntu.pref
diff --git a/rpi2-debian-stdkernel/other_boot_files/ubuntu.sources b/rpi2-debian-stdkernel/files/ubuntu.sources
index a8a167d..a8a167d 100644
--- a/rpi2-debian-stdkernel/other_boot_files/ubuntu.sources
+++ b/rpi2-debian-stdkernel/files/ubuntu.sources
diff --git a/rpi2-debian-stdkernel/other_boot_files/vg-copy-rpi b/rpi2-debian-stdkernel/files/vg-copy-rpi
index a8eb53e..a8eb53e 100755
--- a/rpi2-debian-stdkernel/other_boot_files/vg-copy-rpi
+++ b/rpi2-debian-stdkernel/files/vg-copy-rpi
diff --git a/rpi2-debian-stdkernel/files/vimrc b/rpi2-debian-stdkernel/files/vimrc
new file mode 100644
index 0000000..822382a
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/vimrc
@@ -0,0 +1,23 @@
+set nocompatible
+filetype plugin indent on
+set autoindent
+set background=dark
+set backspace=2
+set hidden
+set hlsearch
+set ignorecase
+set incsearch
+set laststatus=2
+set modelines=0
+set nobackup
+set nowritebackup
+set ruler
+set scrolloff=3
+set shiftwidth=4
+set showcmd
+set showmatch
+set statusline=%<%f%h%m%r%=%l,%c\ %P
+set ts=4
+set whichwrap=<,>,[,]
+set wildmode=list:full
+syntax on
diff --git a/rpi2-debian-stdkernel/files/zoneinfo b/rpi2-debian-stdkernel/files/zoneinfo
new file mode 100644
index 0000000..7cd9492
--- /dev/null
+++ b/rpi2-debian-stdkernel/files/zoneinfo
@@ -0,0 +1 @@
+Europe/Paris
diff --git a/rpi2-debian-stdkernel/make-rpi-debootstrap.py b/rpi2-debian-stdkernel/make-rpi-debootstrap.py
index 7925118..ed213d4 100755
--- a/rpi2-debian-stdkernel/make-rpi-debootstrap.py
+++ b/rpi2-debian-stdkernel/make-rpi-debootstrap.py
@@ -9,8 +9,6 @@ import shutil
import re
import functools
-# http://elinux.org/RPi_U-Boot
-
parameters = dict(
release='testing',
#mirror='http://fr.archive.ubuntu.com/ubuntu/',
@@ -75,6 +73,10 @@ numerical_sort = lambda y: [int(x) if x.isdigit() else x
for x in re.split('(\d+)', y)]
+def join(item0, *items):
+ return os.path.join(item0, *[p.lstrip('/') for p in items])
+
+
def mlstrip(s):
return re.sub(r'^\s*', '', s, flags=re.MULTILINE)
@@ -92,78 +94,28 @@ def reexec_root():
def system_customization(rootdir):
os.unlink(rootdir + '/etc/localtime')
- open8(rootdir + '/etc/zoneinfo', 'w').write('Europe/Paris\n')
+ shutil.copy('files/zoneinfo', join(rootdir, 'etc/zoneinfo'))
shutil.copy(rootdir + '/usr/share/zoneinfo/Europe/Paris',
rootdir + '/etc/localtime')
-
- open8(rootdir + '/etc/network/interfaces', 'w').write(mlstrip(
- '''\
- auto lo
- iface lo inet loopback
-
- auto eth0
- iface eth0 inet dhcp
- '''))
- open8(rootdir + '/etc/hosts', 'w').write(mlstrip(
- '''\
- 127.0.0.1 localhost localhost.localdomain debian
-
- # the following lines are desirable for IPv6 capable hosts
- ::1 localhost ip6-localhost ip6-loopback
- ff02::1 ip6-allnodes
- ff02::2 ip6-allrouters
- '''))
- open8(rootdir + '/etc/hostname', 'w').write('debian\n')
+ shutil.copy('files/interfaces', join(rootdir, 'etc/network/interfaces'))
+ shutil.copy('files/hosts', join(rootdir, 'etc/hosts'))
+ shutil.copy('files/hostname', join(rootdir, 'etc/hostname'))
os.makedirs(rootdir + '/boot/firmware', mode=0o755)
- open8(rootdir + '/etc/fstab', 'w').write(mlstrip(
- '''\
- # <device> <mount point> <type> <options> <dump> <pass>
- /dev/mmcblk0p2 / ext4 errors=remount-ro,relatime 0 1
- /dev/mmcblk0p1 /boot/firmware vfat errors=remount-ro,relatime 0 2
- '''))
-
- # activate serial console
- run([
- 'ln',
- '-s',
- '/lib/systemd/system/serial-getty@.service',
- rootdir + '/etc/systemd/system/getty.target.wants/serial-getty@ttyAMA0.service',
- ], check=True)
+ shutil.copy('files/fstab', join(rootdir, 'etc/fstab'))
+ os.symlink('/lib/systemd/system/serial-getty@.service',
+ join(rootdir, '/etc/systemd/system/getty.target.wants/serial-getty@ttyAMA0.service'))
os.makedirs(rootdir + '/etc/systemd/system/serial-getty@ttyAMA0.service.d',
mode=0o755)
- open8(rootdir +
- '/etc/systemd/system/serial-getty@ttyAMA0.service.d/autologin.conf',
- 'w').write(mlstrip(
- '''\
- [Service]
- ExecStart=
- ExecStart=-/sbin/agetty --autologin root --login-pause --noclear %I 115200,38400,9600 vt102
- '''))
-
- open8(rootdir + '/etc/default/keyboard', 'w').write(mlstrip(
- '''\
- XKBMODEL="pc105"
- XKBLAYOUT="fr"
- XKBVARIANT="bepo"
- XKBOPTIONS=""
- '''))
-
- open8(rootdir + '/etc/default/locale', 'w').write(mlstrip(
- '''\
- LANG="en_US.UTF-8"
- LC_TIME="en_DK.UTF-8"
- LC_PAPER="en_GB.UTF-8"
- LC_MEASUREMENT="en_GB.UTF-8"
- '''))
-
- for locale in ['fr_FR', 'en_US', 'en_GB', 'en_DK', 'de_DE']:
- run([
- 'localedef',
- '--prefix={}'.format(rootdir),
- '-f', 'UTF-8',
- '-i', locale,
- '{}.UTF-8'.format(locale)
- ], check=True)
+ shutil.copy('files/autologin.conf', join(rootdir, '/etc/systemd/system/serial-getty@ttyAMA0.service.d/autologin.conf'))
+ shutil.copy('files/keyboard', join(rootdir, 'etc/default/keyboard'))
+ shutil.copy('files/locale', join(rootdir, 'etc/default/locale'))
+ shutil.copy('files/vimrc', join(rootdir, 'etc/vim/vimrc'))
+ shutil.copy('files/ubuntu.pref', join(rootdir, 'etc/apt/preferences.d'))
+ shutil.copy('files/ubuntu.sources', join(rootdir, 'etc/apt/sources.list.d'))
+ shutil.copy('files/main.sources', join(rootdir, 'etc/apt/sources.list.d'))
+ os.unlink(join(rootdir, 'etc/apt/sources.list'))
+ shutil.copy('files/vg-copy-rpi', join(rootdir, 'etc/kernel/postinst.d'))
+ os.symlink('../postinst.d/vg-copy-rpi', join(rootdir, 'etc/kernel/postrm.d'))
open8(rootdir + '/etc/bash.bashrc', 'a').write(mlstrip(
'''\
@@ -189,50 +141,19 @@ def system_customization(rootdir):
export VISUAL=vim
'''))
- open8(rootdir + '/etc/vim/vimrc', 'w').write(mlstrip(
- '''\
- set nocompatible
-
- au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
- filetype plugin indent on
- set autoindent
- set background=dark
- set backspace=2
- set hidden
- set hlsearch
- set ignorecase
- set incsearch
- set laststatus=2
- set modelines=0
- set nobackup
- set nowritebackup
- set ruler
- set scrolloff=3
- set shiftwidth=4
- set showcmd
- set showmatch
- set statusline=%<%f%h%m%r%=%l,%c\ %P
- set ts=4
- set whichwrap=<,>,[,]
- set wildmode=list:full
- syntax on
- '''))
-
+ for locale in ['fr_FR', 'en_US', 'en_GB', 'en_DK', 'de_DE']:
+ run([
+ 'localedef',
+ '--prefix={}'.format(rootdir),
+ '-f', 'UTF-8',
+ '-i', locale,
+ '{}.UTF-8'.format(locale)
+ ], check=True)
- #kernel_params = 'ro text console=ttyAMA0,115200n8'
- #kernel_params += ' console=tty0 net.ifnames=0'
- #open8(rootdir + '/boot/grub/grub.cfg', 'w').write(mlstrip(
- # '''\
- # terminal_output console
- # serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
- # set default=0
- # set timeout=3
- # menuentry 'default' {{
- # search --set=root --file /boot/grub/grub.cfg --hint hd0,gpt2
- # linux /vmlinuz root=PARTUUID={rid} {kp}
- # initrd /initrd.img
- # }}
- # '''.format(rid=rootpartuuid, kp=kernel_params)))
+ run(['chroot', rootdir, '/usr/bin/qemu-arm-static', 'apt', 'update'],
+ check=True)
+ run(['chroot', rootdir, '/usr/bin/qemu-arm-static', 'apt', 'install'
+ 'linux-image-raspi2'], check=True)
def main():
diff --git a/rpi2-debian-stdkernel/other_boot_files/boot.scr b/rpi2-debian-stdkernel/other_boot_files/boot.scr
deleted file mode 100644
index f1ec9f8..0000000
--- a/rpi2-debian-stdkernel/other_boot_files/boot.scr
+++ /dev/null
@@ -1,25 +0,0 @@
-# u-boot commands, this file must be compiled with mk-image (or use
-# update-boot-uimage.sh)
-
-#setenv machid 0x00000c42
-
-# set the fdtfile according to your board model
-#setenv fdtfile bcm2709-rpi-2-b.dtb
-#setenv fdtfile bcm2835-rpi-b-rev2.dtb
-setenv fdtfile bcm2836-rpi-2-b.dtb
-
-mmc dev 0
-#ext4load mmc 0:2 ${kernel_addr_r} vmlinuz
-fatload mmc 0:1 ${kernel_addr_r} kernel.img
-#ext4load mmc 0:2 ${ramdisk_addr_r} initrd.img
-fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}
-setenv bootargs earlyprintk console=ttyAMA0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd
-#bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
-bootz ${kernel_addr_r} - ${fdt_addr_r}
-#bootz ${kernel_addr_r}
-
-#mmc dev 0
-#ext4load mmc 0:2 0x01000000 vmlinuz
-#fatload mmc 0:1 0x00000100 bcm2835-rpi-b-rev2.dtb
-#setenv bootargs earlyprintk console=ttyAMA0,115200n8
-#bootz 0x01000000 - 0x00000100
diff --git a/rpi2-debian-stdkernel/other_boot_files/config.txt b/rpi2-debian-stdkernel/other_boot_files/config.txt
deleted file mode 100644
index 62e6fd5..0000000
--- a/rpi2-debian-stdkernel/other_boot_files/config.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-enable_uart=1
-device_tree_address=0x100
-device_tree_end=0x8000
-kernel=u-boot.bin
-dtparam=i2c_arm=on
-dtparam=spi=on
diff --git a/rpi2-debian-stdkernel/other_boot_files/update-boot-uimage.sh b/rpi2-debian-stdkernel/other_boot_files/update-boot-uimage.sh
deleted file mode 100755
index 838e411..0000000
--- a/rpi2-debian-stdkernel/other_boot_files/update-boot-uimage.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-# Place the relevant set of boot commands into boot.scr
-mkimage -A arm -O linux -T script -C none -n boot.scr -d boot.scr boot.scr.uimg