Skip to content

Commit

Permalink
installer: redo partitions, remove raspi-devs pkg, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
idlemoor committed Aug 13, 2012
1 parent 22747ef commit bede7fa
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 407 deletions.
50 changes: 26 additions & 24 deletions installer/installer.SlackBuild
Expand Up @@ -56,24 +56,23 @@ mkdir -p $MYTMP/initrd-tree
cd $MYTMP/initrd-tree
zcat $CWD/initrd-versatile.img | cpio -iv

# patch recent problem recognising partitions mmcblk0p1 etc on SD card
cp $CWD/probe $MYTMP/initrd-tree/sbin/

#------------------------------------------------------------------------------
# (1) Add raspi device nodes (maybe not needed -- to be checked)

cd $MYTMP/initrd-tree/
tar xvf $CWD/../raspi-devs/_devs.tar.xz

#
# cd $MYTMP/initrd-tree/
# tar xvf $CWD/../raspi-devs/_devs.tar.xz
#
#------------------------------------------------------------------------------
# (2) Add README and raspi-extra to the installer tree

cat $CWD/README.installer > $MYTMP/initrd-tree/README

mkdir -p $MYTMP/initrd-tree/raspi-extra
for pkgbase in \
raspi-boot raspi-devs raspi-hacks \
kernel_raspi kernel-modules-raspi
raspi-boot \
raspi-hacks \
kernel_raspi \
kernel-modules-raspi
do
pkg=$(ls -t $OUTPUT/$pkgbase-*.t?z | head -1)
cp -a -v \
Expand All @@ -92,10 +91,11 @@ cd $CWD/../kernel_raspi/linux
make modules_install INSTALL_MOD_PATH=$MYTMP/initrd-tree

#------------------------------------------------------------------------------
# (4) Roll the initrd.gz
# (4) Roll the initrd. We name it 'install.gz' so it's recognisable and
# can be removed after installation.

cd $MYTMP/initrd-tree
find . | cpio -o -v -H newc | gzip -9c > $MYTMP/initrd.gz
find . | cpio -o -v -H newc | gzip -9c > $MYTMP/install.gz

#------------------------------------------------------------------------------
# (5) Make an empty image and format it
Expand All @@ -104,16 +104,18 @@ rm -f $MYTMP/$IMAGE
echo "Making $MYTMP/$IMAGE"

# Let's work in 512B sectors.
# 128 "heads" and 32 "sectors" => 2MiB "cylinders".
# 128 "heads" and 32 "sectors" => 2MiB "cylinders",
# That's 4096 sectors per "cylinder".
# 4 "cylinders" = 8MiB erase block boundary (or 2*4MiB boundaries).
# So keep partition boundaries at 4-cyl multiples for best results.
# That's 16384 sectors per erase block.
# 944 "cylinders" = 1979711488B, which is < 2MB, so fits on a "2Mb" card.
dd if=/dev/zero of=$MYTMP/$IMAGE bs=512 count=$(( 128 * 32 * 944 ))

# Drop in the prepared MBR.
# Partition 1 start 2048 end 114687 type 0c
# Partition 2 start 114688 end 1019903 type 82
# Partition 3 start 1019904 end 3866623 type 83
# Partition 1 start 1 end 180223 type 0c
# Partition 2 start 180224 end 1032191 type 82
# Partition 3 start 1032192 end 3866623 type 83
dd if=$CWD/mbr of=$MYTMP/$IMAGE bs=512 count=1 conv=notrunc

LOOPDEV=$(losetup -f --show $MYTMP/$IMAGE)
Expand Down Expand Up @@ -151,25 +153,25 @@ cp -v \
$MYTMP/mnt/start.elf
cat $CWD/../raspi-boot/config.txt.new > $MYTMP/mnt/config.txt

# Get the kernel
# Kernel
cp -v \
$CWD/../kernel_raspi/linux/arch/arm/boot/Image \
$CWD/../kernel_raspi/linux/arch/arm/boot/zImage \
$MYTMP/mnt/kernel.img
# Take kernel command line from kernel config. 'root=' doesn't matter.
grep 'CONFIG_CMDLINE=' $CWD/../kernel_raspi/linux/.config | \
sed -e 's/CONFIG_CMDLINE="//' -e 's/"$//' \
> $MYTMP/mnt/cmdline.txt

# Get the initrd.gz
# Get install.gz
cp -v \
$MYTMP/initrd.gz \
$MYTMP/mnt
$MYTMP/install.gz \
$MYTMP/mnt/

# Add initrd.gz stuff to /boot/config.txt and /boot/cmdline.txt
# Add initrd stuff for install.gz to /boot/config.txt and /boot/cmdline.txt
LOADADDR="0xa00000"
SIZE="0x$(printf '%x' $(stat --format='%s' $MYTMP/mnt/initrd.gz))"
echo "ramfsfile=initrd.gz" >> $MYTMP/mnt/config.txt
echo "ramfsaddr=$LOADADDR" >> $MYTMP/mnt/config.txt
SIZE="0x$(printf '%x' $(stat --format='%s' $MYTMP/mnt/install.gz))"
echo "ramfsfile=install.gz" >> $MYTMP/mnt/config.txt
echo "ramfsaddr=$LOADADDR" >> $MYTMP/mnt/config.txt
sed -i -e "s/\$/ initrd=$LOADADDR,$SIZE/" $MYTMP/mnt/cmdline.txt

# Assemble the README
Expand Down
Binary file modified installer/mbr
Binary file not shown.

0 comments on commit bede7fa

Please sign in to comment.