You are not logged in.

Dear visitor, welcome to Dreamboard. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, March 8th 2006, 6:52pm

multiboot setup?

Please provide some information about the hard- and software used.

Box type: DB7025
GUI (enigma1/enigma2): Enigma2
Firmware version: Latest DMM build as of 06022006

your question Is there a tutorial on how to build a multi boot environment? I'd like to have a Compact Flash in my DB and be able to boot with different images to try out various things, but keep the original DMM image intact as a reference. I searched the board, but maybe I have missed it.

This post has been edited 2 times, last edit by "nattar" (Mar 8th 2006, 6:54pm)


2

Wednesday, March 8th 2006, 7:05pm

afaik this is not yet possible with dm7025
mfg ,
Reichi

"Die Deutsche Rechtschreibung ist Freeware, sprich, du kannst sie kostenlos nutzen.
Allerdings ist sie nicht Open Source, d.h. du darfst sie nicht verändern oder in veränderter Form veröffentlichen."


3

Wednesday, March 8th 2006, 7:25pm

Is this becasue of the Compact Flash driver? Or a different reason?

I have a hard drive in my DB? Can I use that?

This post has been edited 1 times, last edit by "nattar" (Mar 8th 2006, 7:26pm)


4

Wednesday, March 8th 2006, 7:41pm

no, there's no "multiboot software" yet :)
mfg ,
Reichi

"Die Deutsche Rechtschreibung ist Freeware, sprich, du kannst sie kostenlos nutzen.
Allerdings ist sie nicht Open Source, d.h. du darfst sie nicht verändern oder in veränderter Form veröffentlichen."


5

Wednesday, March 8th 2006, 8:25pm

I think noggie is trying to do this - but seems to last some time... :rolleyes:

Kernel oops on 7025
grüße maxl


6

Wednesday, March 8th 2006, 10:18pm

Booting from CF is supported by DMM, no extra software needed. What you need:
1) A CF that has at least two partitions, one for boot and one for root
2) The boot partition must be the first partition on the CF, and must be formatted as a FAT partition.
3) The root partition can not be FAT, but could be e.g. ext3
4) A file on the the boot partition called "autorun.bat" that loads the boot screen image and the kernel. Kernel options are allowed, and must be used to change the root partition from flash (a default that is compiled into the kernel) to the root partition on CF.
5) Obviously all the needed boot files on the boot partition, and all the rest of the files in the image on the root partition.

Here's a small script (to be run on the 7025) to partition and format the CF. Change to fit your own needs.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#! /usr/bin/python
import os, sys, getopt

#################################################################
# This is GPL software.
# Written by noggie
#################################################################

# The script will prepare a CF for booting an image.
#  - Partition with FAT + EXT3 (+ optionally swap)
#  - Format partitions

# Partition sizes.  The remainder goes to the ext3 partition.
# Swap is only made if the "-s" option is provided.
SIZE_FAT = 30 # MB
SIZE_SWAP = 96 # MB

# Some paths
CF_PREFIX = '/dev/ide/host1/bus0/target0/lun0/'
CF_DISK = CF_PREFIX + 'disc'
CF_FAT = CF_PREFIX + 'part1'
CF_EXT3 = CF_PREFIX + 'part2'
CF_SWAP = CF_PREFIX + 'part3'
PROC_PREFIX = '/proc/ide/hdc/'

# Optional arguments
opts, pargs = getopt.getopt(sys.argv[1:], 'svb', ['swap', 'verbose', 'batch'])
opts = dict(opts)
make_swap = (opts.has_key('-s') or opts.has_key('--swap'))
verbose = (opts.has_key('-v') or opts.has_key('--verbose'))

# Warn the poor user
if not opts.has_key('-b'):
  sys.stdout.write('THIS WILL DELETE ANY PREVIOUS CONTENTS ON THE CF!!\n')
  print 'Do you want to continue? '
  if sys.stdin.readline().lower()[0] != 'y':
    os.exit(1)

def vprint(fmt, *args):
  if verbose:
    sys.stderr.write(fmt % args)

# Get CF geometry
fd = open(PROC_PREFIX + 'geometry', 'r')
for line in fd:
  if line.startswith('logical'):
    cylinders, heads, sectors = line.replace('logical', '').strip().split('/')
fd.close()

# Convert strings to ints.
cylinders = int(cylinders)
heads = int(heads)
sectors = int(sectors)
cf_size = cylinders * heads * sectors
vprint('Geometry : %d/%d/%d (=%d MB)\n', cylinders, heads, sectors, cf_size/2048)

# Make sure CF is not in use
fd = open('/proc/mounts', 'r')
for line in fd:
  if line.startswith(CF_PREFIX):
    dir = line.split()[1]
    vprint('Umounting %s\n', dir)
    os.system('/bin/umount ' + dir)
fd.close()

fd = open('/proc/swaps', 'r')
for line in fd:
  if line.startswith(CF_PREFIX):
    dev = line.split()[0]
    vprint('Removing swap %s\n', dev)
    os.system('/sbin/swapoff ' + dev)

# Clear existing partition table
vprint('Clearing existing partition table\n');
fd = os.popen('2>/dev/null 1>&2 /sbin/sfdisk -q ' + CF_DISK, 'w')
fd.write('0,0\n')
fd.close()

# Compute new partitions
sectors_pr_mb = 1024 * 1024 / 512
sectors_pr_cyl = sectors * heads
fat_cyls = (SIZE_FAT * sectors_pr_mb) / sectors_pr_cyl + 1
if make_swap:
 swap_cyls = (SIZE_SWAP * sectors_pr_mb) / sectors_pr_cyl + 1
else:
  swap_cyls = 0
ext3_cyls = cylinders - 1 - fat_cyls - swap_cyls
vprint('Calculated partition sizes\n');
vprint('\tPartition table : 1 (=%d KB)\n', sectors_pr_cyl / 2)
vprint('\tFAT             : %d (=%.2f KB)\n', fat_cyls, fat_cyls * sectors_pr_cyl / 2.0)
vprint('\tEXT3            : %d (=%.2f KB)\n', ext3_cyls, ext3_cyls * sectors_pr_cyl / 2.0)
vprint('\tswap            : %d (=%.2f KB)\n', swap_cyls, swap_cyls * sectors_pr_cyl / 2.0)

# Create new partition table
vprint('Creating new partition table\n')
fd = os.popen('2>/dev/null 1>&2 /sbin/sfdisk -q ' + CF_DISK, 'w')
fd.write(',%d,6\n' % fat_cyls)
if make_swap:
  fd.write(',%d,\n' % ext3_cyls)
  fd.write(',,S\n')
else:
  fd.write(',,\n')
fd.close()
if verbose:
  os.system('/sbin/sfdisk -l ' + CF_DISK)

# Format partitions
vprint('Formatting partitions\n')
os.system('/usr/sbin/mkdosfs ' + CF_FAT)
os.system('/sbin/mkfs.ext3 ' + CF_EXT3)
if make_swap:
  os.system('/sbin/mkswap ' + CF_SWAP)

# Make sure we have mount-points
for dir in ['/media/cf', '/media/cf2']:
  try:
    os.mkdir(dir)
  except OSError:
    pass

# Add entries to /etc/fstab, if necessary
fd = open('/etc/fstab', 'r')
fstab = fd.readlines()
fd.close()
changed = 0
if len(filter(lambda x: x.startswith(CF_FAT), fstab)) == 0:
  fstab.append(CF_FAT + ' /media/cf auto defaults 0 0\n')
  changed = 1
if len(filter(lambda x: x.startswith(CF_EXT3), fstab)) == 0:
  fstab.append(CF_EXT3 + ' /media/cf2 auto defaults 0 0\n')
  changed = 1
if make_swap and (len(filter(lambda x: x.startswith(CF_SWAP), fstab)) == 0):
  fstab.append(CF_SWAP + ' swap swap defaults 0 0\n')
  changed = 1
if changed:
  fd = open('/etc/fstab', 'w')
  fd.writelines(fstab)
  fd.close()

# Finally, mount the partitions
os.system('/bin/mount /media/cf')
os.system('/bin/mount /media/cf2')
if make_swap:
  os.system('/sbin/swapon ' + CF_SWAP)

(Please excuse my python code, I'm still learning...)
The script assumes that you have the dosfstools package installed, it contains the "mkdosfs" program. You will also need a directory for the root partition on CF. The script assumes that this directory is /media/cf2

A simple way to make an image on CF is to mount the CF on your Linux PC and copy the files from your OE build environment. You could also make a copy of the existing files on flash, so that the CF contains a backup. The following script could perhaps be a starting point:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
#! /bin/sh
cp /boot/* /media/cf
cd /media/cf2
cp -a /bin /etc /hdd /home /lib /sbin /share /tmp /usr .
mkdir boot dev media proc sys var
cd media
mkdir card cf cf2 cifs dvd hdd mmc1 net nfs ram realroot union usb
(
        echo /cf/bootlogo.elf
        echo /cf/vmlinux.gz root=/dev/hdc2 console=ttyS0,115200
) > /media/cf/autorun.bat
sed -e '/boot/s/^/#/' -e '/media\/cf/s/^/#/' /etc/fstab > /media/cf2/etc/fstab
echo "/dev/ide/host1/bus0/target0/lun0/part1 /boot auto  defaults              0 0" >> /media/cf2/etc/fstab

You could also unpack nfi files on your Linux PC if you have the required mtd and jffs2 modules for your kernel. Doing the same thing on the 7025 is possible, but it requires some extensive kernel patching, and you probably don't want to do that. I've got my own scripts to unpack nfi-files on my PC, but they are quite dependant on my own Linux setup and probably won't run on any other machine without some modifications. I don't have a problem posting them, but I kinda doubt that anybody would find them very interesting. Let me know if I'm wrong.

7

Thursday, March 9th 2006, 10:16am

Hi noggie,

yes, i'd like to know the way to mount the .nfi images on my linux pc, because I'm also interested to boot from CF images :). And, there is a way to change files on the unpacked .nfi and pack it again?

Thanks!

8

Thursday, March 9th 2006, 8:37pm

Some scripts

Well, let it not be said that I didn't warn you... These scripts have been written for my own private use, reflecting my Linux environement, with no attempt at making them generic and usable for anybody else. I can almost guarantee that they will need changes to run on any other machine but my own.

Just to make it clear, these scripts are used on my PC, not on the 7025. On the PC, each image for the 7025 is stored in a separate directory.

There are four different scripts:
1) Backup_cf, to copy the existing image from CF to the PC disk.
2) Unpack_image, to unpack an nfi file to PC disk
3) Update_files, to copy config files etc. from one image to another (still on the PC)
4) Copy_image_to_cf, to copy an image to the CF

Those four scripts would typically be run one after the other when I test a new image. The new image on CF would then contain all my up-to-date configuration files, and I would have a backup of my last working image on disk in case the new one fails for whatever reason.

Notably missing is a script to install extra ipkg-packages offline on an image. This script would also make it easier to update single packages (think CVS versions of enigma2) from OE. Maybe this week-end... Currently, I keep a collection of ipkg-files in a directory on the harddisk on the 7025, and install them on any new image from the 7025 itself.
noggie has attached the following file:

9

Friday, March 10th 2006, 12:20pm

Thanks! I'll try it :)