Update to palo to allow the listing of the current kernel directory
This patch (to palo's cvs head) adds the capability to list whatever's in the current kernel directory. Probably you'll only find it useful if, like me, you keep lots of kernels around and can never remember their names
James
Index: ipl/bootloader.h
===================================================================
RCS file: /var/cvs/palo/ipl/bootloader.h,v
retrieving revision 1.13
ipl/bootloader.h +3 -0
@@ -21,6 +21,7 @@int (*open)(const char *filename);int (*bread)(int fd,long blkno,long nblks,char *buf);void (*close)(int fd); +const char * (*readdir)(int fd,int rewind); };
@@ -60,6 +61,8 @@int ext2_mount (long cons_dev,long p_offset,long quiet);int ext2_open (const char *filename);int ext2_filesize (int fd); +const char *ext2_readdir (int fd,int rewind); +void ext2_close (int fd);/* lib.c */ void blockprint (int zero_offset,char *buf,int nbytes);
Index: ipl/ext2.c
===================================================================
RCS file: /var/cvs/palo/ipl/ext2.c,v
retrieving revision 1.11
ipl/ext2.c +11 -9
@@ -674,14 +674,13 @@return ext2_breadi (ip, blkno, nblks, buffer); } -#if 0 /* * Note: don't mix any kind of file lookup or other I/O with this or * you will lose horribly (as it reuses blkbuf) */ -static const char *ext2_readdir (int fd,int rewind) +const char *ext2_readdir (int fd,int rewind) { -struct ext2_inode * ip = &inode_table[fd].inode; +struct ext2_inode * ip = fd2inode[fd];struct ext2_dir_entry_2 * ent;if (!S_ISDIR (ip->i_mode)) { printf("fd %d (inode %d) is not a directory (mode %x)\n",
@@ -696,7 +695,6 @@return NULL ; } } -#endif int ext2_filesize (int fd) {
@@ -822,7 +820,7 @@ } -static void ext2_close (int fd) +void ext2_close (int fd) {/* blah, hack, don't close the root inode ever */ if (&inode_table[fd].inode != root_inode)
@@ -831,9 +829,13 @@struct bootfs ext2fs = { -0 /* FS_EXT2 */ ,0 , - ext2_mount, - ext2_open, ext2_bread, ext2_close/* , -ext2_readdir, ext2_fstat */ + .fs_type =0 , + .blocksize =0 , + .mount = ext2_mount, + .open = ext2_open, + .bread = ext2_bread, + .close = ext2_close, + .readdir = ext2_readdir, +/* .fstat = ext2_fstat */ };/* $Id: ext2.c,v 1.5 2000/09/21 16:47:48 bame Exp $ */
Index: ipl/ipl.c
===================================================================
RCS file: /var/cvs/palo/ipl/ipl.c,v
retrieving revision 1.37
ipl/ipl.c +80 -22
133 lines not on this page · raw message
Hi all,
That works for me ;)
but if there are some mistake in the palo.conf (an empty one ?) and you don't want to boot interactively: the ipl will loop .
I suggested a patch (http://lists.parisc-linux.org/pipermail/parisc-linux=
/2004-January/022030.html)
which I use with success since this time on my b2k, n4k and c110. Though I never get any news, is there any interest to submit an update?
Thanks,
Joel
Quoted 5 lines
-- Original Message --
From: James Bottomley <[email protected]>
To: PARISC list <[email protected]>
Date: 13 May 2004 19:00:54 -0500
Subject: [parisc-linux] Update to palo to allow the listing of the curr=
ent
Quoted 8 lines
kernel directory
This patch (to palo's cvs head) adds the capability to list whatever's in the current kernel directory. Probably you'll only find it useful if, like me, you keep lots of kernels around and can never remember their names
Quoted 4 lines
James
Index:
ipl/bootloader.h=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Quoted 22 lines
RCS file:
/var/cvs/palo/ipl/bootloader.h,v
retrieving revision 1.13
diff -u -r1.13bootloader.hipl/bootloader.h +3
-0@@ -21,6 +21,7 @@int (*open)(const char *filename);int (*bread)(int fd,long blkno,long nblks,char *buf);void (*close)(int fd); +const char * (*readdir)(int fd,int rewind); };@@ -60,6 +61,8 @@int ext2_mount (long cons_dev,long p_offset,long quiet);int ext2_open (const char *filename);int ext2_filesize (int fd); +const char *ext2_readdir (int fd,int rewind); +void ext2_close (int fd);/* lib.c */ void blockprint (int zero_offset,char *buf,int nbytes);
Quoted 2 lines
Index:
ipl/ext2.c=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Quoted 57 lines
RCS file:
/var/cvs/palo/ipl/ext2.c,v
retrieving revision 1.11
diff -u -r1.11ext2.cipl/ext2.c +11
-9@@ -674,14 +674,13 @@return ext2_breadi (ip, blkno, nblks, buffer); } -#if 0 /* * Note: don't mix any kind of file lookup or other I/O with this or * you will lose horribly (as it reuses blkbuf) */ -static const char *ext2_readdir (int fd,int rewind) +const char *ext2_readdir (int fd,int rewind) { -struct ext2_inode * ip =3D &inode_table[fd].inode; + struct ext2_inode * ip =3D fd2inode[fd];struct ext2_dir_entry_2 * ent;if (!S_ISDIR (ip->i_mode)) { printf("fd %d (inode %d) is not a directory (mode %x)\n",@@ -696,7 +695,6 @@return NULL ; } } -#endif int ext2_filesize (int fd) {@@ -822,7 +820,7 @@ } -static void ext2_close (int fd) +void ext2_close (int fd) {/* blah, hack, don't close the root inode ever */ if (&inode_table[fd].inode !=3D root_inode)@@ -831,9 +829,13 @@ struct bootfs ext2fs =3D { -0 /* FS_EXT2 */ ,0 , - ext2_mount, - ext2_open, ext2_bread, ext2_close/* , -ext2_readdir, ext2_fstat */ + .fs_type =3D 0, + .blocksize =3D 0, + .mount =3D ext2_mount, + .open =3D ext2_open, + .bread =3D ext2_bread, + .close =3D ext2_close, + .readdir =3D ext2_readdir, + /* .fstat =3D ext2_fstat */ };/* $Id: ext2.c,v 1.5 2000/09/21 16:47:48 bame Exp $ */
Quoted 2 lines
Index:
ipl/ipl.c=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Quoted 9 lines
RCS file:
/var/cvs/palo/ipl/ipl.c,v
retrieving revision 1.37
diff -u -r1.37ipl.cipl/ipl.c +0
-0@@ -215,6 +215,42 @@strcpy (out, tmpbuf); }
ipl/ipl.c line 227
Quoted 10 lines
ipl/ipl.c +10
-0+static struct diskpartition partition[MAXPARTS ]; +static int ext2 =3D 0; +static int bootdev; + +static void +partition_transform (int *kern_part,int *rd_part) +{ +int i, palo_part =3D -1 ; + +/* if the F0 partition is the same as the requested kernel partiti=
on,
ipl/ipl.c line 228
Quoted 1 line
ipl/ipl.c +1
-0+* for now change it to zero to re-use the existing logic. Should=
do
Quoted 29 lines
ipl/ipl.c +25
-0+* the reverse in the future probably. +*/ + for (i =3D 0; i < sizeof partition / sizeof partition[0]; i++) + { + if (partition[i].id =3D=3D PALO_PARTITION) + { + palo_part =3D i + 1; + if (*kern_part =3D=3D palo_part) + *kern_part =3D 0; + + if (rd_part && *rd_part =3D=3D palo_part) + *rd_part =3D 0; + +break ; + } + } + + if (ext2 && *kern_part =3D=3D 0) { + *kern_part =3D palo_part; + if(rd_part && *rd_part =3D=3D 0) + *rd_part =3D palo_part; + } + +} +static void interact (char *commandline,int *ok) {
ipl/ipl.c line 249
Quoted 4 lines
ipl/ipl.c +0
-1@@ -246,7 +282,7 @@ {printf ("%2d: %s\n" , i, argv[i]); } - puts("\nEdit which field?\n(or 'b' to boot with this command line, 'r=
'
ipl/ipl.c line 286
Quoted 2 lines
ipl/ipl.c +1
-0to restore)? "); + puts("\nEdit which field?\n(or 'b' to boot with this command line, 'r=
'
Quoted 69 lines
ipl/ipl.c +0
-0to restore, 'l' to list dir)? "); numbuf[0] =3D '0';ipl/ipl.c +43
-3numbuf[1] =3D '\0';enter_text (numbuf,sizeof numbuf -1 );@@ -264,6 +300,48 @@continue ; } + if (numbuf[0] =3D=3D 'l') + { +char *p, kern_dir[256 ]; +const char *dir; +int fd, part, part_fd; + + +join (commandline, argc, argv, ok); + parse_pfname(argv[0], ∂, kern_dir); + p =3D strrchr(kern_dir, '/'); + *(p+1) =3D '.'; + *(p+2) =3D '\0'; + +printf ("Directory listing of %s\n\n" , kern_dir); + + partition_transform(∂, NULL); + + part--;/* partition table starts from zero */ + part_fd =3D offset_open(bootdev, 512 * partition[part].start, +512 * partition[part].length); + if(ext2_mount(part_fd, 0, 0) =3D=3D -1) { +printf ("Failed to mount partition %d\n" , part); +continue ; + } + + if((fd =3D ext2_open(kern_dir)) =3D=3D -1) { +printf ("Failed to open directory %s\n" , kern_dir); +continue ; + } + + while((dir =3D ext2_readdir(fd, 0)) !=3D NULL) + if(dir[0] !=3D '.') /* skip hidden files and . and .. */ +printf (" %s\n" , dir); + +printf ("\n" ); +ext2_close (fd); +/* There's no umount ... since the next mount reuses +* the current one's data structures ... */ + +continue ; + } + editfield =3D parse_number(numbuf, &p);if (editfield < argc)@@ -284,13 +362,11 @@extern char _end, _edata;int partitioned;unsigned entry; -struct diskpartition partition[MAXPARTS ];struct firstblock f;extern char commandline[];int blocked_bootdev; -int bootdev;int wide; - int kern_part, rd_part, i, ext2 =3D 0, palo_part =3D -1; +int kern_part, rd_part;char kern_name[128 ], rd_name[128 ];char kern_fullname[128 ]; int ok =3D 1;
ipl/ipl.c line 452
Quoted 5 lines
ipl/ipl.c +0
-1@@ -448,30 +524,7 @@if (rd_part !=3D -1 ) printf("Selected ramdisk: %s from partition %d\n", rd_name, rd_part);= -/* if the F0 partition is the same as the requested kernel partiti=
on,
ipl/ipl.c line 453
Quoted 1 line
ipl/ipl.c +0
-1-* for now change it to zero to re-use the existing logic. Should=
do
Quoted 27 lines
ipl/ipl.c +1
-22-* the reverse in the future probably. -*/ - for (i =3D 0; i < sizeof partition / sizeof partition[0]; i++) - { - if (partition[i].id =3D=3D PALO_PARTITION) - { - palo_part =3D i + 1; - if (kern_part =3D=3D palo_part) - kern_part =3D 0; - - if (rd_part =3D=3D palo_part) - rd_part =3D 0; - -break ; - } - } - - if (ext2 && kern_part =3D=3D 0) { - kern_part =3D palo_part; - if(rd_part =3D=3D 0) - rd_part =3D palo_part; - } +partition_transform (&kern_part, &rd_part);if (kern_part >0 && !partitioned){
Quoted 4 lines
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
-------------------------------------------------------------------------=
---------------
Tiscali ADSL, 27,50 =80/mois...pendant 6 mois.
La meilleure offre du march=E9 !
http://reg.tiscali.be/default.asp?lg=3Dfr
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux