Difference between revisions of "Poor-mans install, grub, PDI"
From Knoppix Documentation Wiki
(using patch instead of perl →modifying knoppix-autoconfig to use swap and/or PDI) |
Harry Kuhman (Talk | contribs) m (Reverted edit of 1164339014, changed back to last version by Harry Kuhman) |
||
| (12 intermediate revisions by 6 users not shown) | |||
| Line 2: | Line 2: | ||
The goal is to boot Knoppix from the HDD using a bootloader (grub) and three files: the ISO, a swap file, and a persistent disk image (PDI). | The goal is to boot Knoppix from the HDD using a bootloader (grub) and three files: the ISO, a swap file, and a persistent disk image (PDI). | ||
| − | == | + | == Version 1: copy files from CD == |
| − | === Part 1: copy the files from the CD === | + | === Part 1: copy the files from the CD (aka PMI - Poor Man's Install) === |
* boot with knoppix from the CD | * boot with knoppix from the CD | ||
knoppix dma noswap vga=0 1 | knoppix dma noswap vga=0 1 | ||
| Line 66: | Line 66: | ||
</pre> | </pre> | ||
| + | |||
=== Part 2: create a swapfile === | === Part 2: create a swapfile === | ||
* boot knoppix from the HDD using grub | * boot knoppix from the HDD using grub | ||
| Line 95: | Line 96: | ||
* Unfortunately, one has to do this each time at reboot. | * Unfortunately, one has to do this each time at reboot. | ||
<pre> | <pre> | ||
| − | + | { cat <<"eof" | |
| − | { cat <<eof | + | |
1059c1059 | 1059c1059 | ||
< ext3|ext3|reiserfs|xfs) MOUNTOPTS="$MOUNTOPTS,noatime" ;; | < ext3|ext3|reiserfs|xfs) MOUNTOPTS="$MOUNTOPTS,noatime" ;; | ||
| Line 103: | Line 103: | ||
eof | eof | ||
} | patch /etc/init.d/knoppix-autoconfig | } | patch /etc/init.d/knoppix-autoconfig | ||
| − | |||
exit | exit | ||
</pre> | </pre> | ||
| + | |||
| + | * one solution is to put the above commands into a script saved as /cdrom/knx402/knx.sh. Then once one enters emergency mode all one has to do is type: | ||
| + | /cdrom/knx402/knx.sh | ||
= Notes so far = | = Notes so far = | ||
Latest revision as of 23:59, 26 November 2006
Contents
Summary
The goal is to boot Knoppix from the HDD using a bootloader (grub) and three files: the ISO, a swap file, and a persistent disk image (PDI).
Version 1: copy files from CD
Part 1: copy the files from the CD (aka PMI - Poor Man's Install)
- boot with knoppix from the CD
knoppix dma noswap vga=0 1
- if you modify the environment variables, you should be able to copy and paste straight into a terminal
# set environment variables
drive=/dev/hda
partition=/dev/hda1
mountpoint=/mnt/hda1
grub_partition="(hd0,0)" # hda1 = hd0,0 -- format is (device,partition)
# clear the entire drive - yes, all information will be lost
{ seq -f d$'\n'%g 64 -1 1
echo "w"
} | fdisk ${drive} >& /dev/null
fdisk -l ${drive}
# Partition drive, creating a 1 GB partition that has the bootable flag set
echo -e "n\np\n1\n1\n+1G\na\n1\np\nw" | fdisk ${drive}
fdisk -l ${drive}
# create filesystem
mkfs.ext2 ${partition}
# rebuild /etc/fstab
rebuildfstab -r
# mount the partition
mount ${mountpoint}
# install grub
grub-install --root-directory=${mountpoint} ${drive}
# copy the files from the CD to ${partition}
cp -a /cdrom/ ${mountpoint}/knx402
ls -la ${mountpoint}/knx402/KNOPPIX/KNOPPIX
# create /mnt/hda1/boot/grub/menu.lst
cat <<eof > ${mountpoint}/boot/grub/menu.lst
timeout=5
default=0
title Knoppix 4.0.2 from ext2 hda1 ISO scan ramdisk=32MB
kernel ${grub_partition}/knx402/boot/isolinux/linux \\
ramdisk_size=100000 init=/etc/init lang=us \\
apm=power-off vga=0 nomce quiet fromhd=${partition} \\
knoppix_dir=knx402/KNOPPIX config=scan home=scan \\
ramdisk=32768 noprompt noeject -b 1
initrd ${grub_partition}/knx402/boot/isolinux/minirt.gz
boot
title Memory test
kernel ${grub_partition}/knx402/boot/isolinux/memtest
eof
wc -l ${mountpoint}/boot/grub/menu.lst
# unmount hda1
umount ${mountpoint}
# boot from the HDD
reboot
Part 2: create a swapfile
- boot knoppix from the HDD using grub
- on entering emergency mode, execute these commands:
mount -o remount,rw /cdrom dd if=/dev/zero of=/cdrom/knoppix.swp bs=1M count=40 mkswap /cdrom/knoppix.swp chmod 0600 /cdrom/knoppix.swp swapon /cdrom/knoppix.swp swapon -s reboot
- to use on reboot, modify /etc/init.d/knoppix-autoconfig. Unfortunately, one has to do this each time at reboot.
Part 3: create a persistent disk image
- boot knoppix from the HDD using grub
- on entering emergency mode and modifying knoppix-autoconfig, execute these commands:
rebuildfstab -r knoppix-mkimage # choose the defaults and the maximum size for a PDI exit
- to use on reboot, modify /etc/init.d/knoppix-autoconfig.
modifying knoppix-autoconfig to use swap and/or PDI
- Unfortunately, one has to do this each time at reboot.
{ cat <<"eof"
1059c1059
< ext3|ext3|reiserfs|xfs) MOUNTOPTS="$MOUNTOPTS,noatime" ;;
---
> ext2|ext3|reiserfs|xfs) MOUNTOPTS="$MOUNTOPTS,noatime" ;;
eof
} | patch /etc/init.d/knoppix-autoconfig
exit
- one solution is to put the above commands into a script saved as /cdrom/knx402/knx.sh. Then once one enters emergency mode all one has to do is type:
/cdrom/knx402/knx.sh
Notes so far
knoppix dma bootfrom=/dev/hda1/k402.iso vga=0 1
knoppix dma bootfrom=/dev/hda1/k402.iso vga=0 -b 1
knoppix dma noprompt noeject vga=0 1
{
rmmod tulip
modprobe de2104x
pump -k
pump -i eth0 &
alias mrw='mount -o remount,rw /cdrom'
alias mro='mount -o remount,ro /cdrom'
alias alias.save='alias > ~/.aliases.bash'
alias cls='clear'
alias cp='cp -i'
alias dir='ls -la'
alias function.delete='unset -f'
alias function.list='declare -f'
alias function.save='declare -f > ~/.functions.bash '
alias h='history'
alias l.='ls .[a-zA-Z]* --color=tty'
alias less='less -iX -S -# 10'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias more='less'
alias mv='mv -i'
alias path='echo $PATH'
alias pause='kill -19'
alias pd='cd -'
alias perl='perl -MEnglish -w'
alias rehash='hash -r'
alias resume='kill -18'
alias rm='rm -i'
alias root='sudo su -'
alias ssh='ssh -X'
}
alias.save
----
simple install (non-iso)
v1 - install using tohd, boot using fromhd, grub
## tohd
# a "/" at the end of /dev/hda/ -- doesn't work. ext2
knoppix dma noprompt noeject vga=0 tohd=/dev/hda1/ 1
# sans "/" -- works. ext2
knoppix dma noprompt noeject vga=0 tohd=/dev/hda1 1
# specifying knoppix_dir -- doesn't work
knoppix dma noprompt noeject vga=0 tohd=/dev/hda1 knoppix_dir=foo 1
# specifying a subdir -- doesn't work. ext2
knoppix dma noprompt noeject vga=0 tohd=/dev/hda1/foo 1
# specifying fromhd -- works. ext2
knoppix dma noprompt noeject vga=0 tohd=/dev/hda1 fromhd 1
## fromhd
# specify fromhd -- works
knoppix dma noprompt noeject vga=0 fromhd=/dev/hda1 1
# specifying knoppix_dir as foo -- doesn't work, yet
knoppix dma noprompt noeject vga=0 fromhd=/dev/hda1 knoppix_dir=foo -b 1
# specifying knoppix_dir as KNOPPIX -- works
knoppix dma noprompt noeject vga=0 fromhd=/dev/hda1 knoppix_dir=KNOPPIX -b 1
# rename /dev/hda1/KNOPPIX to /dev/hda1/foo and specifying knoppix_dir as foo -- works
knoppix dma noprompt noeject vga=0 fromhd=/dev/hda1 knoppix_dir=foo -b 1
# mv /dev/hda1/KNOPPIX to /dev/hda1/foo and specifying knoppix_dir as foo/KNOPPIX -- works
knoppix dma noprompt noeject vga=0 fromhd=/dev/hda1 knoppix_dir=foo/KNOPPIX -b 1
## grub
# copy kernel and initrd to /foo
cd /cdrom/boot/isolinux/
cp -a minirt.gz linux memtest /mnt/hda1/foo/
# modify grub stanza
cd /mnt/hda1/boot/grub/
cat <<eof > menu.lst
timeout=5
default=0
title Knoppix 4.0.2 from ext3 hda1 ISO scan ramdisk=32MB
kernel (hd0,0)/foo/linux ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=0 nomce quiet fromhd=/dev/hda1 knoppix_dir=foo/KNOPPIX config=scan home=scan ramdisk=32768 noprompt noeject -b 1
initrd (hd0,0)/foo/minirt.gz
boot
title Memory test
kernel (hd0,0)/foo/memtest
eof
# boot using grub -- works
v2 - include a PDI
create a pdi on /dev/dha1. So far, booting with this PDI hasn't worked. Looks like theres a bug in /etc/init.d/knoppix-autoconfig. The code has two RegExs for ext3 and none for ext2. The solution is to boot using the -b cheatcode, modify /knoppix-autoconfig, and continue booting. Then the PDI is recognized and mounted.
# misc boot lines and commands
knoppix dma noprompt noeject vga=0 -b 1
tune2fs -O ^has_journal /dev/hda1