Howto: Create a rootfs for Debian Wheezy on GoFlexHome August 10, 2013 05:36PM |
Registered: 10 years ago Posts: 20 |
dd if=/dev/zero of=rootfs.img bs=1M count=1024
su mkfs.ext2 -F rootfs.img mount rootfs.img /mnt -o loop
apt-get install debootstrap qemu-user-static binfmt-support
mount debian-7.1.0-armel-DVD-1.iso /media/cdrom0 -o loop
debootstrap --verbose --arch armel --variant=minbase --foreign --no-check-gpg wheezy /mnt file:///media/cdrom
debootstrap --verbose --arch armel --variant=minbase --foreign wheezy /mnt http://ftp.uk.debian.org/debianFor Emdebian download: there are no .iso images on the official repositories at the moment, so you'll have to download, you'll also need the emdebian-archive-keyring
apt-get install emdebian-archive-keyring debootstrap --verbose --keyring /usr/share/keyrings/emdebian-archive-keyring.gpg --arch armel --variant=minbase --foreign wheezy-grip /mnt http://ftp.uk.debian.org/emdebian/grip /usr/share/debootstrap/scripts/wheezy
cp /usr/bin/qemu-arm-static /mnt/usr/bin mount -t sysfs none /mnt/sys mount -t proc proc /mnt/proc mount -B /dev /mnt/dev mount -B /dev/pts /mnt/dev/pts chroot /mnt
/debootstrap/debootstrap --second-stage
exit mkdir /mnt/media/cdrom mount -B /media/cdrom /mnt/media/cdrom chroot /mnt passwd
apt-cdrom -m add /media/cdromFor Regular Debian downloaded:
cat <<END > /etc/apt/sources.list deb http://security.debian.org/ wheezy/updates main deb http://ftp.debian.org/debian/ wheezy main contrib non-free ENDFor Emdebian
cat <<END > /etc/apt/sources.list deb http://security.debian.org/ wheezy-grip/updates main deb http://ftp.uk.debian.org/emdebian/grip wheezy-grip main deb http://security.debian.org/ wheezy/updates main deb http://ftp.debian.org/debian/ wheezy main END apt-get install emdebian-archive-keyring
cat <<END > /etc/apt/apt.conf APT::Install-Recommends "0"; APT::Install-Suggests "0"; END apt-get update export LANG=C apt-get install apt-utils apt-get install dialog apt-get install locales dpkg-reconfigure -a
export LANG=en_GB.UTF-8
apt-get install module-init-tools isc-dhcp-client udev netbase ifupdown iproute openssh-server iputils-ping wget net-tools ntpdate vim cron anacron hdparm less smbclient bash-completion hdparm bzip2 unzip zip screen less usbutils psmisc fakeroot ethtool
apt-get install uboot-mkimage u-boot-tools samba libpam-smbpass openbsd-inetd ftp-ssl vsftpd lighttpd rsync man info logrotate ethtool rsyslog usbmount
rm /lib/udev/rules.d/75-persistent-net-generator.rules
echo 'T0:2345:respawn:/sbin/getty -L ttyS0 115200 linux' >> /etc/inittab sed -i 's/^\([1-6]:.* tty[1-6]\)/#\1/' /etc/inittab
cat <<END > /etc/network/interfaces auto lo eth0 iface lo inet loopback iface eth0 inet dhcp END
echo RescueDeb > /etc/hostname
echo /dev/mtd0 0xA0000 0x20000 0x20000 > /etc/fw_env.config
cat <<END > /etc/fstab # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> tmpfs /tmp tmpfs defaults 0 0 END
rm -f /etc/blkid.tab ln -s /dev/null /etc/blkid.tab rm -f /etc/mtab ln -s /proc/mounts /etc/mtab
exit cp /home/user/kernel/linux-image-3.4.56-kirkwood_0.1_armel.deb /mnt/usr/src chroot /mnt cd /usr/src dpkg -i linux-image-3.4.56-kirkwood_0.1_armel.deb
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-3.4.56-kirkwood -d /boot/vmlinuz-3.4.56-kirkwood /boot/uImage mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-3.4.56-kirkwood -d /boot/initrd.img-3.4.56-kirkwood /boot/uInitrdNow we can exit the chroot, remove it's links and be ready to copy it onto something
exit umount /mnt/media/cdrom umount /mnt/dev/pts umount /mnt/dev umount /mnt/proc umount /mnt/sys rm /mnt/usr/bin/qemu-arm-static
dmesg | tail -n 30 [225454.245933] usb 2-1.1: USB disconnect, device number 34 [225460.055782] usb 2-1.1: new high-speed USB device number 36 using ehci-pci [225460.141942] usb 2-1.1: New USB device found, idVendor=0781, idProduct=5151 [225460.141949] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [225460.141953] usb 2-1.1: Product: Cruzer Micro [225460.141957] usb 2-1.1: Manufacturer: SanDisk [225460.141960] usb 2-1.1: SerialNumber: 2204521D65818E21 [225460.142596] scsi24 : usb-storage 2-1.1:1.0 [225461.145387] scsi 24:0:0:0: Direct-Access SanDisk Cruzer Micro 8.01 PQ: 0 ANSI: 0 CCS [225461.145936] sd 24:0:0:0: Attached scsi generic sg6 type 0 [225461.146957] sd 24:0:0:0: [sdg] 7862911 512-byte logical blocks: (4.02 GB/3.74 GiB) [225461.147619] sd 24:0:0:0: [sdg] Write Protect is off [225461.147622] sd 24:0:0:0: [sdg] Mode Sense: 45 00 00 08 [225461.148265] sd 24:0:0:0: [sdg] No Caching mode page present [225461.148268] sd 24:0:0:0: [sdg] Assuming drive cache: write through [225461.151622] sd 24:0:0:0: [sdg] No Caching mode page present [225461.151628] sd 24:0:0:0: [sdg] Assuming drive cache: write through [225461.161918] sdg: sdg1 sdg2 sdg3 [225461.165012] sd 24:0:0:0: [sdg] No Caching mode page present [225461.165019] sd 24:0:0:0: [sdg] Assuming drive cache: write through [225461.165023] sd 24:0:0:0: [sdg] Attached SCSI removable disk [225462.355598] EXT4-fs (sdg3): recovery complete [225462.355608] EXT4-fs (sdg3): mounted filesystem with ordered data mode. Opts: (null) [225462.361044] EXT2-fs (sdg1): warning: mounting unchecked fs, running e2fsck is recommended
umount /dev/sdg* fdisk /dev/sdg
Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-7862910, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-7862910, default 7862910): +1GB Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): 2 First sector (1955173-7862910, default 1955173): Using default value 1955173 Last sector, +sectors or +size{K,M,G} (1955173-7862910, default 7862910): +512MB Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 82 Changed system type of partition 2 to 82 (Linux swap / Solaris) Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (1-4, default 3): 3 First sector (2955173-7862910, default 2955173): Using default value 2955173 Last sector, +sectors or +size{K,M,G} (2955173-7862910, default 7862910): Using default value 7862910 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
mkfs.ext3 -L rootfs /dev/sdg1 mkfs.ext3 -L data /dev/sdg3 mkdir /media/usb0 mount /dev/sdg1 /media/usb0 cp -a /mnt/* /media/usb0
umount /dev/sdg1 umount /mnt mount /dev/sdg3 /media/usb0 cp /home/user/rootfs.img /media/usb0 umount /dev/sdg3
ssh root@RescueDeb mkdir /media/data mount /dev/sdb3 /media/data mount /media/data/rootfs.img /mnt -o loop mkdir /media/hdd mount /dev/sda1 /media/hdd cp -a /mnt/* /media/hdd/
ssh root@RescueDeb fdisk /dev/sdaRepeat the selections as we did for setting up the flash memory stick partitions - although I would be inclined to provide a bit more space for expansion - maybe 7.5GB root, 512M swap and the remainder as data - partition schemes are a whole other game
mkfs.ext3 /dev/sda1 mkfs.ext3 /dev/sda3although there's nothing to prevent you using ext4 (just make sure that you include it as an option in your kernel build)
Re: Howto: Create a rootfs for Debian Wheezy on GoFlexHome August 11, 2013 04:45PM |
Registered: 10 years ago Posts: 20 |
root@RescueDeb: mtdinfo /dev/mtd2 -u mtd2 Name: root Type: nand Eraseblock size: 131072 bytes, 128.0 KiB Amount of eraseblocks: 1992 (261095424 bytes, 249.0 MiB) Minimum input/output unit size: 2048 bytes Sub-page size: 512 bytes OOB size: 64 bytes Character device major/minor: 90:4 Bad blocks are allowed: true Device is writable: true Default UBI VID header offset: 512 Default UBI data offset: 2048 Default UBI LEB size: 126976 bytes, 124.0 KiB Maximum UBI volumes count: 128
apt-get install mtd-utils mkfs.ubifs -r /mnt -m 2048 -e 126976 -c 1992 -o ubifs.img
cat <<END > ubinize.cfg cat ubinize.cfg [ubifs] mode=ubi image=ubifs.img vol_id=0 vol_size=220MiB vol_type=dynamic vol_name=rootfs vol_flags=autoresize ENDimage = image name of file system to process
ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg
mkdir /tmp/data mount /dev/sdb3 /tmp/data ubidetach -p /dev/mtd2 ubiformat /dev/mtd2 -f /tmp/data/ubi.img -O 2048 -s 512
ubiattach -p /dev/mtd2 -O 2048 mount -t ubifs /dev/ubi0_0 /mnt