Package: freedombox-setup
Severity: normal
Tags: patch

The attached patch has the following changes:

1. Removes all of the "apt-get installs" from the 10_hardware setup
script. The packages that were being installed are now listed as
Depends, except for firmware-libertas which is a Suggest due to being
non-free.

2. Switch Beaglebone from uEnv.txt to boot.scr for first-boot
environment. This is similar to Cubietruck's setup. Also flash-kernel
will produce boot.scr when it runs during first-boot, so this will be a
little more consistent between first-boot and subsequent boots.

Note that I have only tested these changes on Beaglebone so far.
From d3bcf3138b49bc648df2dc58e25f3d882f9ca0f3 Mon Sep 17 00:00:00 2001
From: James Valleroy <jvalle...@mailbox.org>
Date: Sun, 1 Nov 2015 19:40:15 -0500
Subject: [PATCH 1/4] Add firmware-libertas as Suggest. Remove script fragment
 that installed it with apt-get.

---
 debian/control      |  3 ++-
 setup.d/10_hardware | 12 ------------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/debian/control b/debian/control
index 1397b95..d6d0ce3 100644
--- a/debian/control
+++ b/debian/control
@@ -77,6 +77,7 @@ Recommends:
  batctl
  , rfkill
 Suggests:
- monkeysphere
+ firmware-libertas
+ , monkeysphere
 Description: Package to set up freedombox environment
  Configure the Freedombox environment before and after the first reboot.
diff --git a/setup.d/10_hardware b/setup.d/10_hardware
index 624ab55..f4d1fcc 100755
--- a/setup.d/10_hardware
+++ b/setup.d/10_hardware
@@ -7,17 +7,6 @@ enable_serial_console() {
     echo "T0:12345:respawn:/sbin/getty -L $device 115200 vt100" >> /etc/inittab
 }
 
-dreamplug_install_extra_packages() {
-    # Install additional hardware related packages for Dreamplug
-    if [ -n "`grep non-free /etc/apt/sources.list`" ]
-    then
-        echo "Installing non-free WIFI package: firmware-libertas"
-        apt-get install -y firmware-libertas
-    else
-        echo "Non-free packages disabled.  Skipping DreamPlug non-free WIFI."
-    fi
-}
-
 dreamplug_flash() {
     # allow flash-kernel to work without valid /proc contents
     # ** this doesn't *really* work, since there are too many checks
@@ -245,7 +234,6 @@ EOF
 
 case "$MACHINE" in
     dreamplug|guruplug)
-	dreamplug_install_extra_packages
 	dreamplug_flash
 	dreamplug_repack_kernel
 	enable_serial_console ttyS0
-- 
2.6.2


From ee3ce9b47e8167f081ee79b76eeedc6da9e9b254 Mon Sep 17 00:00:00 2001
From: James Valleroy <jvalle...@mailbox.org>
Date: Sun, 1 Nov 2015 19:50:58 -0500
Subject: [PATCH 2/4] Add flash-kernel as Depend. So we don't need to apt-get
 install it in hardware script.

---
 debian/control      | 1 +
 setup.d/10_hardware | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index d6d0ce3..ea746d6 100644
--- a/debian/control
+++ b/debian/control
@@ -38,6 +38,7 @@ Depends: ${misc:Depends}
  , dosfstools
  , etckeeper
  , firewalld
+ , flash-kernel
  , haveged
  , how-can-i-help
  , htop
diff --git a/setup.d/10_hardware b/setup.d/10_hardware
index f4d1fcc..30d3d7f 100755
--- a/setup.d/10_hardware
+++ b/setup.d/10_hardware
@@ -13,7 +13,6 @@ dreamplug_flash() {
     #    that fail in an emulated environment!  We'll have to do it by
     #    hand below anyway...
     export FK_MACHINE="Globalscale Technologies Dreamplug"
-    apt-get install -y flash-kernel
 }
 
 dreamplug_repack_kernel() {
@@ -134,7 +133,6 @@ beaglebone_flash() {
     #    that fail in an emulated environment!  We'll have to do it by
     #    hand below anyway...
     export FK_MACHINE="TI AM335x BeagleBone"
-    apt-get install -y flash-kernel
 }
 
 beaglebone_repack_kernel() {
-- 
2.6.2


From 70037f946cca92aecce3d0f1a5d3a9ea32fbe7a4 Mon Sep 17 00:00:00 2001
From: James Valleroy <jvalle...@mailbox.org>
Date: Sun, 1 Nov 2015 19:53:10 -0500
Subject: [PATCH 3/4] Add packages used by rpi-update as Depends.

---
 debian/control      | 4 ++++
 setup.d/10_hardware | 6 ------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index ea746d6..ca78cff 100644
--- a/debian/control
+++ b/debian/control
@@ -29,7 +29,9 @@ Depends: ${misc:Depends}
  , augeas-tools
  , avahi-daemon
  , avahi-utils
+ , binutils
  , bridge-utils
+ , ca-certificates
  , curl
  , devio
  , dialog
@@ -39,6 +41,7 @@ Depends: ${misc:Depends}
  , etckeeper
  , firewalld
  , flash-kernel
+ , git-core
  , haveged
  , how-can-i-help
  , htop
@@ -46,6 +49,7 @@ Depends: ${misc:Depends}
  , iptables
  , iputils-ping
  , iw
+ , kmod
  , libapache2-mod-gnutls
  , libapache2-mod-php5
  , libnss-gw-name
diff --git a/setup.d/10_hardware b/setup.d/10_hardware
index 30d3d7f..26a41cb 100755
--- a/setup.d/10_hardware
+++ b/setup.d/10_hardware
@@ -58,9 +58,6 @@ dreamplug_repack_kernel() {
 
 # Install binary blob and kernel needed to boot on the Raspberry Pi.
 raspberry_setup_boot() {
-    # Packages used by rpi-update to make Raspberry Pi bootable
-    apt-get install -y git-core binutils ca-certificates wget kmod
-
     wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update \
 	-O /usr/bin/rpi-update
     chmod a+x /usr/bin/rpi-update
@@ -71,9 +68,6 @@ raspberry_setup_boot() {
 
 # Install binary blob and kernel needed to boot on the Raspberry Pi 2.
 raspberry2_setup_boot() {
-    # Packages used by rpi-update to make Raspberry Pi 2 bootable
-    apt-get install -y git-core binutils ca-certificates wget kmod
-
     wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update \
 	-O /usr/bin/rpi-update
     chmod a+x /usr/bin/rpi-update
-- 
2.6.2


From 14c7ab20b0f14ccacbc085c98c8649d9cef10864 Mon Sep 17 00:00:00 2001
From: James Valleroy <jvalle...@mailbox.org>
Date: Sun, 1 Nov 2015 21:00:27 -0500
Subject: [PATCH 4/4] Use boot.scr instead of uEnv.txt for BeagleBone.

---
 setup.d/10_hardware | 44 ++++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/setup.d/10_hardware b/setup.d/10_hardware
index 26a41cb..64255fb 100755
--- a/setup.d/10_hardware
+++ b/setup.d/10_hardware
@@ -77,7 +77,7 @@ raspberry2_setup_boot() {
 }
 
 beaglebone_setup_boot() {
-    # Setup uEnv.txt
+    # Setup boot.cmd
     if grep -q btrfs /etc/fstab ; then
 	fstype=btrfs
     else
@@ -88,35 +88,39 @@ beaglebone_setup_boot() {
     initRd=initrd.img-$version
     vmlinuz=vmlinuz-$version
 
-    # uEnv.txt for Beaglebone
+    # boot.cmd for BeagleBone Black
     # based on https://github.com/beagleboard/image-builder/blob/master/target/boot/beagleboard.org.txt
-    cat >> /boot/uEnv.txt <<EOF
-mmcroot=/dev/mmcblk0p2 ro
-mmcrootfstype=$fstype rootwait fixrtc
-mmcrootflags=subvol=@
+    cat >> /boot/boot.cmd <<EOF
+setenv mmcroot /dev/mmcblk0p2 ro
+setenv mmcrootfstype $fstype rootwait fixrtc
+setenv mmcrootflags subvol=@
 
-console=ttyO0,115200n8
+setenv console ttyO0,115200n8
 
-kernel_file=$vmlinuz
-initrd_file=$initRd
+setenv kernel_file $vmlinuz
+setenv initrd_file $initRd
 
-loadaddr=0x80200000
-initrd_addr=0x81000000
-fdtaddr=0x80F80000
+setenv loadaddr 0x80200000
+setenv initrd_addr 0x81000000
+setenv fdtaddr 0x80F80000
 
-initrd_high=0xffffffff
-fdt_high=0xffffffff
+setenv initrd_high 0xffffffff
+setenv fdt_high 0xffffffff
 
-loadkernel=load mmc \${mmcdev}:\${mmcpart} \${loadaddr} \${kernel_file}
-loadinitrd=load mmc \${mmcdev}:\${mmcpart} \${initrd_addr} \${initrd_file}; setenv initrd_size \${filesize}
-loadfdt=load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
+setenv loadkernel load mmc \${mmcdev}:\${mmcpart} \${loadaddr} \${kernel_file}
+setenv loadinitrd load mmc \${mmcdev}:\${mmcpart} \${initrd_addr} \${initrd_file}\\; setenv initrd_size \\\${filesize}
+setenv loadfdt load mmc \${mmcdev}:\${mmcpart} \${fdtaddr} /dtbs/\${fdtfile}
 
-loadfiles=run loadkernel; run loadinitrd; run loadfdt
-mmcargs=setenv bootargs console=tty0 console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags}
+setenv loadfiles run loadkernel\\; run loadinitrd\\; run loadfdt
+setenv mmcargs setenv bootargs console=tty0 console=\${console} root=\${mmcroot} rootfstype=\${mmcrootfstype} rootflags=\${mmcrootflags}
 
-uenvcmd=run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
+run loadfiles; run mmcargs; bootz \${loadaddr} \${initrd_addr}:\${initrd_size} \${fdtaddr}
 EOF
 
+    # boot.scr for BeagleBone Black
+    mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
+
+    # DTBs for BeagleBone Black
     mkdir -p /boot/dtbs
     cp /usr/lib/linux-image-*-armmp/* /boot/dtbs
 }
-- 
2.6.2

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to